feat(config): GateConfig filters denied .xffrc lines (config phase C3a) - #102
Merged
Conversation
Third slice of the config policy gate (#58, phase C). xff/config/policy.{h,cc}: GateConfig(inputs, drops) filters the user and project .xffrc lines through LinePermitted (with inputs.system as the policy), returning a copy with denied lines removed and recording each removed line in drops (line + layer + safety class) for the stderr warning and --explain. The system [defaults] are root-authored and not gated; CLI flags are not config. Pure filter, no wiring yet; C3b calls it in cli/main.cc after Discover, warns each drop, resolves only the survivors, lists drops in --explain, and adds the hostile-.xffrc binary test. Unit tests: a project -exec is dropped + recorded (project, kSecurity) while the safe project line and a user -exec survive; a null drops sink is tolerated. Green on default + clang-asan.
helly25
enabled auto-merge (squash)
June 23, 2026 21:24
helly25
added a commit
that referenced
this pull request
Jul 3, 2026
An unrecognized leading option was silently accepted (xff --bogus . exited 0 and did nothing), hiding typos. main now validates each leading global right after parsing (before config injection) and, on the first unknown one, prints a prominent usage error naming the flag and exits 2: xff: unknown option '--bogus-flag' Try 'xff --help' for usage, or 'xff --help=NAME' for one option. cli::IsKnownGlobal is the table-driven whitelist: an exact kGlobals name/alias; a valued name=VALUE / alias=VALUE form when the flag advertises a value (its display contains '='); the -jN / -jall short jobs form; and the compat aliases not in the table (-0, -g+, -g-). Meta flags (--help / --version / --man / --markdown) are consumed before parsing, so they are unaffected. Tests: globals_test asserts every table name/alias + valued/compat forms are known and typos/bad valued-keys are not; exit_test drives the real binary (--bogus-flag -> exit 2 + message; --sort still runs). Full suite green (43), no valid flag regressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third slice of the config policy gate (#58, phase C).
xff/config/policy.{h,cc}:GateConfig(inputs, drops)filters the user and project.xffrclines throughLinePermitted(withinputs.systemas the policy), returning a copy with denied lines removed and recording each removed line indrops(line + layer + safety class) for the stderr warning and--explain. The system[defaults]are root-authored and not gated; CLI flags are not config.Pure filter, no wiring yet. C3b calls it in
cli/main.ccafterDiscover, warns each drop, resolves only the survivors, lists drops in--explain, and adds the hostile-.xffrcbinary test.Unit tests: a project
-execis dropped + recorded (project,kSecurity) while the safe project line and a user-execsurvive; a null drops sink is tolerated. Green on default +--config=clang --config=asan.