Repository navigation
refactor(api): let a policy setting hold a list of strings - #3496
Conversation
A policy setting was an integer, a boolean or one of a string's listed values, so a policy could not name things the server cannot list in advance, such as the hosts an authorization server admits client documents from. A setting may now be an `array` of distinct strings. Its template bounds how many it holds and how long each is (`max_items`, `max_length`), neither above what the startup cost estimate assumes of any list or string, so a rule over the list costs no more than it was estimated to. An entry is one token: not empty, no whitespace, no control character, none twice. An empty list is a value: the rule is on and holds for nothing. No template uses the type yet, so no policy changes. ADR 066 records the amendment, and ADR 088's open question on inline lists points at it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the bounded string-list settings change.
No open issues 🎉
What changed in this PR
Extends the Go policy engine with bounded string-list settings, preparing for the client-document host admission policy in #3499. No shipped template uses the new type yet, so existing policy behavior and API responses remain unchanged.
Changes:
- Adds
arraysettings with required size bounds and validation for distinct, nonempty string tokens. - Supports lists in CEL rules and returns defensive copies in settings, violations, and constraints.
- Adds validation, evaluation, and compatibility checks, and documents the contract while leaving shared named lists undecided.
| File | Description |
|---|---|
docs/design/policies/1-template.md |
Documents array bounds, token validation, and empty-list semantics. |
docs/adrs/README.md |
Indexes the bounded-list amendment to ADR 066. |
docs/adrs/088-abuse-protection-per-operation.md |
Clarifies inline-list support while leaving shared lists open. |
docs/adrs/066-operation-policies.md |
Records the bounded string-list contract. |
apps/api/internal/policy/template.go |
Defines array settings, validates bounds, and copies bound pointers. |
apps/api/internal/policy/instance.go |
Validates and normalizes array values to []string. |
apps/api/internal/policy/engine.go |
Enforces cost-estimate bounds and copies exposed lists. |
apps/api/internal/policy/engine_test.go |
Tests list evaluation, validation, copying, and empty-list behavior. |
apps/api/internal/policy/compat_test.go |
Detects reductions in recorded array bounds. |
apps/api/internal/policy/cel.go |
Maps array settings to CEL string lists. |
Review effort: Balanced
Context
Summary
A policy setting was an integer, a boolean or one of a string's listed values, so a policy could not name things the server cannot list in advance, such as hosts.
array: a list of distinct strings.max_itemsandmax_length, how many strings it may hold and how many bytes each may have. Neither may exceed what the startup cost estimate assumes of any list or string (Limits.MaxListSize), so a rule over the list costs no more than it was estimated to. A template without both bounds does not parse.No template uses the type yet, so no policy and no API response changes.
Validation
Run in
apps/apiunless noted:go vet ./...go test ./... -count=1node scripts/go-lint.mjs,node scripts/check-adrs-index.mjsandnode scripts/check-changesets-status.mjs(repo root)Not run: the integration lanes, which this does not reach.
Release notes / changeset
Notes
docs/design/policies/1-template.mddescribes the type..zitadel/protection.jsonthat several operations share. This PR decides nothing about them; its note on the open question says so.https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
Generated by Claude Code