Skip to content
This repository was archived by the owner on May 4, 2026. It is now read-only.

TCK-00549: Bounded executor rewrite: replace bash bounded runner with Rust streaming executor (policy-driven env + caps)#707

Merged
Anveio merged 1 commit into
mainfrom
ticket/RFC-0019/TCK-00549
Feb 16, 2026
Merged

TCK-00549: Bounded executor rewrite: replace bash bounded runner with Rust streaming executor (policy-driven env + caps)#707
Anveio merged 1 commit into
mainfrom
ticket/RFC-0019/TCK-00549

Conversation

@Anveio

@Anveio Anveio commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator
ticket_meta:
  schema_version: 2026-01-29
  template_version: 2026-01-29
  ticket:
    id: TCK-00549
    title: 'Bounded executor rewrite: replace bash bounded runner with Rust streaming executor (policy-driven env + caps)'
    status: OPEN
  binds:
    prd_id: PRD-PLACEHOLDER
    rfc_id: RFC-0019
    requirements: []
    evidence_artifacts: []
  custody:
    agent_roles:
    - AGENT_IMPLEMENTER
    responsibility_domains:
    - DOMAIN_RUNTIME
    - DOMAIN_SECURITY
  dependencies:
    tickets:
    - ticket_id: TCK-00520
      reason: Streaming logs/caps must exist.
    - ticket_id: TCK-00521
      reason: Policy-driven env allowlist/denylist required.
  scope:
    in_scope:
    - Implement Rust bounded executor that creates transient systemd units and streams logs with caps.
    - Replace `scripts/ci/run_bounded_tests.sh` usage in FAC paths (keep script as fallback only during transition).
    - Use FacPolicyV1 env_clear/allowlist/denylist to pass env; no ad-hoc allowlists.
    - Ensure timeouts/memory/pids are enforced by unit properties, not by shell timers.
    out_of_scope:
    - Replacing other CI scripts unrelated to execution.
  plan:
    steps:
    - Implement executor library used by gates/warm/pipeline.
    - Add feature flag for transition period.
    - Deprecate shell runner once stable.
  definition_of_done:
    evidence_ids: []
    criteria:
    - Bounded tests run with streaming logs and hard caps without relying on a brittle shell allowlist.
    - Failure modes produce receipts with actionable diagnostics.
  amendments:
  - amendment_id: AMD-2026-02-16-FAC-THROUGHPUT-PIVOT
    summary: Clarify that bounded executor requirements are containment-focused and do not prescribe low default CPU throughput.
    supersedes:
    - Implicit coupling of throughput defaults to conservative bounded caps.
    replacement:
    - Default throughput profile may use host-max queue-managed parallelism.
    - Bounded execution remains required for security containment and fail-closed behavior.
fac_push_metadata:
  commit_history:
  - short_sha: 2211d7ea
    message: TCK-00549 replace ad-hoc env allowlists with policy-driven setenv in bounded executor

FAC Gate Status

# apm2-gate-status:v2
sha: 2211d7ea6253b7ca88923ec726916be8144544b2
short_sha: 2211d7ea
timestamp: '2026-02-16T21:37:55Z'
all_passed: true
gates:
  - name: 'merge_conflict_main'
    status: PASS
    duration_secs: 0
  - name: 'rustfmt'
    status: PASS
    duration_secs: 3
  - name: 'clippy'
    status: PASS
    duration_secs: 0
  - name: 'doc'
    status: PASS
    duration_secs: 0
  - name: 'test_safety_guard'
    status: PASS
    duration_secs: 0
  - name: 'test'
    status: PASS
    duration_secs: 39
  - name: 'workspace_integrity'
    status: PASS
    duration_secs: 6
  - name: 'review_artifact_lint'
    status: PASS
    duration_secs: 0

…bounded executor

Remove SYSTEMD_SETENV_ALLOWLIST_EXACT and SYSTEMD_SETENV_ALLOWLIST_PREFIXES
constants and the collect_inherited_setenv_pairs / is_allowlisted_setenv_key /
build_systemd_setenv_pairs helper functions from bounded_test_runner.rs.

Replace with build_policy_setenv_pairs() which accepts pre-computed FacPolicyV1
environment from build_job_environment() and applies:
- MAX_SETENV_PAIRS (256) bound for command-line growth control
- Defense-in-depth RUSTC_WRAPPER/SCCACHE_* stripping (INV-ENV-008)
- Empty-value filtering
- BTreeMap deterministic ordering (INV-EXEC-005)

The build_bounded_test_command 4th parameter semantically changes from ad-hoc
filtered extra_setenv to policy-driven env, preserving the &[(String, String)]
type for caller compatibility. Both callers (gates.rs and evidence.rs) already
pass policy-computed environments, so no call-site changes are needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Anveio Anveio enabled auto-merge February 16, 2026 21:37
@Anveio

Anveio commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator Author
# apm2-review-verdict:v1
schema: apm2.review.verdict.v1
pr: 707
sha: 2211d7ea6253b7ca88923ec726916be8144544b2
updated_at: 2026-02-16T21:40:10Z
dimensions:
  code-quality:
    decision: approve
    reason: 'PASS: no blocker or major findings'
    set_by: ubuntu
    set_at: 2026-02-16T21:39:12Z
  security:
    decision: approve
    reason: 'PASS: Implements policy-driven environment filtering (TCK-00549) with defense-in-depth sccache stripping and resource limits. One MINOR finding regarding secret leakage via systemd-run args.'
    set_by: ubuntu
    set_at: 2026-02-16T21:40:10Z
findings:
- finding_id: f-707-security-1771278004084037-0
  type: security
  severity: MINOR
  summary: Missing defense-in-depth against secret leakage via systemd-run args
  risk: systemd-run exposes --setenv arguments in the process list. Removing the hardcoded allowlist increases the risk that a permissive FacPolicyV1 could accidentally forward secrets (e.g. GITHUB_TOKEN) to the transient unit, leaking them to local users via /proc.
  impact: Secrets could be scraped from the process list during test execution.
  location: crates/apm2-cli/src/commands/fac_review/bounded_test_runner.rs
  body: Implement defense-in-depth filtering in build_policy_setenv_pairs to unconditionally strip keys matching standard secret patterns (*_TOKEN, *_KEY, *_SECRET, *_PASSWORD, *_CREDENTIAL), similar to the existing RUSTC_WRAPPER strip. Alternatively, migrate to using the EnvironmentFile property with systemd-run to avoid CLI argument leakage entirely.
  evidence_digest: 896d7f1a0fc1965e512fc8390bac93e4ce90497cb32a9040ebfc10ecadede53d
  evidence_pointer: none
  timestamp: 2026-02-16T21:40:04Z

@Anveio Anveio merged commit 28c9ed7 into main Feb 16, 2026
3 checks passed
@Anveio Anveio deleted the ticket/RFC-0019/TCK-00549 branch February 16, 2026 21:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant