Skip to content

Move GitHub access token from query parameter into header#1261

Merged
mhucka merged 10 commits intoquantumlib:mainfrom
mhucka:security-fix-github-token-10096806154113847228
Apr 23, 2026
Merged

Move GitHub access token from query parameter into header#1261
mhucka merged 10 commits intoquantumlib:mainfrom
mhucka:security-fix-github-token-10096806154113847228

Conversation

@mhucka
Copy link
Copy Markdown
Contributor

@mhucka mhucka commented Apr 10, 2026

GitHub deprecated passing the access token in the URL. This change moves it to the Authorization header, which is more secure and compliant with GitHub's current API standards. It also adds a test file.

mhucka and others added 3 commits April 10, 2026 21:29
GitHub deprecated passing the access token in the URL. This change moves it to the Authorization header, which is more secure and compliant with GitHub's current API standards.
@mhucka mhucka marked this pull request as ready for review April 10, 2026 22:19
@mhucka mhucka requested review from fdmalone and mpharrigan April 10, 2026 22:20
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves security by refactoring the report_status_to_github method to pass the GitHub access token via the Authorization header instead of a URL query parameter. A new security test has been added to verify this implementation. Feedback suggests adding a check for None values in actual_commit_id to prevent malformed API requests and implementing a timeout for the HTTP POST request to avoid potential hanging in CI/CD pipelines.

Comment thread dev_tools/prepared_env.py
Comment thread dev_tools/prepared_env.py Outdated
mhucka and others added 3 commits April 22, 2026 22:35
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@mhucka mhucka enabled auto-merge April 23, 2026 05:36
@mhucka
Copy link
Copy Markdown
Contributor Author

mhucka commented Apr 23, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the security and robustness of the GitHub status reporting mechanism by moving the access token from URL query parameters to the Authorization header, adding a request timeout, and implementing a guard against null commit IDs. It also introduces a new security test suite to verify these changes. The review feedback suggests transitioning from the legacy token scheme to the Bearer scheme in the Authorization header to align with modern GitHub API standards and ensure compatibility with fine-grained personal access tokens.

Comment thread dev_tools/prepared_env.py Outdated
Comment thread dev_tools/prepared_env_security_test.py Outdated
mhucka and others added 2 commits April 22, 2026 22:46
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@mhucka
Copy link
Copy Markdown
Contributor Author

mhucka commented Apr 23, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves security and robustness in the report_status_to_github function by moving the GitHub access token from URL query parameters to an Authorization header. It also adds a 30-second timeout to the POST request and an early return if the commit ID is missing. A new test file, dev_tools/prepared_env_security_test.py, has been introduced to verify that the token is correctly handled. I have no feedback to provide.

@mhucka mhucka disabled auto-merge April 23, 2026 05:52
@mhucka mhucka enabled auto-merge April 23, 2026 21:07
@mhucka mhucka added this pull request to the merge queue Apr 23, 2026
Merged via the queue into quantumlib:main with commit a311619 Apr 23, 2026
18 checks passed
@mhucka mhucka deleted the security-fix-github-token-10096806154113847228 branch April 23, 2026 21:23
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