| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Warning
Auth-less details can still produce malformed token undefined headers, and the new unauthenticated path lacks direct coverage.
2 open findingsEnables future unauthenticated GitHub.com API requests from enterprise environments while centralizing GitHub instance details.
Changes:
| File | Description |
|---|---|
| src/api-client.ts | Supports unauthenticated Octokit clients. |
| src/github.ts | Adds GitHub instance types and helpers. |
| src/github.test.ts | Tests the new helpers. |
| src/util.ts | Removes relocated GitHub URL utilities. |
| src/util.test.ts | Removes relocated tests. |
| src/upload-lib.ts | Uses the current-instance helper. |
| src/status-report.ts | Imports the relocated Dotcom URL. |
| src/setup-codeql.ts | Uses the relocated Dotcom URL. |
| src/setup-codeql-action.ts | Uses centralized instance details. |
| src/init-action.ts | Uses centralized instance details. |
| src/database-upload.ts | Imports the relocated URL parser. |
| src/codeql.test.ts | Requires authentication in the relevant test helper. |
| lib/entry-points.js | Generated bundle file; content excluded from review. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
This shouldn't be possible, but was previously handled by the library
Also add some tests for it
There was a problem hiding this comment.
Warning
The focused authentication refactor and accompanying regression tests leave no identified blocking issues.
0 open findings
2 resolved since last review🧠 Review effort: Balanced
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for the discussion on Slack and the thorough followup! Just a couple of last suggestions, which I'm happy for you to make in a followup PR.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Related to #4198 (comment).
We currently have a few different scenarios for where we fetch CodeQL CLI releases from depending on the environment that the CodeQL Action is running in. The usual case is that the running Action comes from github.com/github/codeql-action and is running in a workflow on github.com. In that case, the token we have can be used with api.github.com.
The CodeQL Action may also be running on GHES or GitHub Enterprise Cloud with Data Residency. In those cases, the token we have is for the respective environment. Our logic for finding a release to download the CodeQL CLI from prioritises the more specific environments, but falls back to fetching a release from github.com/github/codeql-action if the release is not available more locally. In that case, we should not use the token to authenticate any requests made from the host instance to the GitHub.com instance.
Currently, for downloads, this is done with the help of getAuthorizationHeaderFor which tests whether a given url matches the GitHub instance represented by a particular GitHubApiDetails object, which also contains the token. The token is only returned if the url is a match for the GitHub instance.
We don't currently have an equivalent process for API requests from a different GitHub instance to GitHub.com, even though the GitHub.com API will accept unauthenticated requests for public resources (with much tighter rate limits than authenticated requests). This is, in part, because we use getOctokitOptions from @actions/github to construct OctokitOptions for the API client, which requires a (non-empty) token.
This PR tidies up some of the code related to this, but mainly replaces the (virtually unnecessary) call to getOctokitOptions so that we are constructing the OctokitOptions ourselves and allow no token to be provided. This is fine for Octokit. This relaxation of the requirements in our api-client.ts library isn't used here, but it will allow us to make some API requests from other GitHub instances to GitHub.com in the future when necessary.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
Products:
Environments:
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist