[BUG] Action Schema: Potential for Environment Variable Exfiltration #9220

Open
HAL9000 wants to merge 2 commits from fix/action-schema-env-var-exfiltration into master

2 Commits

Author SHA1 Message Date
HAL9000 945386747e fix(action): address review feedback for env var exfiltration PR
CI / lint (pull_request) Successful in 31s
CI / push-validation (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 36s
CI / quality (pull_request) Successful in 47s
CI / typecheck (pull_request) Successful in 55s
CI / security (pull_request) Successful in 1m31s
CI / unit_tests (pull_request) Failing after 5m40s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 9m7s
CI / status-check (pull_request) Failing after 15s
- Update CHANGELOG.md with entry under [Unreleased] for the env-var
  exfiltration fix (#9089).
- Update CONTRIBUTORS.md with attribution for the security fix.
- Rename `env_vars_to_cleanup` to `env_vars_to_clean` in the BDD steps
  so the existing `after_scenario` cleanup hook in
  `features/environment.py` actually fires (the prior unregistered
  hook in the steps file never ran).
- Remove the unregistered `after_scenario`/`cleanup_env_vars`
  functions from the steps file; reuse `features/environment.py`s
  hook instead.
- Disambiguate step phrasing ("action config" instead of "action") to
  avoid AmbiguousStep collisions with action_schema_steps.py,
  action_persistence_steps.py, and action_model_branch_coverage_steps.py
  (these were the root cause of the unit_tests gate erroring on 31
  features).
- Reuse `Then the action config strategy_actor should be "{expected}"`
  from action_schema_steps.py rather than redefining it.
- Add `@action @security` tags to the feature file for CI filtering.
- Tighten `_env_replacer` to require at least one character after the
  `CLEVERAGENTS_` prefix so a bare `${CLEVERAGENTS_}` is not
  interpolated (resolves the test/implementation mismatch the
  reviewer flagged on the "Bare prefix not interpolated" scenario).
- JSON-quote string values when injecting test inputs into the YAML
  template so descriptions containing ": " or "${VAR}" are parsed as
  YAML scalars rather than nested mappings.

ISSUES CLOSED: #9089
2026-06-02 18:08:09 -04:00
HAL9000 0c4a3d9396 fix(action): restrict env var interpolation in action YAML to allowlisted prefixes
CI / lint (pull_request) Failing after 44s
CI / typecheck (pull_request) Successful in 1m4s
CI / quality (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Failing after 1m15s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / build (pull_request) Successful in 31s
CI / helm (pull_request) Successful in 25s
CI / push-validation (pull_request) Successful in 22s
CI / integration_tests (pull_request) Successful in 9m55s
CI / status-check (pull_request) Failing after 3s
Implemented a security-conscious update to environment variable interpolation within action YAML. Added a dedicated allowlist mechanism by introducing the _ALLOWED_ENV_VAR_PREFIX constant set to "CLEVERAGENTS_". Updated the _env_replacer function to validate variable names against the allowlist before performing interpolation. Documented the security restriction directly in the _interpolate_env_vars docstring to clearly communicate the behavior. Expanded test coverage with comprehensive Behave tests for both allowed and disallowed env var interpolation, and added corresponding step definitions for testing env var security.

ISSUES CLOSED: #9089
2026-06-02 17:39:56 -04:00