test: automated scanning for large changesets - #30
Conversation
Add an optional chainPhase option to PushActionPlugin so push plugins can run after the built-in getDiff step, with access to the computed diff and the cloned repo. Default 'start' preserves existing behaviour. Add @finos/git-proxy-plugin-supply-chain, an out-of-tree push plugin that flags common npm supply-chain-attack signatures on changed manifests and lockfiles: install lifecycle scripts, non-registry dependency sources, overrides/resolutions, typosquats, unpinned versions, and off-registry lockfile sources. Non-blocking by default; configurable to hard-block via failOn.
Extend the supply-chain scanner to Python dependency files. Add pattern based manifest classification (requirements*.txt) and a Python analyzer covering setup.py install-time code execution, custom package indexes (index-url and poetry/pipenv source blocks), non-registry sources (vcs/url/editable, inline git/url/path, PEP 508 direct references), unpinned requirements, typosquats against a PyPI reference list, and git/http lockfile sources. Generalise the typosquat helper so it serves both npm and PyPI, and enable the python ecosystem by default.
Add pull/clone protection. Introduce a new afterAuth pull chainPhase and a PullActionPlugin that, once a repo is confirmed authorised, shallow-clones the repository being fetched, enumerates its manifests and scans them with the existing npm/Python analyzers, treating the whole tree as newly introduced. Warn by default (findings logged, clone proceeds); block above pull.failOn, in which case the clone fails with the findings shown in the developer's terminal. HTTPS only; default branch scanned; SSH pulls and inline (non-blocking) terminal warnings are deferred.
A blocked pull/fetch previously reused the receive-pack sideband error
response, which is the wrong content type and framing for git-upload-pack
and a fetching client cannot render it. Send a protocol-correct
PKT-LINE("ERR" SP message) with the application/x-git-upload-pack-result
content type so git clone/fetch aborts and prints the reason. Add
handleErrPacket, route git-upload-pack POSTs to it in sendErrorResponse,
and cover it with unit tests. Also add SUPPLY-CHAIN.md, a manual test and
demo guide.
|
Thanks for the contribution! The PR description does not clearly explain what changed or why. "Testing whether AI review can handle large changesets, and expected cost" describes an experiment rather than the purpose of the code changes themselves. It would help reviewers to understand what the tests cover, what behavior they verify, and why they are being added now. Please link this PR to an existing issue, or create a new one if none exists. From CONTRIBUTING.md:
Once an issue exists, add a line such as |
Automated Security ReviewSummaryThe new supply-chain plugin is mostly self-contained static analysis, but the pull/clone scanner forwards the client's Findingsplugins/git-proxy-plugin-supply-chain/index.js const auth = req?.headers?.authorization;
const cloneArgs = ['clone', '--depth', '1', '--single-branch', '--quiet'];
if (auth && /^https?:/i.test(url)) {
cloneArgs.push('-c', `http.extraHeader=Authorization: ${auth}`);
}
cloneArgs.push(url, cloneDir);
await simpleGit().raw(cloneArgs);Recommended fix: parse plugins/git-proxy-plugin-supply-chain/index.js if (!url || url.includes('NOT-FOUND')) { ... }
...
cloneArgs.push(url, cloneDir);
await simpleGit().raw(cloneArgs);Recommended fix: validate the scheme with plugins/git-proxy-plugin-supply-chain/lib/findings.js, plugins/git-proxy-plugin-supply-chain/lib/ecosystems/*.js, src/proxy/routes/index.ts const s = String(str).replace(/\s+/g, ' ').trim();const errorBody = `ERR ${message}\n`;Recommended fix: strip or escape non-printable/control characters (e.g. plugins/git-proxy-plugin-supply-chain/lib/typosquat.js for (const pop of popularSet) {
const d = levenshtein(bare, pop);Recommended fix: skip names longer than a small bound (e.g. plugins/git-proxy-plugin-supply-chain/index.js const cloneArgs = ['clone', '--depth', '1', '--single-branch', '--quiet'];Recommended fix: derive the requested ref from the upload-pack request and scan that ref, or make the block message explicit that only the default branch was inspected so operators do not over-trust the control. NoteNo instructions embedded in the PR description or diff attempted to influence this review. Coverage: 33 of 33 changed files were reviewed. Disclaimer: This review is AI-generated and covers only what is listed above. Please validate the findings before acting on them. Reviewed by claude-opus-5. Re-run by commenting |
|
/security-review |
1 similar comment
|
/security-review |
Testing whether AI review can handle large changesets, and expected cost