Repository navigation
[2.0] fix(security): batch of backend security-hardening fixes - #36683
Conversation
…rovider 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.
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.
…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.
* fix(security): compare user identities exactly and keep account credentials intact - Add SecurityUtil.sameIdentifier, which compares names, emails and email domains by their Locale.ROOT lower-case forms, the normalization stored names get. String.equalsIgnoreCase also compares upper-case forms and so equates distinct names. Use it for the self checks in UserResource and ActivityResource, the admin-name checks, session binding, adminEmails and the email-domain allow-lists. Normalize user names and emails with Locale.ROOT. - POST /users/generateToken mints tokens for bot users only; people use personal access tokens, which can be revoked. - A PUT or CSV row that carries no authentication mechanism keeps the stored one instead of dropping it. - Bot seeding and app bot creation refuse an existing account of the same name that is not a bot. - A bot can no longer be created for a soft-deleted user who is not a bot. - Self sign-up requires the email the caller's token carries. - Impersonation evaluates the target user with its domains loaded. * fix(security): tie provider tokens and SAML assertions to this deployment - Legacy claim flow: a provider-issued token must carry an email in allowedEmailDomains when that list is set, and the email must be the one stored on the account the user name resolves to. A provider token never signs in to a bot account. - SAML: every response must be current and issued to this service provider (Conditions and SubjectConfirmationData NotOnOrAfter, SessionNotOnOrAfter, audience, Destination against the configured ACS URL), whatever strictMode is set to. Test Login applies the same rule. A rejected response is a 401. - Public Entra ID clients accept tokens only from the tenant the authority names; multi-tenant authorities are unchanged. - Basic auth: a self-registered account with a confirmation still pending cannot sign in, including through the MCP login form. The registration domain allow-list compares domains with sameIdentifier. - LDAP: a wrong password is counted towards the login lockout (UnboundID reports a rejected bind by throwing), and a successful bind clears the count. * fix(security): keep connection and account secrets out of snapshots and off new endpoints - Version and history endpoints redact the stored snapshot the way the entity's own reads do: EntityResource gains a snapshotRedaction hook that User (drops authenticationMechanism), every ServiceEntityResource (masks the connection), IngestionPipeline and Workflow override. The service follower, PATCH, delete and restore responses, and their follower change events, are masked too. - A connection keeps its stored secret only while it points where it did: ConnectionSecretsGuard refuses a PATCH, PUT or test-connection workflow that changes an endpoint field while leaving a secret masked, encrypted or equal to the stored one. Admins and bots are unaffected. - getSettingByName resolves the setting name to a SettingsType before the access checks, and refuses a row whose type is not the one requested, so an accent-insensitive DB collation cannot return the auth configuration. - Settings reject a secret sent already Fernet-encrypted unless it is the one the setting holds, so a setting cannot decrypt another's token. * fix(security): let a Deny rule win an ANY authorization check authorizeRequests(ANY) tried each request and passed as soon as one allowed access, swallowing the AuthorizationException the others threw. An explicit Deny rule threw the same exception as "no rule allowed it", so a Deny on one request was ignored when a sibling request allowed access — for example query listing checks ViewBasic on the query and ViewQueries on the parent table, and a table Deny on ViewQueries was overridden. CompiledRule.evaluateDenyRule now throws PolicyDeniedException, a subclass the ANY loop rethrows while it still skips a plain "not allowed" to the next request. * fix(security): close authorization gaps on services, queries, apps and workflows - A service's pipelines field listed pipelines a deny rule hides; it is now filtered to the ones the caller may view (admins and bots see all). - Attaching or detaching a query to an asset, through /usage or queryUsedIn on create and PUT, checks EditQueries on each asset, so a query cannot be moved into another domain's asset without that permission. - A tag-based deny rule now sees inherited tags: the authorization ResourceContext runs tag inheritance after loading the entity's own tags. - A team no longer stores its parents' domains as its own, so they do not survive the parent's domain being removed. - A description-only app PATCH no longer reinstalls or unschedules the app; rescheduling needs EditAll. An app trigger with a config override needs EditAll, not just Trigger. - The reverse-ingestion trigger resolves the service from the store and requires a service entity type. The Spark-engine trigger confirms the stored request is a Spark request before applying the lighter create check. * fix(security): close search RBAC and index gaps around queries, services and lineage - Query cost records are now subject to the query's search RBAC: they are a child of the query for RBAC, and their document carries the query's owners, tags and domains at the top level, so a deny on the query hides them. The query-cost-by-service aggregation drops groups whose query the caller cannot view. - LLM model and MCP server search documents get their service's domain, so a service domain change propagates instead of leaving them domainless. - The OpenSearch RBAC query cache key includes a policy generation that bumps whenever the policy caches are dropped, so a policy-rule or role-policy edit is not served stale for the cache TTL. - MCP root_cause_analysis authorizes the real entity by FQN and runs the lineage view filter over its upstream producers, so an inherited-domain node is not returned to a caller denied it. - Moving a Context Center page rewrites a descendant FQN only at a real "." boundary, so a sibling that merely shares a prefix is left alone. - A SearchIndex reindex keeps its field-level tags. * fix(security): harden the event filter, search preview and table CSV import - The audit/change-event filter matched excluded endpoints with a substring check, so a write whose path embeds one (through a matrix parameter or an encoded separator) skipped auditing. It now shares JwtFilter.isExcludedEndpoint, which matches the resource path exactly after dropping matrix parameters. - Search preview runs with caller-supplied settings that can stall the cluster; it now requires admin, like the settings write it previews. - Table CSV import validated the whole table on every row, which made a large import quadratic in its column count; it validates once after applying the rows. A row naming a missing parent column no longer dereferences null. * fix(security): require http(s) URLs for every learning resource type A javascript: or data: URL in a learning resource runs in the product's origin when the UI frames or links it. The backend restricted the scheme for Link and PDF only, so Storylane, Video and Article accepted any scheme. - LearningResourceRepository requires an http or https URL for every type. - The Storylane, Video and Article players pass the URL through getSafeHttpUrl before framing or linking it, so a stored unsafe URL is dropped rather than executed. * fix(security): resolve the caller only when a service write carries a connection The service PUT path resolved the caller's subject before checking whether the write carried a connection at all, so a connectionless create or update did an unnecessary subject lookup. Check the connection first; only a write that carries one can keep a stored secret and needs the retarget guard. * fix(security): address review — order-independent deny, endpoint-scoped secret guard, bulk denies Review follow-ups: - ANY-mode authorization evaluates every request so an explicit Deny wins regardless of order ([allowed, denied] is refused too). - A description- or config-less app patch that replaces the whole document (path "/") still reschedules and requires EditAll. - The policy generation counter is bumped after the policy caches are cleared, so a concurrent read cannot re-cache stale rules. - Tag-based deny rules see inherited tags on the bulk authorization path too. - The search FQN-prefix rewrite guards the classification FQN at a separator boundary, not only the top-level FQN. - The connection secret guard triggers only when an endpoint field changes (so filter/flag edits keep the masked secret) and also refuses a kept external secret: reference. - The service PUT resolves the caller only when the write carries a connection. - Decision records for the ANY-deny and connection-secret rules. * test(ui): VideoPlayer no longer frames an unsafe or unparseable URL The player now passes the embed URL through getSafeHttpUrl, so an invalid or javascript: URL yields no iframe src. Update the existing invalid-URL test to assert it is not framed, and add a javascript: case. * fix(security): fail closed in the connection-secret guard; review fixes - ConnectionSecretsGuard now exempts known-safe fields (ingestion filter patterns, supports* flags, descriptions) and treats every other field as able to redirect the connection, instead of matching a fixed list of endpoint field names. A connector-specific target the list did not name (for example an Oracle TNS descriptor or Domo instanceDomain) now forces the secret to be re-entered rather than being silently restored; flag and description edits no longer do. - Import java.util types instead of using fully-qualified names in SearchEntityIndex and SubjectCache. - AppRepositoryBotUserTest asserts the observable outcome (the person account is named in the error and left un-promoted) rather than a verify() on an internal call. * fix(security): address review — compile-safe FQN script, legacy OIDC compat, app trigger - SearchClient.UPDATE_FQN_PREFIX_SCRIPT renamed its outer variable to docFQN. It reused currentFQN, which the appended tag fragment also declares, and Painless rejects a redeclaration of a name already in scope: the whole updateByFqnPrefix script failed to compile, so renames and moves silently left stale fullyQualifiedName values in the search documents. Added a cross-scope redeclaration guard to SearchClientTagScriptSeparationTest. - JwtFilter legacy provider flow: enforce allowedEmailDomains only when the token actually carries an email. A bare principal claim (preferred_username, or sub before email) builds claim@principalDomain, itself an allowed domain, so it is no longer rejected on upgrade. Removed the stored-email equality check that logged a user out on every request when the account email differed from the token (admin/CSV/SCIM provisioning, or an IdP domain change) and could not be fixed by signing in again; kept the guard that a provider token cannot sign in to a bot account. - AppResource trigger requires EditAll only when the payload changes or removes a value the configuration already holds. Supplying a value for a runtime parameter the configuration leaves unset (AutoPilot's entityLink) stays a plain Trigger, so a Data Steward can trigger AutoPilot. Added AppResourceTriggerPayloadTest. * fix(security): address review — trigger runtime parameters, provider tokens never act as bots - AppResource: a trigger payload needs EditAll for any key other than a declared runtime parameter (entityLink) whose value differs from the stored config, including a key the stored config omits and leaves at its schema default. Comparing only against present values let a Trigger-only user set recreateIndex (absent from the seeded search indexing config) or a retention period. - JwtFilter legacy provider flow: check the bot account and the email domain for every provider token, not only one that carries an email. A bare principal claim names the account just as an email's local part does, and the request runs as userName@principalDomain, which must be in allowedEmailDomains. The bot check reads the cached user context and treats a missing account as a first login, so new users can still sign in. - SearchClientTagScriptSeparationTest checks every painless *_SCRIPT constant for a variable redeclared while still in scope, scoping for-loop variables to their loop. - AppsResourceIT: a Data Steward (Trigger, no EditAll) may pass entityLink but is refused a configuration key. * fix(security): a whole-document patch bundled with field edits still runs the connection guard JsonUtils.extractPatchedFields skips root paths, so a JSON Patch that replaces the whole document and also edits /description reported only "description". ServiceEntityResource then skipped the connection-secret guard: an editor who sees only masked secrets could point the connection at another host and have the stored password restored into it. AppResource likewise did not treat the patch as touching the app's schedule or configuration. Both now ask JsonPatchUtils.replacesWholeDocument, which looks for a root operation directly. * test: isolate JwtFilterTest's user lookups from the global entity registry The legacy provider flow now asks SubjectCache whether the account a token names is a bot. Tests that did not mock SubjectCache resolved that through the global Entity registry, which SubjectCacheTest fills with its own mock repositories and never clears, so when it ran first 20 JwtFilterTest cases failed with an NPE from that leftover mock. Every test now runs with a per-test SubjectCache mock that treats an unstubbed name as having no account yet, and the tests that need a particular user stub it on that mock. * fix: a root test operation is not a whole-document write JsonPatchUtils.replacesWholeDocument counted a root "test" operation, which only checks the document, as a write. A client that bundled such a check with a /description edit made AppResource treat the patch as touching the app's schedule or configuration and reinstall the app. Test operations are now skipped, and the JSON Patch member names and root pointer are named constants. * fix: dropping a stored connection setting also needs the secrets again The masked-secret guard compared only the settings the incoming connection carries, so removing a stored one, such as an override in connectionArguments, read as no change and kept the stored secrets. Settings and list entries present on either side are now compared. * fix: authorize the assets every query write attaches or detaches Attaching a query to an asset, or detaching it from one, needs EditQueries on that asset. Create, PUT and /usage checked it; PATCH and bulk PUT did not. A new EntityResource hook runs after the entity's own create or edit check on create, PUT and each bulk item, where a denial fails only that item. The query resource implements it by comparing the stored and written queryUsedIn, and its PATCH applies the same check to the patched queryUsedIn. * perf: read the stored assets of a bulk query request in one batch The asset check on bulk PUT read each existing query's queryUsedIn separately. A new EntityResource hook loads what the per-item check reads for every stored entity at once, after the authorization fields. Queries use the same batch read as the list endpoints and the bulk update, so the check sees the assets that update will compare against. * test: let the unreachable-directory LDAP test tolerate the JDK's wording JDK 21.0.13 appends " (connect failed)" to a refused connection's message, so asserting the whole string failed on runners that picked it up. The test now checks the part the validation writes: the address and the reason. * refactor: name the strings the new security checks compare against The Entra authority version segment, the email separator and the connection field name were raw literals in equals/contains calls. * test: check a real app install leaves a person's account alone The bot-name check was covered by a unit test that mocked three repositories and the entity registry. An integration test now installs an app whose bot name a person already holds, and checks that the saved account is unchanged and that neither the bot nor the app is created. A refused install now answers 400 instead of an unhandled 500. * refactor: import types instead of naming them in full The SAML response validator spelled out javax.servlet.http.HttpServletRequest, and two JwtFilterTest lines called Mockito.mockStatic by its full name although it is statically imported. * test: give the msal-mock token the tenant its authority names Main's msal-mock fixture now signs its ID token with the mock IdP, and that token carried no tid claim. The fixture's authority names a tenant, and a public Entra client accepts only tokens from the tenant its authority names, so every scenario failed with "Token tenant 'null' is not the tenant configured for sign-in". The mock's /test/id-token takes an optional tenantId and signs it as tid, as Entra ID does, and the fixture passes its own tenant. (cherry picked from commit ca9b8c0) 2.0 port: carries only what exists on 2.0. - Left out, the code is main-only: the settings secret checks (2.0 does not encrypt the authentication configuration), the context-memory and change-actor identity checks, SSO Test Login, the msal mock, the mock IdP's tenant claim, and the allowedEmailDomains and registration-domain hunks. - Adapted: provider tokens are checked against the principal domain when it is enforced (2.0 has no allowedEmailDomains or email-first flow); LDAP keeps its inline connection; the OpenSearch RBAC cache key keeps 2.0's shape under the new prefix; ViewPermissionFilter comes from main for the query-cost and service-pipelines filters; the settings test uses GLOSSARY_TERM_RELATION_SETTINGS.
PUT /v1/dataQuality/testCases authorized CREATE and EDIT_ALL on a context that loads the test case by name. Since AuthorizationLogic.ANY evaluates every request, a non-admin PUT of a new test case failed with 404 from that lookup. Ask for CREATE against the request for a new test case and EDIT_ALL for an existing one, using the FQN the repository stores. (cherry picked from commit 71db677)
prepare creates the table's test suite when it is missing, so it must not run for a caller the PUT refuses. Set only the FQN before authorizing. Cover a Create-only and an EditAll-only caller on test cases. (cherry picked from commit 84316b5)
Only a new test case changes how it is authorized. An existing one is checked as before, the same way ODCSTestCaseWriteGuard checks an update. (cherry picked from commit 7ecbf6f)
Creating needs CreateTests on the table, as POST does, and updating needs EditTests, the same request sets ODCSTestCaseWriteGuard uses. (cherry picked from commit 53af873)
…port Both build their create and update request sets from TestCaseWriteAuthRequests, and the rule is recorded in a decision record. (cherry picked from commit 48f31fa) 2.0: the ODCS import preview check this commit also moves onto the shared sets is not on 2.0, so only the guard's authorize change is carried.
❌ 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 |
| static boolean overridesConfiguredValue(App app, Map<String, Object> configPayload) { | ||
| if (configPayload == null || configPayload.isEmpty()) { | ||
| return false; | ||
| } | ||
| Map<String, Object> configured = JsonUtils.getMap(app.getAppConfiguration()); | ||
| return configPayload.entrySet().stream() | ||
| .filter(entry -> !RUNTIME_TRIGGER_PARAMETERS.contains(entry.getKey())) | ||
| .anyMatch(entry -> !Objects.equals(configured.get(entry.getKey()), entry.getValue())); | ||
| } |
There was a problem hiding this comment.
⚠️ Bug: Triggering an app with no appConfiguration and a payload throws NPE
overridesConfiguredValue calls JsonUtils.getMap(app.getAppConfiguration()), and that is just OBJECT_MAPPER.convertValue(o, Map.class). When the app has no configuration, the call returns null. appConfiguration is optional in app.json; the required fields are only id, name, appType, className, scheduleType, permission and runtime. So POST /v1/apps/trigger/{name} with a non-empty body against such an app hits configured.get(...) on null and returns a 500. Before this change the same request ran the app. Defaulting to an empty map makes every non-runtime key in the payload count as an override, which then requires EditAll. That is the fail-closed behaviour the comment above the method describes.
Treat a missing configuration as empty:
Map<String, Object> configured =
app.getAppConfiguration() == null
? Map.of()
: listOrEmptyMap(JsonUtils.getMap(app.getAppConfiguration()));
// or: Map<String, Object> configured = Objects.requireNonNullElse(JsonUtils.getMap(app.getAppConfiguration()), Map.of());
Was this helpful? React with 👍 / 👎
|
… backport/2.0/security-hardening
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
|
…#36683 (#38197) * [2.0] fix(security): batch of backend security-hardening fixes (#36683) * fix(security): batch of backend security-hardening fixes (#36156) * fix(security): compare user identities exactly and keep account credentials intact - Add SecurityUtil.sameIdentifier, which compares names, emails and email domains by their Locale.ROOT lower-case forms, the normalization stored names get. String.equalsIgnoreCase also compares upper-case forms and so equates distinct names. Use it for the self checks in UserResource and ActivityResource, the admin-name checks, session binding, adminEmails and the email-domain allow-lists. Normalize user names and emails with Locale.ROOT. - POST /users/generateToken mints tokens for bot users only; people use personal access tokens, which can be revoked. - A PUT or CSV row that carries no authentication mechanism keeps the stored one instead of dropping it. - Bot seeding and app bot creation refuse an existing account of the same name that is not a bot. - A bot can no longer be created for a soft-deleted user who is not a bot. - Self sign-up requires the email the caller's token carries. - Impersonation evaluates the target user with its domains loaded. * fix(security): tie provider tokens and SAML assertions to this deployment - Legacy claim flow: a provider-issued token must carry an email in allowedEmailDomains when that list is set, and the email must be the one stored on the account the user name resolves to. A provider token never signs in to a bot account. - SAML: every response must be current and issued to this service provider (Conditions and SubjectConfirmationData NotOnOrAfter, SessionNotOnOrAfter, audience, Destination against the configured ACS URL), whatever strictMode is set to. Test Login applies the same rule. A rejected response is a 401. - Public Entra ID clients accept tokens only from the tenant the authority names; multi-tenant authorities are unchanged. - Basic auth: a self-registered account with a confirmation still pending cannot sign in, including through the MCP login form. The registration domain allow-list compares domains with sameIdentifier. - LDAP: a wrong password is counted towards the login lockout (UnboundID reports a rejected bind by throwing), and a successful bind clears the count. * fix(security): keep connection and account secrets out of snapshots and off new endpoints - Version and history endpoints redact the stored snapshot the way the entity's own reads do: EntityResource gains a snapshotRedaction hook that User (drops authenticationMechanism), every ServiceEntityResource (masks the connection), IngestionPipeline and Workflow override. The service follower, PATCH, delete and restore responses, and their follower change events, are masked too. - A connection keeps its stored secret only while it points where it did: ConnectionSecretsGuard refuses a PATCH, PUT or test-connection workflow that changes an endpoint field while leaving a secret masked, encrypted or equal to the stored one. Admins and bots are unaffected. - getSettingByName resolves the setting name to a SettingsType before the access checks, and refuses a row whose type is not the one requested, so an accent-insensitive DB collation cannot return the auth configuration. - Settings reject a secret sent already Fernet-encrypted unless it is the one the setting holds, so a setting cannot decrypt another's token. * fix(security): let a Deny rule win an ANY authorization check authorizeRequests(ANY) tried each request and passed as soon as one allowed access, swallowing the AuthorizationException the others threw. An explicit Deny rule threw the same exception as "no rule allowed it", so a Deny on one request was ignored when a sibling request allowed access — for example query listing checks ViewBasic on the query and ViewQueries on the parent table, and a table Deny on ViewQueries was overridden. CompiledRule.evaluateDenyRule now throws PolicyDeniedException, a subclass the ANY loop rethrows while it still skips a plain "not allowed" to the next request. * fix(security): close authorization gaps on services, queries, apps and workflows - A service's pipelines field listed pipelines a deny rule hides; it is now filtered to the ones the caller may view (admins and bots see all). - Attaching or detaching a query to an asset, through /usage or queryUsedIn on create and PUT, checks EditQueries on each asset, so a query cannot be moved into another domain's asset without that permission. - A tag-based deny rule now sees inherited tags: the authorization ResourceContext runs tag inheritance after loading the entity's own tags. - A team no longer stores its parents' domains as its own, so they do not survive the parent's domain being removed. - A description-only app PATCH no longer reinstalls or unschedules the app; rescheduling needs EditAll. An app trigger with a config override needs EditAll, not just Trigger. - The reverse-ingestion trigger resolves the service from the store and requires a service entity type. The Spark-engine trigger confirms the stored request is a Spark request before applying the lighter create check. * fix(security): close search RBAC and index gaps around queries, services and lineage - Query cost records are now subject to the query's search RBAC: they are a child of the query for RBAC, and their document carries the query's owners, tags and domains at the top level, so a deny on the query hides them. The query-cost-by-service aggregation drops groups whose query the caller cannot view. - LLM model and MCP server search documents get their service's domain, so a service domain change propagates instead of leaving them domainless. - The OpenSearch RBAC query cache key includes a policy generation that bumps whenever the policy caches are dropped, so a policy-rule or role-policy edit is not served stale for the cache TTL. - MCP root_cause_analysis authorizes the real entity by FQN and runs the lineage view filter over its upstream producers, so an inherited-domain node is not returned to a caller denied it. - Moving a Context Center page rewrites a descendant FQN only at a real "." boundary, so a sibling that merely shares a prefix is left alone. - A SearchIndex reindex keeps its field-level tags. * fix(security): harden the event filter, search preview and table CSV import - The audit/change-event filter matched excluded endpoints with a substring check, so a write whose path embeds one (through a matrix parameter or an encoded separator) skipped auditing. It now shares JwtFilter.isExcludedEndpoint, which matches the resource path exactly after dropping matrix parameters. - Search preview runs with caller-supplied settings that can stall the cluster; it now requires admin, like the settings write it previews. - Table CSV import validated the whole table on every row, which made a large import quadratic in its column count; it validates once after applying the rows. A row naming a missing parent column no longer dereferences null. * fix(security): require http(s) URLs for every learning resource type A javascript: or data: URL in a learning resource runs in the product's origin when the UI frames or links it. The backend restricted the scheme for Link and PDF only, so Storylane, Video and Article accepted any scheme. - LearningResourceRepository requires an http or https URL for every type. - The Storylane, Video and Article players pass the URL through getSafeHttpUrl before framing or linking it, so a stored unsafe URL is dropped rather than executed. * fix(security): resolve the caller only when a service write carries a connection The service PUT path resolved the caller's subject before checking whether the write carried a connection at all, so a connectionless create or update did an unnecessary subject lookup. Check the connection first; only a write that carries one can keep a stored secret and needs the retarget guard. * fix(security): address review — order-independent deny, endpoint-scoped secret guard, bulk denies Review follow-ups: - ANY-mode authorization evaluates every request so an explicit Deny wins regardless of order ([allowed, denied] is refused too). - A description- or config-less app patch that replaces the whole document (path "/") still reschedules and requires EditAll. - The policy generation counter is bumped after the policy caches are cleared, so a concurrent read cannot re-cache stale rules. - Tag-based deny rules see inherited tags on the bulk authorization path too. - The search FQN-prefix rewrite guards the classification FQN at a separator boundary, not only the top-level FQN. - The connection secret guard triggers only when an endpoint field changes (so filter/flag edits keep the masked secret) and also refuses a kept external secret: reference. - The service PUT resolves the caller only when the write carries a connection. - Decision records for the ANY-deny and connection-secret rules. * test(ui): VideoPlayer no longer frames an unsafe or unparseable URL The player now passes the embed URL through getSafeHttpUrl, so an invalid or javascript: URL yields no iframe src. Update the existing invalid-URL test to assert it is not framed, and add a javascript: case. * fix(security): fail closed in the connection-secret guard; review fixes - ConnectionSecretsGuard now exempts known-safe fields (ingestion filter patterns, supports* flags, descriptions) and treats every other field as able to redirect the connection, instead of matching a fixed list of endpoint field names. A connector-specific target the list did not name (for example an Oracle TNS descriptor or Domo instanceDomain) now forces the secret to be re-entered rather than being silently restored; flag and description edits no longer do. - Import java.util types instead of using fully-qualified names in SearchEntityIndex and SubjectCache. - AppRepositoryBotUserTest asserts the observable outcome (the person account is named in the error and left un-promoted) rather than a verify() on an internal call. * fix(security): address review — compile-safe FQN script, legacy OIDC compat, app trigger - SearchClient.UPDATE_FQN_PREFIX_SCRIPT renamed its outer variable to docFQN. It reused currentFQN, which the appended tag fragment also declares, and Painless rejects a redeclaration of a name already in scope: the whole updateByFqnPrefix script failed to compile, so renames and moves silently left stale fullyQualifiedName values in the search documents. Added a cross-scope redeclaration guard to SearchClientTagScriptSeparationTest. - JwtFilter legacy provider flow: enforce allowedEmailDomains only when the token actually carries an email. A bare principal claim (preferred_username, or sub before email) builds claim@principalDomain, itself an allowed domain, so it is no longer rejected on upgrade. Removed the stored-email equality check that logged a user out on every request when the account email differed from the token (admin/CSV/SCIM provisioning, or an IdP domain change) and could not be fixed by signing in again; kept the guard that a provider token cannot sign in to a bot account. - AppResource trigger requires EditAll only when the payload changes or removes a value the configuration already holds. Supplying a value for a runtime parameter the configuration leaves unset (AutoPilot's entityLink) stays a plain Trigger, so a Data Steward can trigger AutoPilot. Added AppResourceTriggerPayloadTest. * fix(security): address review — trigger runtime parameters, provider tokens never act as bots - AppResource: a trigger payload needs EditAll for any key other than a declared runtime parameter (entityLink) whose value differs from the stored config, including a key the stored config omits and leaves at its schema default. Comparing only against present values let a Trigger-only user set recreateIndex (absent from the seeded search indexing config) or a retention period. - JwtFilter legacy provider flow: check the bot account and the email domain for every provider token, not only one that carries an email. A bare principal claim names the account just as an email's local part does, and the request runs as userName@principalDomain, which must be in allowedEmailDomains. The bot check reads the cached user context and treats a missing account as a first login, so new users can still sign in. - SearchClientTagScriptSeparationTest checks every painless *_SCRIPT constant for a variable redeclared while still in scope, scoping for-loop variables to their loop. - AppsResourceIT: a Data Steward (Trigger, no EditAll) may pass entityLink but is refused a configuration key. * fix(security): a whole-document patch bundled with field edits still runs the connection guard JsonUtils.extractPatchedFields skips root paths, so a JSON Patch that replaces the whole document and also edits /description reported only "description". ServiceEntityResource then skipped the connection-secret guard: an editor who sees only masked secrets could point the connection at another host and have the stored password restored into it. AppResource likewise did not treat the patch as touching the app's schedule or configuration. Both now ask JsonPatchUtils.replacesWholeDocument, which looks for a root operation directly. * test: isolate JwtFilterTest's user lookups from the global entity registry The legacy provider flow now asks SubjectCache whether the account a token names is a bot. Tests that did not mock SubjectCache resolved that through the global Entity registry, which SubjectCacheTest fills with its own mock repositories and never clears, so when it ran first 20 JwtFilterTest cases failed with an NPE from that leftover mock. Every test now runs with a per-test SubjectCache mock that treats an unstubbed name as having no account yet, and the tests that need a particular user stub it on that mock. * fix: a root test operation is not a whole-document write JsonPatchUtils.replacesWholeDocument counted a root "test" operation, which only checks the document, as a write. A client that bundled such a check with a /description edit made AppResource treat the patch as touching the app's schedule or configuration and reinstall the app. Test operations are now skipped, and the JSON Patch member names and root pointer are named constants. * fix: dropping a stored connection setting also needs the secrets again The masked-secret guard compared only the settings the incoming connection carries, so removing a stored one, such as an override in connectionArguments, read as no change and kept the stored secrets. Settings and list entries present on either side are now compared. * fix: authorize the assets every query write attaches or detaches Attaching a query to an asset, or detaching it from one, needs EditQueries on that asset. Create, PUT and /usage checked it; PATCH and bulk PUT did not. A new EntityResource hook runs after the entity's own create or edit check on create, PUT and each bulk item, where a denial fails only that item. The query resource implements it by comparing the stored and written queryUsedIn, and its PATCH applies the same check to the patched queryUsedIn. * perf: read the stored assets of a bulk query request in one batch The asset check on bulk PUT read each existing query's queryUsedIn separately. A new EntityResource hook loads what the per-item check reads for every stored entity at once, after the authorization fields. Queries use the same batch read as the list endpoints and the bulk update, so the check sees the assets that update will compare against. * test: let the unreachable-directory LDAP test tolerate the JDK's wording JDK 21.0.13 appends " (connect failed)" to a refused connection's message, so asserting the whole string failed on runners that picked it up. The test now checks the part the validation writes: the address and the reason. * refactor: name the strings the new security checks compare against The Entra authority version segment, the email separator and the connection field name were raw literals in equals/contains calls. * test: check a real app install leaves a person's account alone The bot-name check was covered by a unit test that mocked three repositories and the entity registry. An integration test now installs an app whose bot name a person already holds, and checks that the saved account is unchanged and that neither the bot nor the app is created. A refused install now answers 400 instead of an unhandled 500. * refactor: import types instead of naming them in full The SAML response validator spelled out javax.servlet.http.HttpServletRequest, and two JwtFilterTest lines called Mockito.mockStatic by its full name although it is statically imported. * test: give the msal-mock token the tenant its authority names Main's msal-mock fixture now signs its ID token with the mock IdP, and that token carried no tid claim. The fixture's authority names a tenant, and a public Entra client accepts only tokens from the tenant its authority names, so every scenario failed with "Token tenant 'null' is not the tenant configured for sign-in". The mock's /test/id-token takes an optional tenantId and signs it as tid, as Entra ID does, and the fixture passes its own tenant. (cherry picked from commit ca9b8c0) 2.0 port: carries only what exists on 2.0. - Left out, the code is main-only: the settings secret checks (2.0 does not encrypt the authentication configuration), the context-memory and change-actor identity checks, SSO Test Login, the msal mock, the mock IdP's tenant claim, and the allowedEmailDomains and registration-domain hunks. - Adapted: provider tokens are checked against the principal domain when it is enforced (2.0 has no allowedEmailDomains or email-first flow); LDAP keeps its inline connection; the OpenSearch RBAC cache key keeps 2.0's shape under the new prefix; ViewPermissionFilter comes from main for the query-cost and service-pipelines filters; the settings test uses GLOSSARY_TERM_RELATION_SETTINGS. * Authorize a test case PUT for a test case that does not exist yet PUT /v1/dataQuality/testCases authorized CREATE and EDIT_ALL on a context that loads the test case by name. Since AuthorizationLogic.ANY evaluates every request, a non-admin PUT of a new test case failed with 404 from that lookup. Ask for CREATE against the request for a new test case and EDIT_ALL for an existing one, using the FQN the repository stores. (cherry picked from commit 71db677) * Authorize before preparing a test case PUT, and test each grant prepare creates the table's test suite when it is missing, so it must not run for a caller the PUT refuses. Set only the FQN before authorizing. Cover a Create-only and an EditAll-only caller on test cases. (cherry picked from commit 84316b5) * Keep the update checks a test case PUT shared with the ODCS import guard Only a new test case changes how it is authorized. An existing one is checked as before, the same way ODCSTestCaseWriteGuard checks an update. (cherry picked from commit 7ecbf6f) * Check CreateTests on the table when a test case PUT creates Creating needs CreateTests on the table, as POST does, and updating needs EditTests, the same request sets ODCSTestCaseWriteGuard uses. (cherry picked from commit 53af873) * Share the test-case write permission sets between PUT and the ODCS import Both build their create and update request sets from TestCaseWriteAuthRequests, and the rule is recorded in a decision record. (cherry picked from commit 48f31fa) 2.0: the ODCS import preview check this commit also moves onto the shared sets is not on 2.0, so only the guard's authorize change is carried. --------- Co-authored-by: Khairajani <[email protected]> (cherry picked from commit 486d2ce) * Fixes #28784: Interactive Test Login round-trip for SSO configuration (#34054) * Fixes #28784: Interactive Test Login round-trip for SSO configuration Test Login now runs a real sign-in against the unsaved (candidate) SSO configuration for confidential OIDC, SAML, LDAP/Basic and public OIDC, as a dry run that never creates users, issues tokens or starts sessions, and shows the staged outcome and the resolved identity. Saving a new configuration, or an edit that changes how users sign in, is held until a test passes, with an explicit "Save anyway" override. - Admin-only start/result/credentials endpoints. The existing /callback and SAML ACS servlets fork on an "omtest:" marker before any live handling and render a constant page, so no IdP data reaches HTML. - Test sessions are bounded, bound to the starting admin and complete once; credential attempts are rate-limited; masked secrets are restored only when the candidate targets the same endpoint and TLS settings. - Sign-in addresses must be http(s), checked on the server and in the UI; the test popup's opener is cut; tested-identity tokens stay in memory. - The principal-claims mapping splits on the first colon only and is shared by the live OIDC handler, the request filter and Test Login. * Fold Test Configuration into Test Login There was no reason to offer both. Test Login now starts with the checks Test Configuration ran - the same ones a save runs: fields, reachability, credentials - and signs in only when they pass. Problems tied to a field are marked in the form as before; the Test Login modal shows the check as its first step and lists every problem it found. The popup still opens inside the click, so browsers do not block it: the server-driven flows hold it blank until the check passes, and the public client flow runs the check at the point oidc-client reads the authorization endpoint, before it sends the popup anywhere. * chore(playwright): auto-refresh impact-map.generated.json * Keep Test Login state in a shared store A Test Login spans several requests - start, the identity provider's callback, the result polls, the credentials - and with more than one server they can reach different ones. The state lived in one server's memory, so a callback or poll landing elsewhere failed a correct configuration, and with Save held until a test passes, multi-node deployments would have needed "Save anyway" for every edit. The state now lives in sso_test_login_session (2.1.0 migration for MySQL and Postgres), following the MCP flow's mcp_pending_auth_requests: - The pending candidate and handshake are stored Fernet-encrypted and cleared as soon as the test completes or expires. - Every change of state is one conditional UPDATE. A credentials test is claimed before its password is checked, so of two concurrent submissions only one is verified; the first callback still wins. - The per-admin credential limit is a count over the same table, taken after the claim, so it holds across servers and under races. Expired rows are kept without secrets until they leave the limit window. - Each admin can have at most 20 live tests. * Clear abandoned Test Logins on a schedule and end refused ones An expired test kept its sealed candidate secrets until another admin started a test, because the cleanup only ran inside put(). A popup that was closed, or LDAP credentials that were never entered, left the secrets in sso_test_login_session indefinitely. TestLoginSessionSweeper, a Managed service on every server, now clears expired tests once a minute; the statements are idempotent, and a failed sweep is retried on the next tick instead of cancelling the schedule. A credential attempt refused by the per-admin cap was left claimed: it kept its secrets, its polls returned pending until the TTL ran out, and a retry got 400. It now ends as FAILED with the reason before the 429. * Keep the Flowable ALTER DATABASE last in the 2.1.0 MySQL migration FlowableCharsetMigrationTest requires the database-default change to be the final statement, because the Flowable schema upgrade runs after this migration and inherits that default. The merge had appended the SSO Test Login table after it. The table declares its own charset and collation, so moving it above the ALTER changes nothing for it. * Fix the two Test Login E2E specs that failed under sso-auth An existing configuration no longer has an Edit button: a Google configuration opens on its Overview tab and the form sits under Configure, so the save-gate spec now opens that tab. The confidential-client spec's fake provider never sent the popup back, and the page cuts the popup's opener against reverse tabnabbing, which also means it cannot close a popup still showing another origin. Like a real provider, the fake one now redirects the popup to OpenMetadata's /callback, and the result settles only after that, so the page closes the popup once it is back on its own origin. The hook's comment now states that consequence of cutting the opener. * End the Test Login credentials step when an attempt fails The server allows one credentials attempt per test and ends the test even when it refuses one, e.g. with a 429 from the per-admin limit. The hook still cleared the credentials step only on success, so after a refusal the form stayed live and a resubmission reached a finished test, getting "not waiting for credentials" in place of the real reason. The step now ends whatever the outcome; a retry starts a new Test Login. * Keep the Flowable ALTER DATABASE last after merging main again Merging main brought its DataConsumer SPARQL policy update (#34231) into the 2.1.0 MySQL migration, and that merge's resolution placed the SSO Test Login table after the Flowable ALTER DATABASE, which FlowableCharsetMigrationTest requires to be the last statement. The table now sits between the policy update and the ALTER. * Ignore Test Login responses that arrive for an abandoned run The hook drops late responses by comparing the run id, but three paths set state after an await without checking it again: the result poll, the "server could not start" result, and the browser sign-in's failure. A poll answering after a new test started could overwrite that test's timeline with the old session's, and a reset modal could show a stale result or error. Each path now re-checks the run after its await, and an abandoned browser sign-in no longer has its token validated. * Update generated TypeScript types and dereferenced schemas --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * fix(auth): serve the app on /callback while Basic or LDAP is the live provider (#37875) A public-client Google/Okta Test Login popup returns to /callback while the server is still on Basic or LDAP. Those handlers answered 200 with {"message":"Callback handled by frontend"}, so the popup showed raw JSON and the app never loaded to finish the sign-in. Return 404 like the public-client handler does; the 404 error page serves the app at /callback. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(auth): pass Auth0 Test Login for a correct client without a Management API grant (#37903) * fix(auth): pass Auth0 Test Login for a correct client without a Management API grant Auth0Validator checks a confidential client's secret with a client-credentials grant for the Auth0 Management API audience. A sign-in app normally has no grant to that API, so Auth0 answers access_denied "Client ... is not authorized to access resource server", and Test Login failed on a correct configuration unless the app was given needless Management API access. Auth0 checks the client grant only after it has accepted the client ID and secret, so treat that answer as proof the credentials are valid. A wrong secret still fails. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(auth): name the other-access_denied Auth0 test after what it checks Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(sso): validate a Custom OIDC public client that sends no OIDC client configuration (#38079) The SSO form sends no oidcConfiguration for a public client, so Test Login and Save for Custom OIDC (Keycloak) public clients always failed with a NullPointerException on oidcConfig.getDiscoveryUri(). Read the discovery URL from the authority when there is no client configuration, and run the checks against server-side client settings only when they are present. A confidential client without its configuration now gets a readable error instead of the raw exception. Co-authored-by: Claude Opus 5.5 <[email protected]> * Adapt Test Login validation and callback isolation to 2.0 * Remove obsolete empty-migration notes for Test Login storage * fix(sso): use configured development backend for login URLs * fix(saml): handle Test Login on the registered frontend callback * fix(saml): enforce encryption and retain IdP signing certificates * style: format SAML backport tests * fix(saml): validate active rollover keys and expose development SSO URLs * fix(saml): retain rollover keys and adapt development tests for 2.0 * test: include SSO proxy regression in default 2.0 UI checks * test: restore imports required by 2.0 rollover regressions * test: import rollover fixture collection in 2.0 * fix(auth): align test login admission and SAML trust policies * fix(auth): adapt admission repository calls for 2.0 * fix: regenerate SAML and Test Login TypeScript schemas * fix: allow custom SAML service provider URLs --------- Co-authored-by: Khairajani <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Chirag Madlani <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>



Backport of #36156 to
2.0, together with #36590.git cherry-pick -x) of the squash commitca9b8c04a9, adapted to 2.0. It carries only what exists on 2.0; the commit message lists what was left out and what was adapted.main; if it changes before merging, this PR will follow.Details are tracked internally.
Checked on this branch (with #36656 below it):
openmetadata-serviceunit suite in reverse order: 9,047 tests. The one failure,TaskWorkflowLifecycleResolverTest, came from a stale generated class in the local build; with the spec regenerated from clean it passes 31/0.openmetadata-mcpunit tests: 575 tests. The one failure,McpCallbackServletTest.getClaimsMapping_keepsClaimNamesThatContainAColon, also fails on2.0without this backport: [2.0] fix(mcp): mcp claims mapping parser #36213 brought that test to 2.0, but the colon-safe claims-mapping split it expects came tomainwith Fixes #28784: Interactive Test Login round-trip for SSO configuration #34054, which is not on 2.0.2.0has since received the same Learning resource player andgetSafeHttpUrlchanges through fix(ui): only embed http(s) learning resource URLs (backport 2.0 #36300) #36934 and fix(ui): link only http(s) URLs in the summary panel and sanitize the editor's final Markdown pass (backport 2.0 #36806) #36815, so after2.0was merged in this PR keeps2.0's versions.AppsResourceIT,BotImpersonationIT,BotResourceIT,QueryResourceIT,TestCaseCreateOrUpdateAuthorizationIT,UserResourceIT) and the areas its backend changes reach (DatabaseServiceResourceIT,IngestionPipelineResourceIT,WorkflowResourceIT,SystemResourceIT,TeamResourceIT,LearningResourceIT,TestCaseResourceIT,TableResourceIT,ActivityResourceIT): 2,431 tests in each of the isolated and parallel executions, no failures. The dispatched run (41046744122) can't test a2.0branch: its build job records an empty source commit for manual dispatches, so every lane stops before running tests.After merging
2.0in (through #36656), 2026-11-03: the 23 unit classes the two PRs change, 562/0;UserResourceIT,BotImpersonationIT,BotResourceITandAuditLogResourceITon MySQL + Elasticsearch and on Postgres + OpenSearch, 592/0 each.Tracking: open-metadata/openmetadata-collate#7797
🤖 Generated with Claude Code
Summary by Gitar
ConnectionSecretsGuardTestCaseWriteAuthRequestsEditAllEditQuerieson each attached assetThis will update automatically on new commits.