Skip to content

feat(jans-fido2): expose FIDO Metadata Service (MDS) health endpoint - #14644

Draft
imran-ishaq wants to merge 5 commits into
mainfrom
jans-fido2-mds-health
Draft

feat(jans-fido2): expose FIDO Metadata Service (MDS) health endpoint#14644
imran-ishaq wants to merge 5 commits into
mainfrom
jans-fido2-mds-health

Conversation

@imran-ishaq

Copy link
Copy Markdown
Contributor

Prepare


Description

Target issue

closes ##14639

Part of #14602, deliverable (b). Stacked on #14643 , which adds the attestation-mode endpoint and the trust endpoint scaffolding — please merge that first. Rejection diagnostics (#) follow separately.

Implementation Details

GET /jans-fido2/restv1/trust/mds/health, mirrored in the Config API fido2
plugin.

This is the only part of #14602 that needs new state. TocService gains lastSuccessfulRefresh and lastRefreshError, recorded at the four failure sites that previously only logged: unset mdsCertsFolder, TOC parse failure, malformed metadata-server URL, and download/store failure. Existing throw behaviour is untouched — the recording is purely additive. Both fields are volatile, since refreshes run on the CDI startup observer while readers arrive on request threads.

parseTOCs() swallows its own failures and returns an empty map, so "success" cannot be keyed off an exception. refreshTOCEntries() clears the error first and treats the refresh as successful only if nothing recorded one.

Disabled is not broken. With disableMetadataService true, both fields stay null and the endpoint reports DISABLED with HTTP 200, so a deployment intentionally running without MDS does not trigger alerts. DOWN returns 503 so the endpoint can be wired to a monitor directly. Tests pin both.

blobExpired uses the same rule fetchMetadata() uses to decide a re-download is due: absent, today, or past. getLoadedTocNextUpdate() reads the in-memory value rather than the existing getNextUpdateDate(), which hits the document store and throws DocumentException on failure — not suitable on a health request path.

MetadataServer.rootCert is reported as a rootCertConfigured boolean; the certificate never leaves the server, and there is a test asserting it does not appear in the response.


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)

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>
Add GET /jans-fido2/restv1/trust/mds/health, reporting blob validity,
loaded TOC entry count, the outcome of the last refresh, and the
configured metadata servers. A stale or failed MDS load is a common
cause of a previously valid authenticator being rejected, and was
previously visible only in the server log.

TocService now retains the last successful refresh timestamp and the
last refresh error, which were caught and logged then discarded, and
exposes the loaded entry count and the in-memory blob nextUpdate. The
existing getNextUpdateDate() reads the document store and throws on
failure, so it is not used on the request path.

DOWN returns 503 so the endpoint can be wired to a monitor; UP and
DISABLED return 200, since a deliberately switched-off metadata service
is a configuration choice rather than an outage.

MetadataServer.rootCert is reported as a presence boolean only; the
certificate is never returned.

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

Signed-off-by: imran <imranishaq7071@gmail.com>
Extends the Trust Diagnostics page with the MDS health endpoint, the
UP/DISABLED/DOWN status semantics, and the stale-metadata troubleshooting
path.

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

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8d63e6a5-b84f-4744-a493-31018ce26314

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jans-fido2-mds-health

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.

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

@imran-ishaq
imran-ishaq temporarily deployed to integration-tests July 28, 2026 08:27 — with GitHub Actions Inactive
@imran-ishaq
imran-ishaq temporarily deployed to integration-tests July 28, 2026 08:27 — with GitHub Actions Inactive
@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

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@ossdhaval ossdhaval modified the milestones: 2.4.0, 3.0.0 Jul 30, 2026
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.

3 participants