feat(cli): per-policy scoping for --policy-input-from-file

Merged
JA
4mo ago
+619-66

Summary

Runtime policy inputs supplied via --policy-input-from-file previously lived in a single global namespace keyed only by input name, so an input was applied to every policy attachment that declared it and could not be targeted at a specific policy. This prevented feeding one curated list into different inputs on different policies (e.g. ignored_paths on a customer-signed gate versus third_party_paths on a vendor-keys gate).

This adds an optional policy-scope prefix to the flag value:

[<policy>:]<input>=<file>[:<column>]
  • The unscoped form keeps the previous global behavior (applies to every policy that declares the input).
  • The scoped form applies the input only to the attachment whose policy name or ref matches the scope, normalizing scheme, org and @sha256: digest and honoring a pinned version.
  • Global and scoped inputs for the same policy merge additively.
  • A scope that matches no policy on the evaluated material is logged as a warning.
  • runtime_input_overrides continues to record, per policy, which inputs applied.

Relates to PFM-6530.

AI assistance

This contribution was produced with the assistance of Claude Code, as disclosed via the Assisted-by: trailer on the commit.