[ARVADOS] updated: 5e2eeeaabfdd2673ee58cc0da54e943fd2841d04

git at public.curoverse.com git at public.curoverse.com
Thu Oct 16 01:29:55 EDT 2014


Summary of changes:
 services/keepstore/perms.go | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

       via  5e2eeeaabfdd2673ee58cc0da54e943fd2841d04 (commit)
      from  f39807a3c5dd32520bebd4fcd5254f214351eb4f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5e2eeeaabfdd2673ee58cc0da54e943fd2841d04
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 16 01:29:09 2014 -0400

    4219: Use a precompiled global regexp for signature verification.

diff --git a/services/keepstore/perms.go b/services/keepstore/perms.go
index 9fd65dd..1048f53 100644
--- a/services/keepstore/perms.go
+++ b/services/keepstore/perms.go
@@ -80,15 +80,12 @@ func SignLocator(blob_locator string, api_token string, expiry time.Time) string
 		"@" + timestamp_hex
 }
 
+var signedLocatorRe = regexp.MustCompile(`^([[:xdigit:]]{32}).*\+A([[:xdigit:]]{40})@([[:xdigit:]]{8})`)
+
 // VerifySignature returns true if the signature on the signed_locator
 // can be verified using the given api_token.
 func VerifySignature(signed_locator string, api_token string) bool {
-	re, err := regexp.Compile(`^([[:xdigit:]]{32}).*\+A([[:xdigit:]]{40})@([[:xdigit:]]{8})`)
-	if err != nil {
-		// Could not compile regexp(!)
-		return false
-	}
-	matches := re.FindStringSubmatch(signed_locator)
+	matches := signedLocatorRe.FindStringSubmatch(signed_locator)
 	if matches == nil {
 		// Could not find a permission signature at all
 		return false

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list