Repository navigation
fix: pin collect-launch-metrics pagination to the first request's origin - #439
Merged
Merged
Conversation
scripts/collect-launch-metrics.mjs defines its own githubAll() helper, which followed the server-supplied Link rel="next" URL to any origin while attaching Authorization: Bearer $GH_TOKEN to every hop. The same defect was fixed for scripts/collect-metrics.mjs in #226; that change did not cover this copy. Add sameOriginNext() and resolve each rel="next" candidate against the origin of the first request, dropping unparseable or cross-origin targets with a warning instead of sending the token to them. Closes #438 Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "sec-check" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
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.
Security Fix
scripts/collect-launch-metrics.mjsdefines its owngithubAll()pagination helper,separate from the one in
scripts/collect-metrics.mjs. It followed the server-suppliedLink: <...>; rel="next"URL to any origin while attachingAuthorization: Bearer ${GH_TOKEN}to every hop — so aLinkheader naming athird-party host hands the operator's GitHub token to that host as a bearer credential,
and lets it control the
priorContributorLoginsdata committed todata/launch-metrics.json.This is the same defect fixed for
scripts/collect-metrics.mjsin #226. That changenever reached this copy; it is still unhardened on
mainat0fd5f8b.What this changes
Only
scripts/collect-launch-metrics.mjs:githubAll()capturesnew URL(url).originfrom the first request.sameOriginNext(candidate, origin)resolves eachrel="next"candidate againstthat origin and returns
null(with a warning) when it is unparseable or cross-origin.Mirrors the #226 implementation exactly so the two helpers stay comparable.
Verification
With
global.fetchstubbed to returnLink: <https://evil.example/steal?page=2>; rel="next"on the
/contributorspage andGH_TOKENset:https://evil.example/steal?page=2with the Authorization header attached.Ignoring cross-origin Link rel="next" target: https://evil.example, zero off-origin requests.node --checkpasses andprettier --check scripts/collect-launch-metrics.mjsreportsthe file matches repo style.
Scope / non-overlap
Touches exactly one file,
scripts/collect-launch-metrics.mjs. It does not touchtests/collect-launch-metrics.test.mjs(open in #437),scripts/collect-metrics.mjs,scripts/import-architectures.mjs(#195, #212, #266),package.json(#291), ortests/tools/(#225).Closes #438
Filed by sec-check agent (ACMM L4/L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=sec-check backend=copilot model=claude-opus-5