Skip to content

feat(chart): accept issuer settings - #341

Merged
uniqueg merged 3 commits into
devfrom
feat/chart-issuer-settings
Oct 30, 2026
Merged

uniqueg merged 3 commits into
devfrom
feat/chart-issuer-settings

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

The Helm chart now accepts trusted token issuers as maps with their own settings (FOCA 0.18's IssuerConfig: issuer, namespace, audience, claim_groups, userinfo_claims), not only as URLs. This follows Cloud Registry's solution (elixir-cloud-aai/cloud-registry#264) and adds a few more checks:

  • Issuers: each entry is a URL, or a map whose issuer is a non-blank string without surrounding whitespace. Maps with other keys fail rendering and name the key (FOCA forbids extra keys). The same applies to a misspelt issuer.
  • Audience: an issuer's audience must be null or a non-empty list of non-blank strings. A global audience is required (the library's requireAudience, now computed by protes.requireAudience) unless every issuer is a map with an audience of its own, as in FOCA. When it isn't required, the chart checks that a set global audience is null or a list of strings, because the library then skips its check.
  • Group claim: an issuer's claim_groups must be null or a string without surrounding whitespace; empty means the issuer contributes no groups. It replaces the global claim for that issuer's tokens, unless it is unset or null. Group mappings need a usable claim of at least one issuer, as FOCA checks, and the error message now names the issuers' claims too.
  • Docs: the chart README, the values.yaml comments, the access control docs (Deployment settings, with an example and the warning that group claim values are not namespaced) and upgrading.md (the namespace: "" remedy now works in the chart, too).

The app still validates namespace and userinfo_claims on startup, as well as duplicate issuers; the chart README says so.

Closes #337

Verification

  • pytest tests/test_chart.py: 139 passed (Helm v3.22.1, as in CI). There are new tests for invalid issuers, issuer settings (round trip through FOCA's SecurityConfig), mixed URLs and maps, audience requirements, requireAudience asserted directly, verify_audience: false with issuer maps, replaced group claims and invalid issuer settings. The tests were written first, and the new ones failed before the change.
  • The full suite with coverage (mongomock) passed before the review fixes: 1104 passed, 1 skipped, coverage 100%. The review fixes touched only the chart template and the chart tests.
  • helm lint deployment --strict with the three CI value sets: passed.
  • pre-commit run --all-files: passed. Locally the actionlint hook was skipped, because its download was cut off; I ran the standalone actionlint 1.7.12 instead, and it passed.
  • mkdocs build --strict: passed.
  • CI on this PR: all checks passed (CI passed, Chart, Test (mongomock, MongoDB 7.0), Lint, Docs, Smoke test, Scan image, CodeQL, Read the Docs); Sourcery: no findings.
  • Reviews: adversarial and quality reviewer subagents, 2 rounds.
    • Fixed in round 1: issuer audiences, group claims and unknown keys are checked; the global audience type is checked when the library skips it; the group-claim error names the issuers' claims; requireAudience is simpler and tested directly; the access control docs mention issuer audiences.
    • Fixed in round 2: a misspelt issuer key is named; the header comment of checkSecurity is updated.

Declined review findings

  • Sentinel object instead of the "null" string in test_issuer_group_claim_replaced: the parametrisation mirrors Cloud Registry's test, and the docstring explains the encoding.
  • Shared helper for "list of strings" checks: there are only two callers, with different rules (blank entries allowed or not), so a helper would hide that difference.
  • Duplicate issuers and shared namespaces in the chart: FOCA refuses both on startup; the chart checks only what it documents.

Open questions

None.

🤖 Generated with Claude Code

uniqueg and others added 3 commits October 30, 2026 14:55
The security check of the chart refused every trusted issuer that is not
a URL. Accept maps of FOCA's IssuerConfig (issuer, namespace, audience,
claim_groups, userinfo_claims) whose issuer is a non-blank string
without surrounding whitespace, as Cloud Registry's chart does:

- an issuer's claim_groups replaces the global one for its tokens
  (unless unset or null), so group mappings need a group claim of at
  least one issuer, as in FOCA;
- a global audience is required only unless each issuer has a list of
  non-blank audiences of its own (requireAudience, computed).

This lets chart users keep the subjects of the issuer trusted so far
bare (namespace: ""), as the upgrade notes recommend.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes: refuse issuer maps with unknown keys, or with an audience
or group claim that FOCA refuses, and a global audience that is no list
of strings (the library checks it only if required). Name the group
claims of issuers in the group-claim error, simplify requireAudience,
test it directly, and mention issuer audiences in the access control
docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check the keys of issuer maps before their issuer, so that a misspelt
`issuer` key is named, and describe the audience checks in the header
of protes.checkSecurity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The chart now supports FOCA-compatible trusted issuer maps alongside URLs, validates issuer-specific and global security settings during Helm rendering, computes audience requirements from issuer configuration, and documents the resulting configuration and upgrade behavior with extensive chart tests.

Sequence diagram for issuer-specific token settings

sequenceDiagram
    participant Token
    participant FOCA
    participant AccessControl
    participant ChartConfig
    Token->>FOCA: Authenticate using issuer settings
    FOCA->>FOCA: Select issuer by iss claim
    FOCA->>FOCA: Apply issuer audience and claim_groups
    FOCA->>AccessControl: Provide authenticated subject and groups
    AccessControl->>ChartConfig: Resolve roles from group_mapping
    ChartConfig-->>AccessControl: Use issuer claim_groups or global claim
Loading

Flow diagram for Helm issuer security validation

flowchart TD
    A[Helm values: security.auth.issuers] --> B{Each issuer entry}
    B -->|URL| C[Validate issuer string]
    B -->|Map| D[Validate issuer and allowed settings]
    D --> E[Validate audience and claim_groups]
    C --> F[Determine requireAudience]
    E --> F
    F --> G{Every issuer map has audience?}
    G -->|No| H[requireAudience: true]
    G -->|Yes| I[requireAudience: false]
    H --> J[Library validates global audience]
    I --> K[Chart validates global audience type]
    J --> L[Render generated security config]
    K --> L
Loading

File-Level Changes

Change Details Files
Extended Helm issuer configuration from URL-only entries to FOCA-compatible issuer maps with issuer-specific settings and validation.
  • Accept mixed URL and map issuer entries.
  • Validate issuer names, reject unknown or misspelled keys, and validate issuer audiences and group claims.
  • Preserve issuer-specific settings in rendered security configuration for FOCA startup validation.
deployment/templates/_helpers.tpl
tests/test_chart.py
Made audience and group-claim requirements depend on issuer-specific overrides and audience verification behavior.
  • Compute library requireAudience from whether every issuer supplies its own audience.
  • Validate global audience types even when the library skips global audience enforcement.
  • Allow issuer claim_groups values to replace the global claim and require at least one usable claim when mappings exist.
deployment/templates/_helpers.tpl
tests/test_chart.py
Updated chart and operational documentation for issuer maps and migration behavior.
  • Document issuer-specific namespace, audience, group-claim, and userinfo settings.
  • Explain non-namespaced group claims and issuer-specific audience requirements.
  • Document the namespace-empty upgrade remedy for Helm deployments.
deployment/README.md
deployment/values.yaml
docs/access-control.md
docs/upgrading.md
Added comprehensive chart coverage for issuer settings, validation, requirement calculation, and rendered configuration compatibility.
  • Test valid issuer map round trips through FOCA SecurityConfig and mixed URL/map configurations.
  • Test invalid issuer structures, settings, audiences, group claims, and unknown keys.
  • Test audience requirement computation, disabled audience verification, and issuer-specific group claims.
tests/test_chart.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35526555 | 📁 Comparing ef5043d against latest (8bc81f2)

  🔍 Preview build  

3 files changed
± access-control/index.html
± deployment/index.html
± upgrading/index.html

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8bc81f2) to head (ef5043d).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #341   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2195      2195           
=========================================
  Hits          2195      2195           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 30, 2026 15:08

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Linked issues

