Repository navigation
[2.0] Fixes #37056: Rewrite the stored SAML IdP certificate as standard PEM in the 2.0.10 migration - #38317
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
…name the IOException variables
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findingsRewriting stored SAML IdP certificates and gating authentication-setting writes changes a login trust boundary; certificate refusal or parsing issues could disrupt SAML access. Rewrites stored SAML IdP certificates as standard PEM during the 2.0.10 migration and checks new or changed certificates on every settings write path before they are stored. No issues found. ✅ 1 closedClosed: Bug: Multi-catch of BadRequestException with its supertype won't compile
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #37056
Backport of #38315 to 2.0. 2.1 backport: #38318.
#38197 put the strict SAML certificate reader on 2.0: a certificate on one line, or with spaces for line breaks, now stops the server at startup. 2.0.10 is not tagged yet, so this should land before it. We keep the strict reader; the database must hold only certificates it accepts:
samlConfiguration.idp.idpX509Certificateas standard PEM (read the way 2.0.9 did, order kept, no duplicates); an unreadable value stays, with a warning.update-security-config, the first-start seed throughcreateNewSetting) passesSystemRepository.prepareSettingForUpdate. That step now gets the stored value it replaces and runsSamlValidator.validateIdpCertificate, the UI save rule, only on a new or changed certificate: an unchanged expired one is never refused. A refusal stores nothing: 400 from the API, exit 1 from the command, a stopped first start.Differences from main: 2.0 has no deployment reconciler or
ENVmode, and stores the authentication configuration unencrypted, so the step compares the stored value as is. 2.0 has no ArchUnit, so the guard testSettingsWriteFunnelTestis main and 2.1 only. The2.0.10folder already exists (#38301).Release note (2.0.10): The SAML IdP certificate is now read strictly as standard PEM. A stored certificate is rewritten during the upgrade, so upgrades need nothing. On a new installation, give
SAML_IDP_CERTIFICATEas the certificate's base64 body alone, on one line, without the BEGIN and END lines; a single line that includes them is refused and the server does not start. Standard PEM works only when written in the configuration file, not in the variable. Saving a new or changed IdP certificate that the server cannot read, from the settings page, the API orupdate-security-config, is now refused with an error instead of being stored.Related, not in this PR: 2.0 still stops when every IdP certificate has expired (
parseUnexpiredIdpCertificates); #38219 / #38302 fix that.Type of change:
High-level design:
None.
Tests:
Unit tests
IdpCertificatePemTest,SamlIdpCertificateMigrationTest(MySQL 8.3, PostgreSQL 16).SystemRepositoryIdpCertificateTest; alsoSettingsCacheAuthenticationSeedTest,OpenMetadataOperationsSecurityConfigTest. 182 tests pass.Backend integration tests
SamlIdpCertificatePutIT: PUT and PATCH refuse a bad certificate and store nothing; a good one is stored; a stored expired one is not refused by the check (2.0's runtime still refuses an all-expired IdP). Also green:SystemResourceIT,SamlSecurityConfigIT.Manual testing performed
Real runs, MySQL and PostgreSQL:
migratefrom 2.0.9 rewrote a single-line certificate and a 2.0.10 server then started; a fresh install with a single-line variable stops and stores nothing.Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md; no 🔴 finding.docs/decisions/2026-11-20-the-stored-saml-idp-certificate-is-standard-pem.md.

Confidence Score: 5/5
The PR appears safe to merge; no new blocking issue was found.Summary
Rewrites older stored SAML IdP certificates as standard PEM during the 2.0.10 migration and checks new or changed certificates before settings are stored.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Settings write] --> B{Certificate changed?} B -->|No| E[Store setting] B -->|Yes| C[Check certificate] C -->|Accepted| E C -->|Refused| D[Reject without storing] F[2.0.10 migration] --> G[Rewrite readable older layouts as PEM] G --> H[(Stored authentication settings)] E --> HReviews (16) · Last reviewed commit: "Check a whitespace-only SAML IdP certifi..." · Reviewed by Greptile