Skip to content

fix: strip whitespace from CODECOV_TOKEN in Authorization header - #792

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/strip-token-whitespace-CENaPS
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/strip-token-whitespace-CENaPS

Conversation

@sentry

@sentry sentry Bot commented Sep 14, 2026

Copy link
Copy Markdown

The CODECOV_TOKEN environment variable, especially when sourced from CI environments like GitHub Actions, can contain trailing newline characters (e.g., \n\n). When this token is used to construct the Authorization header in HTTP requests, the requests library correctly rejects the header value due to these invalid characters, raising an InvalidHeader exception.

This fix addresses the issue by calling .strip() on the token value in both get_token_header() and get_token_header_or_fail() functions within codecov_cli/helpers/request.py. This ensures that any leading or trailing whitespace, including newlines, is removed before the token is interpolated into the Authorization header, preventing the InvalidHeader error.

Fixes CLI-1R

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry

sentry Bot commented Sep 14, 2026

Copy link
Copy Markdown
Author

⚠️ Seer needs additional GitHub permissions

Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.

Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update

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.

0 participants