mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-15 00:48:39 +08:00
ci: require npm audit signature checks
Require npm registry signature verification wherever workflow npm audit checks run. - add npm audit signatures to CI Security Scan and maintenance security audit jobs - teach the workflow security validator to reject npm audit without signature verification - keep the repair and Copilot prompt tests portable across Windows path/case and CRLF frontmatter behavior Validation: - node tests/run-all.js (2376 passed, 0 failed) - CI current-head matrix green on #1846
This commit is contained in:
@@ -26,6 +26,8 @@ const RULES = [
|
||||
|
||||
const WRITE_PERMISSION_PATTERN = /^\s*(?:contents|issues|pull-requests|actions|checks|deployments|discussions|id-token|packages|pages|repository-projects|security-events|statuses):\s*write\b/m;
|
||||
const NPM_CI_PATTERN = /\bnpm\s+ci\b(?![^\n]*--ignore-scripts)/g;
|
||||
const NPM_AUDIT_PATTERN = /\bnpm\s+audit\b(?!\s+signatures\b)/;
|
||||
const NPM_AUDIT_SIGNATURES_PATTERN = /\bnpm\s+audit\s+signatures\b/;
|
||||
const ACTIONS_CACHE_PATTERN = /uses:\s*['"]?actions\/cache@/m;
|
||||
const ID_TOKEN_WRITE_PATTERN = /^\s*id-token:\s*write\b/m;
|
||||
|
||||
@@ -127,6 +129,16 @@ function findViolations(filePath, source) {
|
||||
});
|
||||
}
|
||||
|
||||
if (NPM_AUDIT_PATTERN.test(source) && !NPM_AUDIT_SIGNATURES_PATTERN.test(source)) {
|
||||
violations.push({
|
||||
filePath,
|
||||
event: 'npm audit signatures',
|
||||
description: 'workflows that run npm audit must also verify registry signatures',
|
||||
expression: 'npm audit without npm audit signatures',
|
||||
line: getLineNumber(source, source.search(NPM_AUDIT_PATTERN)),
|
||||
});
|
||||
}
|
||||
|
||||
return violations;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user