Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(1.10.1) Invalid CIDR response to access key creation #75

Closed
gszr opened this issue Aug 3, 2017 · 5 comments
Closed

(1.10.1) Invalid CIDR response to access key creation #75

gszr opened this issue Aug 3, 2017 · 5 comments

Comments

@gszr
Copy link

gszr commented Aug 3, 2017

Running jfrog bt acc-keys --user USER --key KEY --org ORG create -- where USER, KEY, and ORG are placeholders for my actual values :) -- gives me the following error on version 1.10.1; works properly on 1.9.0:

[Info] Creating access key...
[Error] Bintray response: 400 Bad Request
{
  "message": "Invalid CIDR ."
}

Edit: Mac distribution.

@gszr
Copy link
Author

gszr commented Aug 4, 2017

The problem appears to be in bintray/commands/accesskeys.go, function BuildAccessKeyJson. If either --white-cidrs or --black-ciders is empty, the splits on line 98 and 99 will result in a 1-element slice -- an empty slice wouldn't cause it. I suspect something like the following should be a correct solution:

diff --git a/bintray/commands/accesskeys.go b/bintray/commands/accesskeys.go
index 4720183..c54267d 100644
--- a/bintray/commands/accesskeys.go
+++ b/bintray/commands/accesskeys.go
@@ -92,11 +92,21 @@ func BuildAccessKeyJson(flags *AccessKeyFlags) (string, error) {
 		return "", err
 	}
 
+	var whiteCidrsSplit []string
+	if flags.WhiteCidrs != "" {
+		whiteCidrsSplit = strings.Split(flags.WhiteCidrs, ",")
+	}
+
+	var blackCidrsSplit []string
+	if flags.BlackCidrs != "" {
+		blackCidrsSplit = strings.Split(flags.BlackCidrs, ",")
+	}
+
 	data := AccessKeyConfig{
 		Id:             flags.Id,
 		Expiry:         flags.Expiry,
-		WhiteCidrs:     strings.Split(flags.WhiteCidrs, ","),
-		BlackCidrs:     strings.Split(flags.BlackCidrs, ","),
+		WhiteCidrs:     whiteCidrsSplit,
+		BlackCidrs:     blackCidrsSplit,
 		ApiOnly:        apiOnly,
 		ExistenceCheck: ExistenceCheckConfig{
 			Url:             flags.ExistenceCheckUrl,

EDIT: mention @eyalbe4 and @yoav :-)

@romangurevitch
Copy link
Contributor

@Salazar,
Thanks for reporting this issue,
We will look at this issue and report soon.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Aug 17, 2017

@Salazar,
Thanks for reporting and identifying the issue in the code.
We'll soon release a fix.
We'll let you know once it is released.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Aug 18, 2017

@Salazar,
Version 1.10.2 has been released and includes the fix for this Issue.
We'd appreciate your feedback for it.

@gszr
Copy link
Author

gszr commented Aug 19, 2017

Thanks for letting me know @eyalbe4. Closing this issue.

@gszr gszr closed this as completed Aug 19, 2017
yahavi pushed a commit to yahavi/jfrog-cli that referenced this issue Mar 16, 2020
* artifactory : add support for exclude-props in aql build

* CR fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants