Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

test(security): distinguish direct argv from shell splitting

rUvabf6da6bebbf
diff --git a/scripts/smoke-github-safe-injection.mjs b/scripts/smoke-github-safe-injection.mjs
index 0347a5f2ab..8ba03c9405 100644
--- a/scripts/smoke-github-safe-injection.mjs
+++ b/scripts/smoke-github-safe-injection.mjs
@@ -15,7 +15,9 @@
* 2. The temp-file content is verbatim (not shell-expanded).
* 3. A body >256KB triggers a rejection BEFORE gh is invoked (Phase 2 target;
* Phase 1 documents the expected red→green without failing the build).
- * 4. An empty body skips the temp-file path entirely (no-op, helper exits 0).
+ * 4. A benign whitespace-bearing non-body argument reaches `gh` as one exact
+ * argv item, which fails on the historical shell-joined implementation.
+ * 5. An empty body skips the temp-file path entirely (no-op, helper exits 0).
*
* Runs against every shipped copy:
* 1. .claude/helpers/github-safe.js (dogfood)
@@ -74,6 +76,11 @@ const cases = [
expectBodyVerbatim: 'a; b; c',
expectBodyFileFlagInArgv: true,
},
+ {
+ name: 'non-body argv preserves whitespace without shell splitting',
+ args: ['repo', 'view', 'owner/repo with space'],
+ expectArgv: ['repo', 'view', 'owner/repo with space'],
+ },
{
// Phase 2: github-safe.js now enforces the 256KB cap (GITHUB_SAFE_VERSION=1.0.0).
// A body exceeding the limit must be rejected (exit 1) BEFORE gh is invoked.
@@ -126,7 +133,7 @@ function runOne(helperPath, c) {
}
}
- if (c.expectBodyFileFlagInArgv || c.expectBodyVerbatim) {
+ if (c.expectBodyFileFlagInArgv || c.expectBodyVerbatim || c.expectArgv) {
// Read the argv captured by the fake gh script.
let argv = [];
if (existsSync(captureFile)) {
@@ -139,6 +146,10 @@ function runOne(helperPath, c) {
fails.push('fake gh was not invoked (capture file missing) — helper may have crashed before calling gh');
}
+ if (c.expectArgv && JSON.stringify(argv) !== JSON.stringify(c.expectArgv)) {
+ fails.push(`argv mismatch: expected ${JSON.stringify(c.expectArgv)}, got ${JSON.stringify(argv)}`);
+ }
+
if (c.expectBodyFileFlagInArgv) {
const hasBodyFile = argv.includes('--body-file');
const hasBodyInline = argv.includes('--body');