-
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
Fix/saucelabs detector #3696
Fix/saucelabs detector #3696
Conversation
pkg/detectors/saucelabs/saucelabs.go
Outdated
@@ -91,3 +78,30 @@ func (s Scanner) Type() detectorspb.DetectorType { | |||
func (s Scanner) Description() string { | |||
return "A service for cross browser testing, API keys can create and access tests from potentially sensitive internal websites" | |||
} | |||
|
|||
func verifySauceLabKey(ctx context.Context, client *http.Client, userName, key string) (bool, error) { | |||
req, err := http.NewRequestWithContext(ctx, "GET", "https://api.eu-central-1.saucelabs.com/team-management/v1/teams", 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.
What about us-west and us-east?
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.
I thought about that and the solution I have on my mind is to search for base URL in chunk, if found use that else used a fixed one. What do you think? Earlier we were only using one.
Also during testing I noticed that if we hit a URL which we do not have access to with valid token it gives us 403
and if token is incorrect we get 401
.
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.
@rgmz can you check now? If current approach looks ok to you.
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.
That's probably fine. I did something similar here.
In theory, I think you're supposed to use CloudProvider
/ EndpointCustomizer
/ EndpointSetter
; I have no clue how tf to actually use them.
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.
I think that is to provide users the functionality to pass their own custom endpoints for the application/software vs using the default cloud endpoint. Here we have only three fix endpoints to choose from. Correct me @mcastorina If I am wrong about the usage of EndpointCustomizer.
512cbb2
to
b08237f
Compare
Description:
This PR fixes the SauceLabs detector. It fixes the username pattern and overall logic.
Checklist:
make test-community
)?make lint
this requires golangci-lint)?