StackGuardian / StackGuardian/tirith

fix(core): variable substitution does not recurse — nested `{{var.x}}` silently produces wrong verdicts

Open
#296 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
165
Forks
42
Avg merge
1d 3h
Merged PRs (30d)
11

Description

core/policy_parameterization.py:22-25 walks one level and continues on any non-str;
not_found_vars stays empty so no error is raised. A {{var.x}} inside a nested condition.value
reaches the evaluator as a literal string — in the NotEquals direction the policy returns true
while the resource holds the forbidden value, with errors: []. Harmless today only because no
shipped feature nests values; the planned select/transform/AnyElement features all make it
reachable.

Fix. Recurse into dicts/lists, or reject a {{var. literal in a nested value in the engine
(not in tui/validate.py, which the CLI path never calls).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at core/policy_parameterization.py:22-25 and trace how nested condition.value data reaches the evaluator; do not use tui/validate.py because the CLI path bypasses it. Implement the stated nested-value handling or rejection behavior, then verify that a nested {{var.x}} no longer produces a silent wrong verdict or an empty errors list.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.