Repository navigation
Fixes #37056: Rewrite the stored SAML IdP certificate as standard PEM in the 2.0.10 migration - #38315
Conversation
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findingsThe migration rewrites stored SAML IdP certificates and gates security-setting writes; certificate handling could disrupt SAML login or block server startup. Rewrites the stored SAML IdP certificate as standard PEM in the 2.0.10 migration and checks new or changed certificates on every settings write, so single-line or space-separated values are refused before storage. Resolved the finding that the gate's lenient save check let old-layout certificates into the database. ✅ 1 closed✅ Bug: Gate's lenient save check lets old-layout certificates into the database
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 |
yan-3005
left a comment
There was a problem hiding this comment.
Could we add this to the 2.0.10 release notes, so customers on ENV config mode know before they upgrade?
SAML IdP certificate (2.0.10): OpenMetadata now reads the SAML identity provider certificate more strictly. A certificate saved in the database is reformatted automatically during the upgrade, so nothing to do there. If you set it through the
SAML_IDP_CERTIFICATEenvironment variable and it is written on a single line together with the-----BEGIN CERTIFICATE-----and-----END CERTIFICATE-----lines, the server will not start after the upgrade. Use standard PEM, with the BEGIN and END lines each on their own line, or put only the base64 body on one line without those lines.
|
@yan-3005 thanks for the review. One correction for 2.0.10: 2.0 has no |
Describe your changes:
Fixes #37056
#38197, #38219 and #38302 read the IdP certificate strictly: one on a single line, or with spaces for line breaks, stops the server at startup. We keep it; the database must hold only certificates it accepts:
samlConfiguration.idp.idpX509Certificateas standard PEM; an unreadable value stays, with a warning.update-security-config, seeds, reconcile) passesSystemRepository.prepareSettingForUpdate. That step now gets the decrypted stored value 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 and surfaces as before: 400, exit 1, a stopped first orENVstart, or a kept value and error log inAUTO/DB.SettingsWriteFunnelTestfails if a new method writes a setting past that step. Undoing a security save the server cannot apply puts back the rows it replaced as they were read, without the check, so a stored certificate that has since expired comes back.Upgrade note:
ENVmode applies the deployment value on every start, so a single-lineSAML_IDP_CERTIFICATEis refused on the first start after upgrading, though the migration fixed the stored copy. Fix the variable: standard PEM, or the base64 body alone.AUTOkeeps the migrated value.Backports: #38318, #38317.
Type of change:
High-level design:
None.
Tests:
Unit tests
IdpCertificatePemTest,SamlIdpCertificateMigrationTest(MySQL 8.3, PostgreSQL 16).SystemRepositorySecuritySettingsTest; whatupdate-security-configstores:OpenMetadataOperationsSecurityConfigTest; undoing a refused save over an expired certificate:SystemResourceSecurityConfigApplyTest; alsoDeploymentConfigReconcilerTest,SettingsWriteFunnelTest.Backend integration tests
SsoSamlIdpCertificateIT: PUT and PATCH refuse a bad certificate (400, nothing stored), store a good one, keep a stored expired one, and put it back unchanged when a save cannot be applied. Also green:SsoSecurityConfigApplyIT; on the previous head,SamlSecurityConfigIT,ConfigSourceITand two more.Local Java test run: PASSED
0ac9686dc3df(baseorigin/main)--scope full).Manual testing performed
Real runs (MySQL, PostgreSQL): a bad certificate stops a fresh install and
ENV;AUTOkeeps the row;update-security-configexits 1 and writes 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 stored SAML IdP certificates as standard PEM during the 2.0.10 migration.
No new actionable issues found. Previous threads are unnumbered and were not reposted. No tests were run during this review.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Existing stored certificate] --> B[2.0.10 migration] B --> C[Rewrite readable values as PEM] D[Settings write] --> E{Certificate new or changed?} E -->|Yes| F[Check certificate] F -->|Accepted| G[Store settings] F -->|Refused| H[Leave stored settings unchanged] E -->|No| G G --> I{Security save applies?} I -->|No| J[Restore original rows if still current]Reviews (15) · Last reviewed commit: "Mark unchanged parameters and locals fin..." · Reviewed by Greptile