microsoft / microsoft/agent-governance-toolkit
agt-policies: deny ne/not_in still fail-open when an intermediate path segment is missing (post-#3299)
- Dominant language
- Python
- Stars
- 6.3k
- Forks
- 1.1k
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 142
Description
Found during review of #3358 (credit: @chopmob-cloud). Even with #3299's deny-side fix, the chained accessor `object.get(object.get(input.snapshot, "a", null), "b", null)` evaluates to **undefined** (not null) when an intermediate segment is missing, because `object.get(null, ...)` is a builtin type error. Result: a deny `ne`/`not_in` rule on `tool_call.args.region` never fires if the caller omits `args` entirely (verified with live opa probe; #3299's tests only cover missing leaf fields).
Fix: use the array-path accessor form `object.get(input.snapshot, ["tool_call", "args", "region"], null)`, which yields null for missing leaf AND missing parent. #3358 contains this change + accessor tests; inviting a rescoped PR on top of #3299 once it merges.
Contributor guide
Research direction
Start by reading the deny-side fix in #3299 and the accessor change and tests in #3358. Verify the array-path accessor for missing intermediate segments, then ensure a deny ne/not_in rule fires when tool_call.args is omitted and run the accessor tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authorization, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100