fix(saml): require signed SAML responses by default - #37865
Conversation
- dotsaml-config.yml: Validation Type defaults to Response & Assertion; the None option is removed. - DotIdentityProviderConfigurationImpl: a missing or unsupported signatureValidationType resolves to responseandassertion, and stored verify.signature.credentials/profile overrides are ignored; a warning is logged per site when either applies. - dotAuth: SamlProtocolHandler rejects an unsupported signatureValidationType; the SAML screen keeps at least one signature toggle on, never sends none, and shows a stored none as both signatures required. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @mbiuki's task in 1m 46s —— View job Code review: SAML validation defaultsRe-checked the five findings from the prior Resolved
Smaller point still open (non-blocking)
Notes verified while reviewing
The two release-coordination items from the PR body and swicken's comment (publishing plugin dotCMS/com.dotcms.dotsaml#25 to |
swicken
left a comment
There was a problem hiding this comment.
Thanks, this looks right overall. It's also useful on its own: with the SAML bundle core ships today (26.08.21), mapping a stored none to responseandassertion already means unsigned responses are rejected for those sites. So this PR closes the none path even before dotCMS/com.dotcms.dotsaml#25 is released, and the two don't have to ship in a particular order. The sites it breaks are the ones that only worked because their IdP signs nothing, and those break under the new bundle anyway. The dotAuth side hangs together too: the server rejects any other type with a 400, the last signature toggle can't be switched off, and a legacy value is shown the way the backend enforces it.
Two things need fixing first.
Needs changes
1. CI: the strict TypeScript gate fails. The Frontend Unit Tests job fails in strict-gate with TS2322: Type 'string' is not assignable to type 'DotAuthSignatureValidation | undefined', and everything after it was cancelled. It comes from the new spec in dot-auth-config.mappers.spec.ts: for (const signatureValidationType of ['none', '', 'signature']) infers string, which is then assigned to values.signatureValidationType. Since the test feeds out-of-range values on purpose, a cast on the array should fix it, e.g. as unknown as DotAuthSignatureValidation[]. I haven't run the gate locally, so please confirm with a CI re-run.
2. The warning in the constructor will flood the logs. warnAboutOverriddenSettings() runs in the DotIdentityProviderConfigurationImpl constructor. DotIdentityProviderConfigurationFactoryImpl builds a new instance on every lookup, and SamlWebInterceptor.intercept looks one up for each request it handles. So a busy site with a legacy none, or with a stored verify.signature.* parameter, logs a WARN on every intercepted request until someone re-saves its configuration. Please log once per site, for example by keeping a set of site identifiers already warned, or by moving the check to save time and startup.
Smaller points
3. The verify.signature.* filter doesn't cover the defaults file. IGNORED_PROPERTIES hides these keys when they are stored as App extra parameters. But DotAbstractSamlConfigurationServiceImpl also loads saml/dotcms-saml-default.properties from the assets folder, and that file accepts these keys too. So with the current bundle, a verify.signature.credentials=false there still turns credential checks off. The bundle PR ignores these keys altogether, so this closes once both are out. Either cover the defaults file here as well, or note in the release notes that only the stored extra parameters are filtered until the bundle ships.
4. Tests. DotIdentityProviderConfigurationImplTest only covers the static resolveSignatureValidationType. Please add a test that getOptionalProperty and containsOptionalProperty hide the two ignored keys while passing others through. Other extra parameters, such as the new allow.unsolicited.responses, have to keep reaching the bundle.
5. Wording, minor. The new Validation Type hint ("dotCMS rejects a response unless the selected parts carry a valid IDP signature") reads well. It's worth adding that a signature the IdP sends on the other part is verified too, since that's how the bundle behaves after #25, and admins choosing "Only Assertion" for IdPs that sign both will wonder.
|
Note for the release: this PR doesn't change the SAML bundle version core ships, so a separate pin change is needed once the new plugin version (from dotCMS/com.dotcms.dotsaml#25) is published.
|
- Log the unsupported-validation-type and ignored verify.signature.* warnings once per site instead of on every request. - Ignore verify.signature.credentials/profile in the SAML defaults properties file too, so signature checks can't be switched off there with the bundle core ships today. - Validation Type hint: select exactly the parts the IdP signs. - Tests: ignored keys are hidden while other extra parameters pass through, a stored none reads as responseandassertion, defaults-file filtering. - Fix the strict TypeScript gate in the dot-auth mapper spec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Scott. Addressed in ea76527:
25.07 LTS counterpart: #37871. |
Fixes dotCMS/private-issues#725
Proposed Changes
dotsaml-config.yml): Validation Type defaults to Response & Assertion; the None option is removed and the hint says to select exactly the parts the IdP signs (exact matching is what the bundle core ships today requires).DotIdentityProviderConfigurationImpl: a missing or unsupportedsignatureValidationType(including a storednone) resolves toresponseandassertion, and storedverify.signature.credentials/verify.signature.profileextra parameters are ignored, so the SAML bundle always uses its defaults for them (true). A warning naming the site is logged once per site when either applies (the configuration is rebuilt per request). This takes effect with the SAML bundle version core ships today.DotAbstractSamlConfigurationServiceImpl: the same two keys are also ignored in the SAML defaults properties file, so they can't switch signature checks off there either.SamlProtocolHandlerstores onlyresponse,assertionorresponseandassertion(normalized) and answers 400 for anything else.none(neither toggle on maps toresponseandassertion), and a storednoneor unknown value is shown as both signatures required, matching what the backend enforces.Checklist
DotIdentityProviderConfigurationImplTest(new, 6),DotAbstractSamlConfigurationServiceImplTest(new, 1),SamlProtocolHandlerTest(+3), dot-auth mapper spec (+2, 1 updated). Java: 28/28; dot-auth lib: 129/129; strict TypeScript gate, Prettier and ESLint pass on the changed frontend files.Additional Info
repo.dotcms.com, thecom.dotcms.samlbundlepin inosgi-base/system-bundles/pom.xmlmoves in two separate PRs, one formainand one forrelease-25.07.10_lts.🤖 Generated with Claude Code
This PR fixes: #725