[PPSC-602] fix: security code scanning remediations#135
Merged
yiftach-armis merged 2 commits intomainfrom Mar 31, 2026
Merged
Conversation
Prevent credential leakage by disabling redirect-following on the auth HTTP client. On 307/308 redirects Go re-sends the POST body (including client_id and client_secret) to the redirect target. The auth endpoint should never redirect; if it does, return the response as-is. Adds tests verifying the client does not follow redirects and that normal authentication still works.
Test Coverage Reporttotal: (statements) 81.0% Coverage by function |
There was a problem hiding this comment.
Pull request overview
Remediates a credential-leakage risk in the auth client by preventing automatic HTTP redirect following during authentication requests, and adds tests to validate the behavior.
Changes:
- Disable HTTP redirect following in
NewAuthClientviahttp.Client.CheckRedirectto avoid leaking client credentials on 307/308 redirects. - Add unit tests covering redirect behavior and a successful authentication response.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/auth/client.go |
Disables redirects on the auth HTTP client to prevent credential leakage via redirect-following. |
internal/auth/client_test.go |
Adds tests for redirect non-following and for a successful auth response parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Switch from TLS test servers to plain HTTP so redirect-following (if it happened) would actually reach the target handler instead of failing on self-signed certs. Add specific AuthError type assertion with status code check for more precise failure diagnostics.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Type of Change
Problem
Static analysis (security code scanning) flagged multiple CWE vulnerabilities across the codebase: integer overflow in file-size calculation (CWE-190), debug info exposure in auth (CWE-215), missing checksum verification during install (CWE-494), overly permissive GitHub Actions workflow permissions (CKV2_GHA_1), unbounded scan/upload timeouts (CWE-770), and credential leakage via HTTP redirects on the auth client (CWE-601).
Solution
Each finding was remediated in its own commit:
calculateFilesSizebefore accumulatingpermissionsto GitHub Actions workflowsAlso includes dependency bumps (anchore/sbom-action, go-runewidth) and documentation improvements (CI integration, Windows install parity).
Testing
Automated Tests
Manual Testing
go test ./...passesChecklist