Skip to content

security(slm): PlaybookExecutor passes secret extra_vars as CLI args — visible in /proc cmdline to local users #11735

Closed

Description

@mrveiss

Problem

PlaybookExecutor._build_ansible_command (autobot-slm-backend/services/playbook_executor.py:249-251) passes every extra_var as a CLI argument:

if extra_vars:
    for key, value in extra_vars.items():
        cmd.extend(["-e", f"{key}={value}"])

Since execute_playbook auto-merges fetch_deploy_secrets() into extra_vars (#3519 — tts_hf_token, autobot_internal_api_key), secret values are visible in the process argv (ps, /proc/<pid>/cmdline) to ANY local user for the entire playbook run (deploys run for minutes). Log lines are safe (only cmd[:5] is logged) — this is strictly the argv exposure.

Fix direction

Write extra_vars to a 0600 temp JSON file and pass -e @<file> (ansible-native), deleting it in a finally. Alternatively pass secrets via environment + lookup('env', ...), but the @file form needs no playbook changes.

ACs

  • Secret extra_vars never appear in the ansible-playbook argv
  • Temp vars file is 0600 and removed after the run (including on failure)
  • Existing playbooks work unchanged (-e @file supplies identical vars)
  • Unit test: command builder produces -e @<path> and the file contains the vars

Activity

  1. github-actions commented on Jul 15, 2026

    @github-actions
    Contributor

    PR #11744 (merged to Dev_new_gui) references this issue with a close keyword.

    fix(slm/security): pass ansible extra_vars via 0600 temp file, not argv (#11735)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Jul 15, 2026

    @mrveiss
    OwnerAuthor

    Closed — merged to Dev_new_gui via PR #11744, squash commit a5764de49.

    AC evidence (verbatim):

    • "Secret extra_vars never appear in the ansible-playbook argv" — ✅ _build_ansible_command now emits -e @<file>; regression test asserts NO key=value anywhere in argv.
    • "Temp vars file is 0600 and removed after the run (including on failure)" — ✅ write_temp_extra_vars uses mkstemp (0600, uid-scoped dir, verified by test); unlinked in the same finally as the per-run temp inventory.
    • "Existing playbooks work unchanged (-e @file supplies identical vars)" — ✅ ansible-native @file form; no playbook changes; only internal caller updated (grep: no external _build_ansible_command call sites).
    • "Unit test: command builder produces -e @ and the file contains the vars" — ✅ tests/services/test_extra_vars_file_11735.py — 5 tests (perms, round-trip, uniqueness, @file argv, no-vars case).

    Verification: 14 passed (new suite + adjacent test_apply_secrets.py); black/bandit/py_compile clean; CI fully green on merge tip (smoke, code-quality, startup-import-smoke, Unit & Integration, Test Summary).

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions