Skip to content

feat(config): safe-by-default policy engine (config phase C2) - #101

Merged
helly25 merged 1 commit into
mainfrom
feat/config-policy-engine
Jun 23, 2026
Merged

feat(config): safe-by-default policy engine (config phase C2)#101
helly25 merged 1 commit into
mainfrom
feat/config-policy-engine

Conversation

@helly25

@helly25 helly25 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Second slice of the config policy gate (#58, phase C), per docs/design-config.md.

xff/config/policy.{h,cc}:

  • LineSafety(line): the most restrictive registry safety class among the flags of a line (kNone < kSafety < kSecurity); an attached binding like -capture=tag is classified by its base name.
  • LinePermitted(line, layer, policy): the safe-by-default decision. The built-in table denies the project layer any kSecurity (exec family) or kSafety (-delete) line; user and system may do anything. The system [policy] rules then override per layer, deny beats allow, addressing flags by name or by @safe/@sensitive/@destructive class token.

Pure decision logic, no wiring yet. C3 gates the resolved lines with drop-and-warn + --explain drops + a hostile-.xffrc binary test.

Unit tests: worst-flag classification, built-in project deny, allow-loosen (by name + class), deny-tighten, deny-beats-allow, per-layer scoping. Green on default + --config=clang --config=asan.

Second slice of the config policy gate (#58, phase C), per docs/design-config.md. xff/config/policy.{h,cc}:
- LineSafety(line): the most restrictive registry safety class among a line's flags (kNone < kSafety < kSecurity); an attached binding like -capture=tag is classified by its base name.
- LinePermitted(line, layer, policy): the safe-by-default decision. The built-in table denies the project layer any kSecurity (exec family) or kSafety (-delete) line; user and system may do anything. The system [policy] rules then override per layer, deny beats allow, addressing flags by name or by @safe/@sensitive/@destructive class token.

Pure decision logic, no wiring yet; C3 gates the resolved lines in the config path with drop-and-warn + --explain drops + a hostile-.xffrc binary test. Unit tests cover worst-flag classification, built-in project deny, allow-loosen (by name + class), deny-tighten, deny-beats-allow, and per-layer scoping. Green on default + clang-asan.
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