Skip to content

[spark-compete] fix(security): restrict npm in module install commands to install/ci only - #779

Open
mrxlolcat wants to merge 4 commits into
vibeforge1111:masterfrom
mrxlolcat:fix/npm-subcommand-allowlist
Open

mrxlolcat wants to merge 4 commits into
vibeforge1111:masterfrom
mrxlolcat:fix/npm-subcommand-allowlist

Conversation

@mrxlolcat

@mrxlolcat mrxlolcat commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Spark Compete Packet

{
  "schema": "spark-compete-hotfix-v1",
  "event": "spark-compete-first-event",
  "submission_mode": "public_repo_pr",
  "team": {
    "name": "lolcat",
    "members": [
      "mrxlolcat",
      "ouwibo",
      "rahmanhsim"
    ],
    "llm_device_holder": "mrxlolcat",
    "device_holder_github": "https://github.com/mrxlolcat",
    "github_accounts": [
      "mrxlolcat",
      "ouwibo",
      "rahmanhsim"
    ]
  },
  "target_repo": {
    "id": "vibeforge1111/spark-cli",
    "source": "https://github.com/vibeforge1111/spark-cli",
    "owner_surface": "spark-cli"
  },
  "evidence": {
    "safe_links_only": true,
    "forbidden": [
      "pdf",
      "zip",
      "exe",
      "unknown downloads",
      "shortened links",
      "archives",
      "binaries",
      "tokens",
      "browser cookies",
      "wallet material",
      "raw logs",
      "raw conversations",
      "raw memory",
      "raw patches",
      "private repo maps",
      "private scoring details"
    ],
    "before_after_proof": "Before: npm_runtime_command_argv() passes npm run arbitrary through. After: raises SystemExit('npm subcommand not allowed: run. Allowed: install, ci') for any subcommand not in the allowlist.",
    "links": [
      "https://github.com/vibeforge1111/spark-cli/pull/779"
    ]
  },
  "submission_target_url": "https://github.com/vibeforge1111/spark-cli/pull/779",
  "issue": {
    "type": "security_concern",
    "severity": "high",
    "title": "npm_runtime_command_argv() passes arbitrary npm subcommands through module install commands",
    "actual_behavior": "npm_runtime_command_argv() accepts any npm subcommand, allowing npm run, npm publish, npm exec, etc. to pass through in module install commands. Only install and ci should be permitted.",
    "expected_behavior": "npm_runtime_command_argv() must enforce an allowlist (install, ci) and raise SystemExit with a clear message for any disallowed subcommand.",
    "repro_steps": [
      "Craft a module install command using npm run <script> as the runtime command.",
      "Observe the command accepted without error.",
      "Expected: SystemExit raised with a message naming the disallowed subcommand."
    ],
    "affected_workflow": "spark module install / npm runtime command validation"
  },
  "proposed_fix": {
    "approach": "Add an allowlist (install, ci) in runtime_policy.py and raise SystemExit with a clear diagnostic for any npm subcommand outside that list.",
    "files_expected": [
      "src/spark_cli/runtime_policy.py"
    ],
    "tests_or_smoke": "python3 -c \"from spark_cli.runtime_policy import npm_runtime_command_argv; npm_runtime_command_argv(['npm','run','evil'])\" \u2014 must raise SystemExit."
  },
  "pr": {
    "branch": "fix/npm-subcommand-allowlist",
    "title_prefix": "[spark-compete]",
    "author_github": "mrxlolcat",
    "body_must_include": [
      "packet",
      "team",
      "pr_author",
      "repo",
      "actual_behavior",
      "expected_behavior",
      "repro_steps",
      "before_after_proof",
      "tests_or_smoke",
      "duplicate_notes",
      "risk_notes",
      "review_claim"
    ],
    "url": "https://github.com/vibeforge1111/spark-cli/pull/779"
  },
  "review_claim": {
    "impact_claim": "high",
    "evidence_types": [
      "redacted_terminal_excerpt",
      "passing_test"
    ],
    "duplicate_notes": "Checked all open PRs on vibeforge1111/spark-cli. No existing PR adds an allowlist to npm_runtime_command_argv.",
    "risk_notes": "Only src/spark_cli/runtime_policy.py modified. No CI, dependency, installer, or auth changes. Allowlist is npm install/ci only \u2014 tightens scope, no existing valid install flow is broken.",
    "review_state_requested": "pr_review"
  }
}

@mrxlolcat
mrxlolcat requested a review from vibeforge1111 as a code owner June 3, 2026 05:52
@mrxlolcat
mrxlolcat force-pushed the fix/npm-subcommand-allowlist branch from 5a95e59 to 5280f85 Compare June 3, 2026 05:57

@rahmanhsim rahmanhsim left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Allowlist is the right call for module install commands — narrows the npm attack surface to just install/ci.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants