Skip to content

refactor(api): let a policy setting hold a list of strings - #3496

Merged
fforootd merged 6 commits into
claude/api-person-token-scope-checksfrom
claude/policy-list-settings
Dec 1, 2026
Merged

fforootd merged 6 commits into
claude/api-person-token-scope-checksfrom
claude/policy-list-settings

Conversation

@fforootd

@fforootd fforootd commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

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.

  • A setting may be an array: a list of distinct strings.
  • The template bounds it. An array setting declares max_items and max_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.
  • An entry is one token. No empty string, no whitespace, no control character, none twice.
  • An empty list is a value. The rule is on and holds for nothing. Leaving the setting out switches the rule off, as for every setting.
  • A violation and a constraint carry the list, as they carry any setting's value. A caller is handed a copy.
  • The compatibility test refuses a release that lowers an array's bounds, as it refuses one that narrows an integer's.

No template uses the type yet, so no policy and no API response changes.

Validation

Run in apps/api unless noted:

  • go vet ./...
  • go test ./... -count=1
  • node scripts/go-lint.mjs, node scripts/check-adrs-index.mjs and node scripts/check-changesets-status.mjs (repo root)

Not run: the integration lanes, which this does not reach.

Release notes / changeset

  • No changeset required — no shipped behavior changed.

Notes

  • ADR 066 is amended ("a setting may hold a list of strings"), and docs/design/policies/1-template.md describes the type.
  • ADR 088 sketches named lists in .zitadel/protection.json that several operations share. This PR decides nothing about them; its note on the open question says so.
  • What reads a setting's value by type (the policy API's per-operation config schemas, the CLI, the Console) learns of lists with the first operation that has one.

https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U


Generated by Claude Code

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
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Dec 1, 2026 6:02pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: 72c645f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-12-01T06:42:29.972005Z 1d79423 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 array settings 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

@fforootd
fforootd changed the base branch from main to claude/api-person-token-scope-checks December 1, 2026 06:42
@fforootd
fforootd added this pull request to stack #3500 December 1, 2026 06:42
@fforootd
fforootd added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit b0ed97a Dec 1, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Dec 1, 2026
@fforootd
fforootd deleted the claude/policy-list-settings branch December 1, 2026 20:44

This branch was successfully deployed

1 active deployment
Preview — 72c645f1 Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants