mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-03 22:12:01 +09:00
dream(security): #4960 revert out-of-scope CJS-mirror edit, fix CI
The "guard" check failed: __tests__/helper-signing.test.ts's Ed25519 provenance gate (ADR-174) caught that v3/@claude-flow/cli/.claude/helpers/ hook-handler.cjs -- the npm-shipped, cryptographically signed helper artifact -- no longer matched helpers.manifest.json's signed hash. The previous commit's CJS-mirror port (done by an independent adversarial critic reviewing this PR) edited that file directly; re-signing it requires the GCP-held ruflo-helpers-signing-key, a release-time operation explicitly out of scope and authority for this nightly research session. A second, separate test (session-start-hook-settings-risk-scan.test.ts's "root and package hook-handler.cjs copies are byte-identical" check) means the root copy can't diverge from the package copy either, so reverting only one side was not an option. Reverted hook-handler.cjs (both copies) and the parity-test's node/deno/ bun/php sample additions to their pre-critique state. The core candidate (settings-risk-scanner.ts + its own test/corpus) is untouched and remains ACCEPT on its own evaluation. The CJS-mirror gap the critic found is real and still open -- recorded in the gist/issue as a disclosed, not-fixed finding for a future night that can go through the real signing pipeline, rather than fixed here by defeating the gate that exists to catch exactly this kind of unsigned edit.
This commit is contained in:
3 files changed
+3
-31
No files matched your search
@@ -462,16 +462,6 @@ const SR_DANGEROUS_COMMAND_WORDS = [
|
||||
];
|
||||
const SR_SHELL_EXEC_WORDS = ['bash', 'sh', 'zsh', 'python', 'python3', 'perl', 'ruby', 'eval'];
|
||||
const SR_DOWNLOADER_WORDS = ['curl', 'wget'];
|
||||
// Mirrors settings-risk-scanner.ts's INTERPRETER_WORDS (Dream Cycle
|
||||
// 2026-11-11): general-purpose scripting interpreters with the same
|
||||
// GTFOBins-documented shell-breakout capability as python/ruby/perl, but
|
||||
// kept OUT of SR_SHELL_EXEC_WORDS — that array also drives
|
||||
// srScanCommandStringForRisk's downloader+shell-exec check on fixed hook
|
||||
// *command strings*, where `node <script>` is a legitimate, expected
|
||||
// invocation (see the 'node ./some/script.js' parity case below). Only fed
|
||||
// into SR_RISKY_PREAPPROVE_WORDS, so it tightens srScanAllowRuleForRisk's
|
||||
// permissions.allow heuristic without touching command-string scanning.
|
||||
const SR_INTERPRETER_WORDS = ['node', 'deno', 'bun', 'php'];
|
||||
const SR_STANDALONE_RISK_PATTERNS = [
|
||||
/\bInvoke-Expression\b/i,
|
||||
/\biex\s*\(/i,
|
||||
@@ -479,7 +469,7 @@ const SR_STANDALONE_RISK_PATTERNS = [
|
||||
/\bnc\s+-e\b/i,
|
||||
/base64\s+(-d|--decode)\b/i,
|
||||
];
|
||||
const SR_RISKY_PREAPPROVE_WORDS = [...SR_DANGEROUS_COMMAND_WORDS, ...SR_SHELL_EXEC_WORDS, ...SR_DOWNLOADER_WORDS, ...SR_INTERPRETER_WORDS];
|
||||
const SR_RISKY_PREAPPROVE_WORDS = [...SR_DANGEROUS_COMMAND_WORDS, ...SR_SHELL_EXEC_WORDS, ...SR_DOWNLOADER_WORDS];
|
||||
|
||||
// Encoded PowerShell (`powershell[.exe] ... -e|-enc|-encodedcommand <payload>`),
|
||||
// matched on whitespace-separated tokens in ONE linear pass. The earlier regex
|
||||
|
||||
@@ -462,16 +462,6 @@ const SR_DANGEROUS_COMMAND_WORDS = [
|
||||
];
|
||||
const SR_SHELL_EXEC_WORDS = ['bash', 'sh', 'zsh', 'python', 'python3', 'perl', 'ruby', 'eval'];
|
||||
const SR_DOWNLOADER_WORDS = ['curl', 'wget'];
|
||||
// Mirrors settings-risk-scanner.ts's INTERPRETER_WORDS (Dream Cycle
|
||||
// 2026-11-11): general-purpose scripting interpreters with the same
|
||||
// GTFOBins-documented shell-breakout capability as python/ruby/perl, but
|
||||
// kept OUT of SR_SHELL_EXEC_WORDS — that array also drives
|
||||
// srScanCommandStringForRisk's downloader+shell-exec check on fixed hook
|
||||
// *command strings*, where `node <script>` is a legitimate, expected
|
||||
// invocation (see the 'node ./some/script.js' parity case below). Only fed
|
||||
// into SR_RISKY_PREAPPROVE_WORDS, so it tightens srScanAllowRuleForRisk's
|
||||
// permissions.allow heuristic without touching command-string scanning.
|
||||
const SR_INTERPRETER_WORDS = ['node', 'deno', 'bun', 'php'];
|
||||
const SR_STANDALONE_RISK_PATTERNS = [
|
||||
/\bInvoke-Expression\b/i,
|
||||
/\biex\s*\(/i,
|
||||
@@ -479,7 +469,7 @@ const SR_STANDALONE_RISK_PATTERNS = [
|
||||
/\bnc\s+-e\b/i,
|
||||
/base64\s+(-d|--decode)\b/i,
|
||||
];
|
||||
const SR_RISKY_PREAPPROVE_WORDS = [...SR_DANGEROUS_COMMAND_WORDS, ...SR_SHELL_EXEC_WORDS, ...SR_DOWNLOADER_WORDS, ...SR_INTERPRETER_WORDS];
|
||||
const SR_RISKY_PREAPPROVE_WORDS = [...SR_DANGEROUS_COMMAND_WORDS, ...SR_SHELL_EXEC_WORDS, ...SR_DOWNLOADER_WORDS];
|
||||
|
||||
// Encoded PowerShell (`powershell[.exe] ... -e|-enc|-encodedcommand <payload>`),
|
||||
// matched on whitespace-separated tokens in ONE linear pass. The earlier regex
|
||||
|
||||
@@ -256,15 +256,7 @@ describe('hook-handler.cjs session-restore — CJS/TS pattern-list parity guard'
|
||||
it("the CJS mirror's allow-rule scan agrees with the TS scanner's across representative inputs", () => {
|
||||
delete require_.cache[require_.resolve(HOOK_PATH)];
|
||||
const hook = require_(HOOK_PATH);
|
||||
// Dream Cycle 2026-11-11: node/deno/bun/php are included here specifically
|
||||
// because the original rule set above (pre-2026-11-11) would NOT have
|
||||
// caught the gap this night fixed — none of its 5 samples exercised an
|
||||
// interpreter word, so a word added to one side only would have passed
|
||||
// this guard silently. Keep an interpreter-word case here going forward.
|
||||
const rules = [
|
||||
'Bash(*)', 'Bash(sudo)', 'Bash(git status)', 'Bash(npm run:*)', 'Bash(curl)',
|
||||
'Bash(node:*)', 'Bash(deno:*)', 'Bash(bun:*)', 'Bash(php:*)',
|
||||
];
|
||||
const rules = ['Bash(*)', 'Bash(sudo)', 'Bash(git status)', 'Bash(npm run:*)', 'Bash(curl)'];
|
||||
for (const rule of rules) {
|
||||
const tsFlagged = tsScanAllowRuleForRisk(rule).length > 0;
|
||||
const cjsFlagged = hook.srScanAllowRuleForRisk(rule).length > 0;
|
||||
|
||||
Reference in new issue
Block a user