#337 feat(chart): accept issuer settings · 5 of 5 met

# Requirement Status Notes
1 Accept issuer maps with a non-empty, whitespace-trimmed issuer. ✅ Met The chart accepts URL strings and maps, validates the map's issuer, and rejects unknown keys.
2 Let an issuer's claim_groups satisfy the group-claim check. ✅ Met The check accounts for issuer-level claims, including empty claims that disable groups for that issuer.
3 Add chart tests and update the chart README. ✅ Met The change adds chart coverage for issuer maps and updates deployment/README.md.
4 The chart renders with issuer maps and fails on invalid ones. ✅ Met Tests cover valid maps, mixed URL/map entries, and invalid issuer values and settings.
5 Chart tests and helm lint pass. ✅ Met The PR reports 139 chart tests passing and helm lint passing with the CI value sets.

Sourcery assessment

Needs a human reviewer. Issuer-specific audiences determine which tokens are accepted, and issuer-specific group claims determine which groups feed role mappings; a wrong setting could grant access to unintended users. Reverting the chart would stop the configuration change but would not undo access or exposure that already occurred.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit 2b206e0 into dev Oct 30, 2026
19 checks passed
@uniqueg
uniqueg deleted the feat/chart-issuer-settings branch October 30, 2026 15:14
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.

feat(chart): accept issuer settings

1 participant