Skip to content

feat(config): GateConfig filters denied .xffrc lines (config phase C3a) - #102

Merged
helly25 merged 1 commit into
mainfrom
feat/config-gate-filter
Jun 23, 2026
Merged

feat(config): GateConfig filters denied .xffrc lines (config phase C3a)#102
helly25 merged 1 commit into
mainfrom
feat/config-gate-filter

Conversation

@helly25

@helly25 helly25 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

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 + --config=clang --config=asan.

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
helly25 enabled auto-merge (squash) June 23, 2026 21:24
@helly25
helly25 merged commit f25815d into main Jun 23, 2026
5 checks passed
@helly25
helly25 deleted the feat/config-gate-filter branch June 23, 2026 21:33
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant