Skip to content

[spark-compete] fix: remove SPARK_APPROVAL_ENFORCE bypass in secret fetching - #846

Open
yossweh wants to merge 2 commits into
vibeforge1111:mainfrom
yossweh:fix/approval-bypass-v3
Open

[spark-compete] fix: remove SPARK_APPROVAL_ENFORCE bypass in secret fetching#846
yossweh wants to merge 2 commits into
vibeforge1111:mainfrom
yossweh:fix/approval-bypass-v3

Conversation

@yossweh

@yossweh yossweh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

[spark-compete] fix: remove SPARK_APPROVAL_ENFORCE bypass in secret fetching

pr_author: yossweh
repo: vibeforge1111/spark-telegram-bot
branch: fix/approval-enforce-bypass-in-secret-fetch


actual_behavior

readSparkSecretViaPythonBridge() in src/profileEnv.ts:99 explicitly sets SPARK_APPROVAL_ENFORCE: '0' in the environment when calling the Python CLI to fetch secrets. This bypasses the approval enforcement mechanism that the Python CLI's fetch_secret() function checks. Any secret fetched via this code path skips the approval workflow entirely.

env: { ...process.env, SPARK_APPROVAL_ENFORCE: '0' },

expected_behavior

The function should inherit the process environment as-is, allowing the Python CLI to respect the configured approval enforcement policy. If SPARK_APPROVAL_ENFORCE is set in the process env, it should be honored; if not set, the Python CLI's default behavior should apply.

public-safe proof of the exact failure

Before (current main):

const output = execFileSync(command.python, command.args, {
  encoding: 'utf-8',
  env: { ...process.env, SPARK_APPROVAL_ENFORCE: '0' },
  stdio: ['ignore', 'pipe', 'ignore']
}).trim();

After (this PR):

const output = execFileSync(command.python, command.args, {
  encoding: 'utf-8',
  env: process.env,
  stdio: ['ignore', 'pipe', 'ignore']
}).trim();

trust boundary touched by this change

Surface: Secret fetching via Python CLI bridge in readSparkSecretViaPythonBridge()
Boundary change: Removes explicit bypass of approval enforcement; Python CLI now respects configured policy
What this does NOT change:

  • The Python CLI command structure
  • The secret ID parameter
  • The execFileSync call pattern
  • Error handling

targeted tests / smoke checks

# Check Expected result
1 npm run build Passes
2 Secret fetching with SPARK_APPROVAL_ENFORCE=1 Python CLI enforces approval
3 Secret fetching without SPARK_APPROVAL_ENFORCE set Python CLI uses default behavior

risk notes

Which risky surface changed: Secret access path
Why the change is necessary: The bypass defeats the approval enforcement security control for secret access
Secrets: No secrets introduced; changes how existing secrets are accessed
Auth / session state: No changes to session or auth flow
Dependency / runtime behavior: No new deps
File / network access: No changes
Prompt / tool execution: No changes
Rollback: Single-file revert (one line change)
What reviewers / lab still need to verify: Confirm Python CLI's approval enforcement works correctly when SPARK_APPROVAL_ENFORCE is not explicitly set to '0'

duplicate_notes

Checked open PRs in spark-telegram-bot — no existing PR addresses the SPARK_APPROVAL_ENFORCE bypass in profileEnv.ts. PR #843 is about SSRF in previewUrl (different issue). This fix specifically targets the approval enforcement bypass in the secret fetching code path.

review_claim

  • impact_claim: medium
  • evidence_types: redacted_terminal_excerpt, smoke_test, redacted_conversation_excerpt
  • review_state_requested: pr_review

team

hellenagent (hellen, yossweh, exelchapo) — llm_device_holder: yossweh

packet

{
  "schema": "spark-compete-hotfix-v1",
  "event": "spark-compete-first-event",
  "submission_mode": "public_repo_pr",
  "submission_target_url": "https://github.com/vibeforge1111/spark-telegram-bot/pull/846",
  "team": {
    "name": "hellenagent",
    "members": [
      "hellen",
      "yossweh",
      "exelchapo"
    ],
    "github_accounts": [
      "yossweh"
    ],
    "llm_device_holder": "yossweh",
    "device_holder_github": "yossweh"
  },
  "target_repo": {
    "id": "vibeforge1111/spark-telegram-bot",
    "source": "https://github.com/vibeforge1111/spark-telegram-bot",
    "owner_surface": "telegram-bot"
  },
  "issue": {
    "type": "bug",
    "title": "SPARK_APPROVAL_ENFORCE bypass in secret fetching",
    "severity": "medium",
    "affected_workflow": "secret fetching via Python CLI bridge",
    "actual_behavior": "readSparkSecretViaPythonBridge() explicitly sets SPARK_APPROVAL_ENFORCE=0, bypassing the approval enforcement mechanism for all secret access via this code path",
    "expected_behavior": "Secret fetching should respect the configured approval enforcement policy, not bypass it",
    "repro_steps": [
      "Set SPARK_APPROVAL_ENFORCE=1 in environment",
      "Call readSparkSecretViaPythonBridge()",
      "Observe that SPARK_APPROVAL_ENFORCE=0 is passed to the Python CLI subprocess",
      "Secret is fetched without approval enforcement"
    ]
  },
  "evidence": {
    "links": [
      "https://github.com/vibeforge1111/spark-telegram-bot/pull/846"
    ],
    "forbidden": [
      "do not include secret values",
      "do not include env file contents"
    ],
    "safe_links_only": true,
    "before_after_proof": "Before: env: { ...process.env, SPARK_APPROVAL_ENFORCE: '0' }. After: env: process.env."
  },
  "proposed_fix": {
    "approach": "Remove the SPARK_APPROVAL_ENFORCE: '0' override from readSparkSecretViaPythonBridge(), inherit process.env as-is so the Python CLI respects the configured approval enforcement policy.",
    "files_expected": [
      "src/profileEnv.ts"
    ],
    "tests_or_smoke": "npm run build passes. Verify Python CLI receives the correct SPARK_APPROVAL_ENFORCE value from process.env."
  },
  "pr": {
    "url": "https://github.com/vibeforge1111/spark-telegram-bot/pull/846",
    "branch": "fix/approval-enforce-bypass-in-secret-fetch",
    "title_prefix": "[spark-compete]",
    "author_github": "yossweh",
    "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"
    ]
  },
  "review_claim": {
    "impact_claim": "medium",
    "evidence_types": [
      "redacted_terminal_excerpt",
      "smoke_test",
      "redacted_conversation_excerpt"
    ],
    "review_state_requested": "pr_review",
    "duplicate_notes": "No existing PR addresses SPARK_APPROVAL_ENFORCE bypass. PR #843 is about SSRF in previewUrl (different issue).",
    "risk_notes": "One-line change removing approval bypass. No new deps. Single-file revert. Reviewers should verify Python CLI approval enforcement works when env var is not overridden."
  }
}

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