Skip to content

feat(jans-fido2): expose effective attestation-mode status endpoint - #14643

Open
imran-ishaq wants to merge 5 commits into
mainfrom
jans-fido2-attestation-status
Open

feat(jans-fido2): expose effective attestation-mode status endpoint#14643
imran-ishaq wants to merge 5 commits into
mainfrom
jans-fido2-attestation-status

Conversation

@imran-ishaq

@imran-ishaq imran-ishaq commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Prepare


Description

Target issue

MDS health is invisible. TocService.refreshTOCEntries() downloads and refreshes metadata unless disableMetadataService is set, but there is no surfaced last-refresh time, blob validity, loaded entry count, or load error. Failures are caught and written to the log, then discarded — nothing retains them. A stale or failed MDS load is a common cause of "a previously valid authenticator is suddenly rejected", and today the only way to diagnose it is to grep server logs.

closes #14638

Part of #14602, deliverable (a). MDS health (#) and rejection
diagnostics (#) follow in separate PRs.

Implementation Details

GET /jans-fido2/restv1/trust/attestation/config, mirrored in the Config API
fido2 plugin. Read-only — it surfaces configuration the server already holds and changes no attestation behaviour.

Two decisions worth review attention:

unattestedAuthenticatorsAllowed is mode != enforced, not mode == disabled. AttestationCertificateService.isAttestationEnforced() applies the stricter MDS trust rules only for enforced; disabled and
monitor are both lenient. Since monitor is the default, an authenticator that fails attestation validation is still registered — surfacing that is the point of the endpoint. There is a test pinning it.

The mode is reported verbatim with an attestationModeRecognized flag. Fido2Configuration.attestationMode is a raw String; a typo such as Enforce silently leaves the server lenient, so the response reveals it rather than normalising it away.

AttestationCertificateService gains an isAppleRootCaPresent() accessor — the field is already populated at startup, and a missing Apple root CA is currently only a log warning. Note that #14602 groups this signal under MDS health; it is exposed here instead, since it is a property of the attestation trust anchors rather than of the metadata blob.

Date fields are pre-formatted strings: the FIDO2 DataMapperService uses a plain ObjectMapper with no JSR-310 module registered.

Two changes that are not part of the feature:

  1. jansFido2Swagger.yaml had trailing tab characters on two pre-existing lines that made the spec fail to parse in any strict
    YAML loader. Fixedhere because it is the same file as the feature additions; whitespace only.
  2. plugins/fido2-plugin/pom.xml declares jans-config-api-common explicitly (separate commit) — the plugin imports
    ApiAccessConstants and ApiConstants directly.

Test and Document the changes

  • Static code analysis has been run locally and issues have been fixed
  • Relevant unit and integration tests have been added/updated
  • Relevant documentation has been updated if any (i.e. user guides, installation and configuration guides, technical design docs etc)

Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with docs: to indicate documentation changes or if the below checklist is not selected.

  • I confirm that there is no impact on the docs due to the code changes in this PR.

Summary by CodeRabbit

  • New Features
    • Added read-only FIDO2 trust diagnostics endpoints for viewing effective attestation configuration.
    • Exposed attestation mode, authenticator acceptance, enterprise attestation, metadata service, Apple root certificate status, supported algorithms, and diagnostic hints.
    • Added OpenAPI documentation and example configuration for the new diagnostics.
  • Documentation
    • Added troubleshooting guidance and navigation for FIDO2 trust diagnostics.
  • Tests
    • Added coverage for trust status reporting, Apple root certificate detection, endpoint success, and error handling.

Add GET /jans-fido2/restv1/trust/attestation/config, a read-only view of
the attestation policy the server is applying: effective mode, whether
unattested authenticators are still accepted, enterprise attestation,
whether the metadata service is disabled, and whether the Apple WebAuthn
root CA was loaded.

unattestedAuthenticatorsAllowed is derived as mode != enforced, not
mode == disabled: AttestationCertificateService.isAttestationEnforced()
applies the stricter MDS trust rules only for enforced, so the default
monitor mode still accepts an authenticator that fails attestation.

The configured mode is reported verbatim alongside a flag for whether it
is recognised, since an unrecognised value silently leaves the server
lenient.

Mirrored through the Config API fido2 plugin for the Admin UI.

Also strips trailing tab characters on two pre-existing lines of
jansFido2Swagger.yaml that made the spec unparseable by strict YAML
loaders.

Signed-off-by: imran <imranishaq7071@gmail.com>
…do2-plugin

The plugin imports io.jans.configapi.util.ApiAccessConstants and
ApiConstants directly but relied on them arriving transitively through
jans-config-api-server. Declare the dependency it actually uses.

Signed-off-by: imran <imranishaq7071@gmail.com>
Adds a Trust Diagnostics page covering the attestation-mode endpoint, the
three attestation modes, and the fact that only "enforced" rejects a
failing attestation - the default "monitor" mode does not.

Signed-off-by: imran <imranishaq7071@gmail.com>
@imran-ishaq imran-ishaq added this to the 2.4.0 milestone Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@imran-ishaq, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f2b8f858-263e-49a2-8ff8-3bf3ac011026

📥 Commits

Reviewing files that changed from the base of the PR and between 162a92b and 0bbc3c9.

📒 Files selected for processing (2)
  • docs/janssen-server/fido/trust-diagnostics.md
  • jans-fido2/docs/jansFido2Swagger.yaml
📝 Walkthrough

Walkthrough

The PR adds read-only FIDO2 attestation trust status endpoints, a shared response model, trust-state calculation, Apple root CA reporting, OpenAPI definitions, tests, an example configuration, and diagnostics documentation.

Changes

FIDO2 trust status

Layer / File(s) Summary
Trust status model and calculation
jans-fido2/model/..., jans-fido2/server/.../trust/..., jans-fido2/server/.../mds/...
Adds AttestationTrustConfig, derives effective attestation status, reports Apple root CA availability, and tests supported and missing configuration states.
FIDO2 trust endpoint
jans-fido2/server/.../Fido2TrustController.java, jans-fido2/docs/jansFido2Swagger.yaml
Registers and documents GET /trust/attestation/config, including response fields and error responses.
Config API trust mirror
jans-config-api/plugins/fido2-plugin/..., jans-config-api/server/.../fido2-attestation-config.json
Adds the Config API resource, service delegation, endpoint constants, authorization forwarding, OpenAPI operation, dependency, and example response.
Trust diagnostics documentation
docs/janssen-server/fido/trust-diagnostics.md, mkdocs.yml
Documents endpoint access, response fields, attestation modes, certificate and metadata status, troubleshooting, and navigation placement.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • Issue 14602: Covers the broader read-only attestation-mode, metadata-service, Apple root CA, and trust diagnostics objectives implemented here.

Possibly related PRs

Suggested reviewers: yurem, yuriyz, pujavs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: exposing the effective FIDO2 attestation-mode status endpoint.
Description check ✅ Passed The description includes the target issue, implementation details, tests, and documentation updates, but its no-doc-impact confirmation conflicts with the documented changes.
Linked Issues check ✅ Passed The changes satisfy issue #14638 by adding the read-only endpoint, required trust fields, mode semantics, OpenAPI documentation, tests, and Config API mirroring.
Out of Scope Changes check ✅ Passed The changes remain within scope; the YAML cleanup and explicit dependency support the endpoint and its documentation or build requirements.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jans-fido2-attestation-status

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@imran-ishaq
imran-ishaq temporarily deployed to integration-tests July 28, 2026 08:02 — with GitHub Actions Inactive
@imran-ishaq
imran-ishaq temporarily deployed to integration-tests July 28, 2026 08:02 — with GitHub Actions Inactive
@mo-auto

mo-auto commented Jul 28, 2026

Copy link
Copy Markdown
Member

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@mo-auto mo-auto added area-documentation Documentation needs to change as part of issue or PR comp-docs Touching folder /docs comp-jans-config-api Component affected by issue or PR comp-jans-fido2 Component affected by issue or PR kind-feature Issue or PR is a new feature request labels Jul 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@ossdhaval ossdhaval modified the milestones: 2.4.0, 3.0.0 Jul 30, 2026
@imran-ishaq
imran-ishaq marked this pull request as ready for review August 4, 2026 08:14

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/janssen-server/fido/trust-diagnostics.md`:
- Around line 35-45: Convert the top-level JSON example in the trust diagnostics
documentation from fenced code-block syntax to the configured indented
code-block style, preserving the example content and indentation so MD046
passes.
- Around line 59-63: Revise the enforcement statement in the important note to
explicitly scope rejection behavior to registrations with failed attestation
validation. Clarify that only `enforced` rejects failed attestation validation,
while `disabled` and `monitor` remain lenient for those failures; avoid wording
that implies other validation checks cannot reject registrations.

In `@jans-config-api/plugins/docs/fido2-plugin-swagger.yaml`:
- Around line 1286-1303: Replace the generic JsonNode response schema for
get-fido2-trust-attestation-config with a concrete attestation configuration
model or schema matching Fido2TrustResource.getAttestationConfig(), including
the enabledFidoAlgorithms and hints array fields; update the response example to
use the structured object shape instead of an empty string.
- Line 112: Replace the empty-string response examples in the OpenAPI
generator/source asset with schema-compatible object or array examples, or omit
them where appropriate. Apply this consistently at all listed sites in
jans-config-api/plugins/docs/fido2-plugin-swagger.yaml (112-112, 164-164,
216-216, 289-289, 348-348, 414-414, 486-486, 521-521, 591-591, 626-626, 676-676,
726-726, and 786-786), ensuring each example matches its response schema and the
source used to regenerate the asset is corrected.

In
`@jans-config-api/plugins/fido2-plugin/src/main/java/io/jans/configapi/plugin/fido2/rest/Fido2TrustResource.java`:
- Around line 70-75: Update Fido2TrustResource.getAttestationConfig() to bind
the inbound Authorization header and pass its value unchanged to
Fido2TrustService.getAttestationConfig instead of passing null; preserve the
existing response and error-handling flow.

In `@jans-fido2/docs/jansFido2Swagger.yaml`:
- Around line 1408-1416: Remove the enum constraint from the attestationMode
schema property. Update its description to list disabled, monitor, and enforced
as supported values while preserving that configured values are returned
verbatim and unsupported values are indicated by attestationModeRecognized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 04abbe6f-8c78-4b61-a604-4b72778e3353

📥 Commits

Reviewing files that changed from the base of the PR and between dcbfe7b and 26e9e4b.

📒 Files selected for processing (18)
  • docs/janssen-server/fido/trust-diagnostics.md
  • jans-config-api/plugins/docs/fido2-plugin-swagger.yaml
  • jans-config-api/plugins/fido2-plugin/pom.xml
  • jans-config-api/plugins/fido2-plugin/src/main/java/io/jans/configapi/plugin/fido2/rest/ApiApplication.java
  • jans-config-api/plugins/fido2-plugin/src/main/java/io/jans/configapi/plugin/fido2/rest/Fido2TrustResource.java
  • jans-config-api/plugins/fido2-plugin/src/main/java/io/jans/configapi/plugin/fido2/service/Fido2TrustService.java
  • jans-config-api/plugins/fido2-plugin/src/main/java/io/jans/configapi/plugin/fido2/util/Constants.java
  • jans-config-api/server/src/main/resources/example/fido2/trust/fido2-attestation-config.json
  • jans-fido2/docs/jansFido2Swagger.yaml
  • jans-fido2/model/src/main/java/io/jans/fido2/model/trust/AttestationTrustConfig.java
  • jans-fido2/server/src/main/java/io/jans/fido2/service/app/ResteasyInitializer.java
  • jans-fido2/server/src/main/java/io/jans/fido2/service/mds/AttestationCertificateService.java
  • jans-fido2/server/src/main/java/io/jans/fido2/service/trust/TrustStatusService.java
  • jans-fido2/server/src/main/java/io/jans/fido2/ws/rs/controller/Fido2TrustController.java
  • jans-fido2/server/src/test/java/io/jans/fido2/service/mds/AttestationCertificateServiceTest.java
  • jans-fido2/server/src/test/java/io/jans/fido2/service/trust/TrustStatusServiceTest.java
  • jans-fido2/server/src/test/java/io/jans/fido2/ws/rs/controller/Fido2TrustControllerTest.java
  • mkdocs.yml

Comment thread docs/janssen-server/fido/trust-diagnostics.md
Comment thread docs/janssen-server/fido/trust-diagnostics.md Outdated
Comment thread jans-config-api/plugins/docs/fido2-plugin-swagger.yaml Outdated
Comment thread jans-config-api/plugins/docs/fido2-plugin-swagger.yaml Outdated
Comment thread jans-fido2/docs/jansFido2Swagger.yaml Outdated
…onflict

Signed-off-by: imran <imranishaq7071@gmail.com>
…ment note to attestation

Signed-off-by: imran <imranishaq7071@gmail.com>
@imran-ishaq
imran-ishaq temporarily deployed to integration-tests August 4, 2026 08:53 — with GitHub Actions Inactive
@imran-ishaq
imran-ishaq deployed to integration-tests August 4, 2026 08:53 — with GitHub Actions Active
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-documentation Documentation needs to change as part of issue or PR comp-docs Touching folder /docs comp-jans-config-api Component affected by issue or PR comp-jans-fido2 Component affected by issue or PR kind-feature Issue or PR is a new feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(jans-fido2): expose effective attestation-mode status endpoint

3 participants