Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 4
Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoUse configured registries for pnpm's native binary download
AI Description
Diagram
High-Level Assessment
Files changed (19)
|
Runtime behavior changed
Garnet Bootstrap Routing / bootstrap-routing (ubuntu, node 22) · +1 −2
|
Code Review by Qodo
1. A project registry receives user tokens
|
| const path = repo.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "").replace(/\/+$/, ""); | ||
| [owner, name] = path.split("/"); | ||
| if (path.split("/").length !== 2) owner = undefined; | ||
| } |
There was a problem hiding this comment.
1. Invalid pull request numbers reach github 📜 Skill insight ⛨ Security
parseTarget converts the supplied pull-request text with Number() and accepts it when it is a positive safe integer, rather than requiring the decimal-digit format. Inputs such as 1e2 or +1 therefore reach GitHub API URL construction and lookup despite the command contract requiring ^[0-9]+$.
Agent Prompt
Issue description
The pull-request argument is converted with `Number()` before being checked, so syntactically invalid values such as `1e2` and `+1` are accepted and used in GitHub API requests.
Fix Focus Areas
- .garnet/runtime-review/src/runtime-review.js[43-46]
- .garnet/runtime-review/bin/garnet-runtime-review.js[170-174]
Recommended Fix
Validate the raw pull-request string against `^[0-9]+$` before calling `Number()` or constructing any API path. Reject invalid values with `InputError`, then convert only the validated decimal string to a safe integer.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const npmrc = readUserNpmrc() | ||
| if (readProjectNpmrc) { | ||
| Object.assign(npmrc, readNpmrc(path.join(projectDir(), '.npmrc'), projectEntry)) | ||
| } | ||
| const registry = npmrc['@pnpm:registry'] || settingFromEnv('registry') || npmrc.registry | ||
| if (!registry) { | ||
| return { registry: DEFAULT_REGISTRY, headers: corepackHeaders() } | ||
| } | ||
| return { registry, headers: npmrcHeaders(npmrc, registry) } |
There was a problem hiding this comment.
2. A project registry receives user tokens 📜 Skill insight ⛨ Security
registryAccess merges the repository .npmrc into the user settings and then passes the selected registry to npmrcHeaders, which searches those merged settings for authorization. A repository can therefore set a literal registry such as npmjs and cause a user's matching registry token from their home .npmrc to be sent during the native binary download.
Agent Prompt
Issue description
A repository-controlled `.npmrc` can select a registry, after which the merged configuration lets that registry receive matching user-level credentials. This violates the trust boundary for repository-selected registries.
Fix Focus Areas
- pnpm/npm/pnpm/bin/pnpm.mjs[113-121]
- pnpm/npm/pnpm/bin/pnpm.mjs[228-250]
Recommended Fix
Keep repository-selected registry values separate from user authentication settings. Do not look up or send user-level credentials when the effective registry comes from the project `.npmrc`; require an explicit trusted user-level scope or another clear trust boundary before attaching authorization headers, and add a regression test covering a project-selected registry with a matching user token.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| persist-credentials: false | ||
| sparse-checkout: .garnet/runtime-review |
There was a problem hiding this comment.
3. Pull requests can forge a passing check 🐞 Bug ⛨ Security
The evidence workflow checks out the pull request head and runs its .garnet/runtime-review code with a token granted checks: write. A contributor who can open a same-repository pull request can change that code to publish a successful garnet/evidence check without evaluating the runtime record.
Agent Prompt
## Issue description
The workflow executes pull-request-controlled publisher code while supplying a check-writing token.
## Fix Focus Areas
- .github/workflows/garnet3-evidence-check.yml[31-50]
## Recommended Fix
Run the publisher from a trusted base-branch revision, not the pull request checkout. Keep the write token available only to that trusted publication step; treat pull-request content solely as data.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const markerCommit = /<!--\s*garnet:commit\s+([0-9a-f]{40})\s*-->/.exec(body ?? "")?.[1] ?? null; | ||
| const headBound = !pending && verdict.record?.comparison?.headSha === headSha; | ||
| let bound = verdict.verdict !== "undeterminable"; |
There was a problem hiding this comment.
4. A mismatched record can pass the check 🐞 Bug ≡ Correctness
getRuntimeReview extracts marker_commit but determines headBound solely from the summary’s commit field. If the bot comment’s garnet:commit marker is missing or names another SHA while its summary names the current head, the CLI can classify it as no-change and publish a successful check despite having no marker-bound record.
Agent Prompt
## Issue description
The new evidence consumer can report a successful head-bound check without a matching HTML commit marker.
## Fix Focus Areas
- .garnet/runtime-review/src/runtime-review.js[94-101]
- .garnet/runtime-review/src/consumer-verdict.js[61-80]
## Recommended Fix
Require the bot comment's `garnet:commit` marker and the parsed summary commit to equal the current PR head before returning a bound verdict. Treat a missing or mismatched marker as undeterminable.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues can redirect bootstrap downloads to public npm, misreport or fail to parse runtime-review evidence, and let an unauthenticated malformed request terminate the exposed server.
3 open issues
What changed in this PR
Updates pnpm’s native-binary bootstrap to use configured registries and credentials, and adds fork-only tooling to publish runtime evidence on pull requests.
Changes:
- Reads registry settings and credentials from user/project
.npmrcfiles and environment variables, preserving Corepack precedence. - Adds bootstrap tests for registry routing, authentication, and project-configuration restrictions when signature verification is disabled.
- Adds a Garnet runtime-review CLI, MCP transports, parsers, and GitHub evidence-check workflow.
| File | Description |
|---|---|
pnpm/npm/pnpm/test/registry-fixture.mjs |
Records request URLs and authorization headers. |
pnpm/npm/pnpm/test/corepack-entry.test.mjs |
Tests configured registries and credential handling. |
pnpm/npm/pnpm/bin/pnpm.mjs |
Resolves bootstrap registry access from configuration. |
.github/workflows/garnet3-evidence-check.yml |
Publishes head-bound runtime evidence checks. |
.garnet/runtime-review/src/tools.js |
Defines runtime-review and profile tools. |
.garnet/runtime-review/src/stdio.js |
Provides the MCP stdio transport. |
.garnet/runtime-review/src/runtime-review.js |
Retrieves and summarizes runtime evidence. |
.garnet/runtime-review/src/runtime-review-diff.js |
Extracts jobs and destination changes. |
.garnet/runtime-review/src/parse-runtime-review.js |
Parses record metadata and reconciles counts. |
.garnet/runtime-review/src/mcp.js |
Handles MCP requests and tool calls. |
.garnet/runtime-review/src/http.js |
Provides the MCP HTTP transport. |
.garnet/runtime-review/src/github-check.js |
Builds annotations and publishes GitHub checks. |
.garnet/runtime-review/src/garnet-profile.js |
Reads opt-in local Garnet profiles. |
.garnet/runtime-review/src/execution-profile.js |
Retrieves public profiles and GitHub run context. |
.garnet/runtime-review/src/consumer-verdict.js |
Evaluates record validity and capture completeness. |
.garnet/runtime-review/src/check-line.js |
Formats concise evidence outcomes. |
.garnet/runtime-review/README.md |
Documents the fork-only tooling snapshot. |
.garnet/runtime-review/bin/garnet-runtime-review.js |
Adds CLI commands and server entry points. |
.changeset/bootstrap-download-reads-npmrc.md |
Records the bootstrap routing fix for release. |
Review effort: Balanced
| } | ||
| const handler = createHttpHandler(createToolset({ githubToken, enableGarnetctl })); | ||
| createServer((request, response) => { | ||
| const path = new URL(request.url ?? "/", "http://localhost").pathname; |
| if (facts.bound_to_head && facts.changes.length === 0) { | ||
| facts.outcome = "nothing new"; | ||
| facts.reason = "workload unchanged; every changed destination is runner or platform noise"; | ||
| } else facts.reason = `record for head ${head} is not bound to this head`; |
| const headlineMatch = /\*\*Execution Profiles recorded for (\d+) jobs?\b/.exec(body); | ||
| checks.jobsHeadline = compareCheck( | ||
| counts.jobs, | ||
| headlineMatch === null ? null : Number(headlineMatch[1]), |
1004c0d to
dbdc1c9
Compare
|
Code review by qodo was updated up to the latest commit dbdc1c9 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |

Fork-only canary: the routing change, compared against the recorded baseline.
Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.