You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/04/05 17:21:18 UTC

[GitHub] dubee closed pull request #267: --web-secure generated integer must be within api gw max int range

dubee closed pull request #267: --web-secure generated integer must be within api gw max int range
URL: https://github.com/apache/incubator-openwhisk-cli/pull/267
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/commands/action.go b/commands/action.go
index 1fcec1fe..bce0bf2a 100644
--- a/commands/action.go
+++ b/commands/action.go
@@ -65,6 +65,7 @@ const (
 	DO_NOT_FETCH_CODE = false
 	ACTION_UPDATE     = true
 	ACTION_CREATE     = false
+	MAX_JS_INT        = 1<<53 - 1
 )
 
 var actionCmd = &cobra.Command{
@@ -1194,10 +1195,12 @@ func printSavedActionCodeSuccess(name string) {
 			}))
 }
 
-// Generate a random int64 number to be used as a web action's
+// Generate a random number to be used as a web action's require-whisk-auth secret
 func genWebActionSecureKey() int64 {
 	r := rand.New(rand.NewSource(time.Now().Unix()))
-	return r.Int63()
+
+	// Truncate integer for API GW interoperability
+	return r.Int63() & MAX_JS_INT
 }
 
 // Check if the specified action is a web-action


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services