You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/04/05 17:21:19 UTC

[incubator-openwhisk-cli] branch master updated: --web-secure generated integer must be within api gw max int range (#267)

This is an automated email from the ASF dual-hosted git repository.

dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 232fbe4  --web-secure generated integer must be within api gw max int range (#267)
232fbe4 is described below

commit 232fbe4a6c497c47c231260833ef2db3c9aa80ab
Author: Mark Deuser <md...@us.ibm.com>
AuthorDate: Thu Apr 5 13:21:16 2018 -0400

    --web-secure generated integer must be within api gw max int range (#267)
---
 commands/action.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/commands/action.go b/commands/action.go
index 1fcec1f..bce0bf2 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

-- 
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.