Skip to content

Conversation

@alessandro-Doyensec
Copy link
Contributor

This PR adds the logic to detect Amazon CodeCatalyst personal access tokens by introducing a Git Basic Auth detector.

It also introduce common logic for future git basic auth scanners for other git providers.

@alessandro-Doyensec
Copy link
Contributor Author

Note:

In c1abfc7 I removed the strings.HasSuffix(path, ".history.txt") condition inside of the FileRequired function, which would have lead to redundant results due to .txt files already being required by the global secrets.Detector.

}

// Validate validates code AWS CodeCatalyst Git Basic Auth credentials.
func (v *Validator) Validate(ctx context.Context, secret Credentials) (veles.ValidationStatus, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the simplevalidate library for this? I know we have a separate helper function here for setting up the HTTP request but maybe that can be turned into a simplevalidate.Validator that takes params from the codecatalyst package (e.g. which prefix to check for)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that takes params from the codecatalyst package (e.g. which prefix to check for)

Yes, I could inject that logic into the EndpointFunc and return an error if the URL is not on the specific domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fe9c461 I've modified the logic to use the simplevalidate.Validator. I could also have created a gitvalidator in the gitbasicauth pkg but I think this is a nice in-between for now, since I’m not sure yet whether other providers share all the validation logic.

@alessandro-Doyensec
Copy link
Contributor Author

Hello @erikvarga , thanks for the review.

I noticed that the Linter plugger action has failed due to a false positive (ref: https://github.com/google/osv-scalibr/actions/runs/19894641620/job/57438637665?pr=1577).

That is due to a linter bug (fixed in #1541) where plugin registrations were only picked up if the package name differed from the function’s package. When two packages had the same name but different paths, the registrations weren’t detected.

@erikvarga
Copy link
Collaborator

Hello @erikvarga , thanks for the review.

I noticed that the Linter plugger action has failed due to a false positive (ref: https://github.com/google/osv-scalibr/actions/runs/19894641620/job/57438637665?pr=1577).

That is due to a linter bug (fixed in #1541) where plugin registrations were only picked up if the package name differed from the function’s package. When two packages had the same name but different paths, the registrations weren’t detected.

I see, thanks for fixing it. In that case we can just merge this PR after the plugger fixes have been merged.

edit: convert the detector to a simpletoken.detector
@copybara-service copybara-service bot merged commit a912495 into google:main Dec 9, 2025
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants