Skip to content

fix(security): backend security hardening - #36655

Merged
mohityadav766 merged 3 commits into
mainfrom
fix/security-hardening-oidc-user-secrets
Oct 31, 2026
Merged

mohityadav766 merged 3 commits into
mainfrom
fix/security-hardening-oidc-user-secrets

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Backend security hardening from an internal review, one commit per area:

  • OIDC sign-in.
  • User credential handling.

Each commit carries its own regression tests. Details are tracked internally.

🤖 Generated with Claude Code

Keep only the authorization code from the callback redirect and take the ID
token from the token endpoint's answer for that code. Require the code
whatever the response type is: the client redirects back in query mode, where
providers return a code and never a token. Test Login follows the same rule.
…e events

A stored user carries its authentication mechanism: a person's password hash,
or a bot's token. Reads withhold it; keep it out of write responses and change
events too.

- Mark the authenticationMechanism definition in user.json as masked, so masked
  serialization of a user leaves it out. The marker sits on the definition
  because a "mask" beside a $ref never reaches the generator.
- Serialize the change event recorded when users are seeded the masked way.
- Return no mechanism for a person from create, PUT, PATCH, delete and
  restore. A bot's response is unchanged.
- Remove the mechanism from stored user events (2.0.8 post-data migration,
  MySQL and PostgreSQL).
@mohityadav766
mohityadav766 requested a review from a team as a code owner October 30, 2026 06:48
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit 186a526

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 28 0 0 0 5m 51s
ldap ✅ pass 7 0 0 0 0m 44s
keycloak-oidc-confidential ✅ pass 12 0 0 0 1m 40s
keycloak-oidc-public ✅ pass 11 0 0 0 1m 05s
msal-mock ✅ pass 7 0 0 0 0m 49s
auth0-mock ✅ pass 6 0 0 0 0m 37s
okta ⏩ skipped - - - - -
keycloak-azure-saml ✅ pass 23 0 0 0 6m 24s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

Totals: 94 passed · 0 failed · 0 flaky · 0 skipped · duration 17m 12s

@gitar-bot

gitar-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · The OIDC callback rejects code-less sign-ins, and migrations remove credentials from historical events, potentially blocking implicit-flow logins and altering stored audit records.

Hardens the OIDC confidential callback to take only the authorization code and refuse callbacks without one, and keeps user authentication mechanisms (password hashes) out of user write responses and change events, with a migration scrubbing stored events. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-30T10:58:11Z)

Blocked the queue: integration-tests-postgres-elasticsearch-redis

@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 11c1f21 Oct 31, 2026
95 of 96 checks passed
@mohityadav766
mohityadav766 deleted the fix/security-hardening-oidc-user-secrets branch October 31, 2026 12:04
mohityadav766 added a commit that referenced this pull request Nov 3, 2026
* fix(security): validate the audience, issuer and tenant of identity-provider tokens

Tokens not signed with OpenMetadata's own key must name a configured client
(clientId or oidcConfiguration.id) in their audience, carry the issuer from the
provider's discovery document when the server-side client knows it, and, for a
public Entra ID client whose authority names a tenant ID, come from that
tenant. The discovery document is read on demand, so the server still starts
while the provider is unreachable. The IT harness presents the ID token, as
browsers do.

Backport of the provider-token validation in #34967 and the tenant check in
#36156. The rest of #34967 does not apply: 2.0 still mints its own token for
confidential sign-ins.

* fix(security): take only the authorization code from the OIDC callback

Establish the login session only from the ID token the token endpoint returns
for the callback's authorization code. Require the code whatever the response
type is (the client redirects back in query mode, where providers return a
code and never a token) and keep nothing else from the redirect.

Backport of #35679 and of its follow-up on main. Test Login, which the
follow-up also changed, does not exist on 2.0.

* fix(security): keep user credentials out of responses, snapshots and change events

A stored user carries its authentication mechanism: a person's password hash,
or a bot's token. Reads withhold it; keep it out of every other way a user
leaves the server.

- Versions and history return user snapshots without it.
- Listing change events requires an admin or a bot.
- The authenticationMechanism definition in user.json is masked, so masked
  serialization of a user leaves it out, and the event recorded when users are
  seeded is serialized that way.
- Create, PUT, PATCH, delete and restore return no mechanism for a person. A
  bot's response is unchanged.
- The 2.0.8 post-data migration removes it from stored user events (MySQL and
  PostgreSQL).

Backport of the snapshot redaction in #36156, the change-event listing check
in #34838, and #36655.

* docs: state the rules in comments

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants