-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added cloudsmith scanner #405
Added cloudsmith scanner #405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few small comments, otherwise lgtm. 👍
client = common.SaneHttpClient() | ||
|
||
//Make sure that your group is surrounded in boundry characters such as below to reduce false positives | ||
keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"cloudsmith"}) + `\b([0-9a-z]{40})\b`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: use \b([0-9a-f]{40})\b
as the regex to make the search stricter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some extra context: it's hex encoding that uses the a-f characters rather than a-z
} | ||
|
||
if verify { | ||
req, err := http.NewRequestWithContext(ctx, "GET", "https://api.cloudsmith.io/user/self/", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I'd recommend explicitly stating the API version we are using https://api.cloudsmith.io/v1/user/self/
this will protect us from any breaking changes introduced to their API. If we leave it without a version, we are leaving our compatibility with their API up to them, as when it's upgraded we would automatically use their newer version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I have committed the changes. Thanks @ahrav!
* added new protos * added new detectors * added cloudsmith scanner * enhanced regex and added version to endpoint
No description provided.