#20 git-forensics' reflog force-push detector had a redundant bare 'reset' term subsuming 'reset:', so any commit subject containing 'reset' tripped it; removed. #22 diff-engine's per-current moved-fallback greedily consumed a baseline candidate a later byte-exact match needed (mislabeling unchanged as new/moved on duplicate fingerprints); a global exact pass now runs before the moved-fallback. #54 memory-poisoning double-reported a 64+ char hex token as both base64 and hex; the base64 check now skips pure-hex tokens. #56 SARIF output hardcoded driver.version 6.0.0 because the orchestrator called toSARIF() without a version; it now passes the real plugin version from package.json. #50 the VS Code known-malicious blocklist was empty with no explanation (unlike the JetBrains file's 'empty by design' note); added a matching blocklist_note. Suite 2004/0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TcQyMTQfyrsAapaCMPxTtQ
57 lines
2.1 KiB
JavaScript
57 lines
2.1 KiB
JavaScript
// sarif-version.test.mjs — Regression for #56 (LOW, v7.8.3).
|
|
//
|
|
// toSARIF defaults version='6.0.0' and the orchestrator called toSARIF(output)
|
|
// with no version argument, so SARIF output hardcoded a stale driver.version.
|
|
// The orchestrator must pass the real plugin version (package.json) through.
|
|
|
|
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { spawn } from 'node:child_process';
|
|
import { resolve, dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { mkdtempSync, writeFileSync, rmSync, readFileSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const ORCHESTRATOR = resolve(__dirname, '../../scanners/scan-orchestrator.mjs');
|
|
const PKG_VERSION = JSON.parse(
|
|
readFileSync(resolve(__dirname, '../../package.json'), 'utf8'),
|
|
).version;
|
|
|
|
function run(args, timeout = 120000) {
|
|
return new Promise((resolvePromise) => {
|
|
const chunks = [];
|
|
const errChunks = [];
|
|
const child = spawn('node', [ORCHESTRATOR, ...args], {
|
|
timeout,
|
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
});
|
|
child.stdout.on('data', (c) => chunks.push(c));
|
|
child.stderr.on('data', (c) => errChunks.push(c));
|
|
child.on('close', (code) => {
|
|
resolvePromise({
|
|
code: code ?? 1,
|
|
stdout: Buffer.concat(chunks).toString(),
|
|
stderr: Buffer.concat(errChunks).toString(),
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
describe('scan-orchestrator: SARIF driver.version (#56)', () => {
|
|
it('driver.version matches package.json version, not the stale 6.0.0 default', async () => {
|
|
const dir = mkdtempSync(join(tmpdir(), 'sarif-version-'));
|
|
try {
|
|
writeFileSync(join(dir, 'README.md'), '# tiny fixture\n');
|
|
const { stdout } = await run([dir, '--format', 'sarif']);
|
|
const sarif = JSON.parse(stdout);
|
|
const driver = sarif.runs[0].tool.driver;
|
|
assert.equal(
|
|
driver.version, PKG_VERSION,
|
|
`SARIF driver.version should be the plugin version ${PKG_VERSION}, got ${driver.version}`,
|
|
);
|
|
} finally {
|
|
rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
});
|
|
});
|