Repository navigation
[2.1] Fixes #37056: Rewrite the stored SAML IdP certificate as standard PEM in the 2.0.10 migration - #38318
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 |
Code Review ✅ Approved 🔴 High riskRewriting stored SAML IdP certificates and gating security-setting writes changes the authentication boundary; rejected or malformed values could disrupt SAML login or startup. Adds a 2.0.10 migration that rewrites stored SAML IdP certificates as standard PEM and validates new or changed certificates in the shared settings write step before they are saved. A refused security save restores the rows it replaced. No issues found. 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.1. 2.0 backport: #38317.
#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.Release note (next 2.1 patch): OpenMetadata now reads the SAML IdP certificate strictly as standard PEM; a certificate saved in the database is rewritten during the upgrade. Before upgrading with
SECURITY_CONFIG_SOURCE=ENV, change a single-lineSAML_IDP_CERTIFICATEthat includes the BEGIN and END lines to the certificate's base64 body alone, on one line without those lines, or the server does not start. Standard PEM works only when written in the configuration file, not in the variable. In the defaultAUTOmode a later change to the variable is not applied over the migrated value; apply it withadopt-deployment-configorENVmode. 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.#38302 merges cleanly with this branch.
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. 291 tests pass on this branch.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.Manual testing performed
Real runs on main (same code; 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; neither numbered previous finding remains outstanding.Summary
The PR repairs older stored SAML certificates and checks new certificates before settings reach the database.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Settings write] --> B{New or changed SAML certificate?} B -->|No| E[Store settings] B -->|Yes| C[Check certificate] C -->|Accepted| E C -->|Refused| D[Return error without storing]Reviews (17) · Last reviewed commit: "Check a whitespace-only SAML IdP certifi..." · Reviewed by Greptile