Repository navigation
Mask secrets nested in collections, and validate outbound URLs, query source and attachment access - #33477
Conversation
…tion fields The masker and the secrets manager only recursed into OpenMetadata objects, so a password field declared inside a JSON-schema array - such as mcpConnection.servers[].apiKey - was skipped: a List is neither an OpenMetadata object nor an annotated leaf, so the walk stopped there. Those fields were returned unmasked and stored unencrypted. Masking, unmasking and password-map building now share one traversal, so they derive identical keys for the same field. Encrypt and delete derive identical secret ids for the same collection element, so removing a service no longer leaves its secrets behind in the store. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… as password fields These three fields carried no "format": "password", so PasswordAnnotator never emitted @PasswordField and the masker treated them as ordinary strings, while their siblings awsSecretAccessKey, apiSecret and privateKey were masked. Generated TypeScript is unaffected, since "format": "password" does not change the emitted TS type, and generated Python is not committed - so no regenerated output accompanies this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…nance webhook endpoint URLValidator matched a regex against the literal host string and never resolved it, so anything not already written as a private IP passed: 0.0.0.0, localhost, and any hostname pointing into the internal network. It now also rejects a host whose resolved addresses are unspecified, loopback, link-local, site-local or multicast. The regex stays as a cheap pre-filter because it covers IPv6 unique-local fc00::/7, which isSiteLocalAddress() does not. A host that fails to resolve is allowed through rather than rejected. Rejecting would make validation depend on DNS being reachable, which breaks air-gapped deployments and the existing tests that use non-resolving hostnames, and an unresolvable host is unreachable by the outbound request anyway. This narrows rather than removes the rebinding window: the name is resolved again when the request is issued. Pinning the validated address into the HTTP client would close it and is a larger change. The governance webhook sink checked only that its endpoint was non-empty; it now runs the same validation as the event-subscription webhooks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
queryStatementSource was interpolated verbatim into the FROM clause of the
query-history SQL, at both the test-connection check and the usage query
parser, which left the rest of the statement open to being rewritten.
The value names a relation, so it cannot be bound as a parameter. It now has
to be an optionally schema-qualified identifier, which preserves the
documented custom-view support ("my_schema.custom_pg_stat_statements").
Matched with fullmatch rather than an anchored pattern, since "$" would also
accept a trailing newline.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
getAssetById and listAttachmentsByFqn returned an attachment's filename, content type, size and parent entity link without checking anything, while downloadAsset and deleteAttachment resolved the parent entity and checked VIEW_BASIC against it. Both now run that same check, extracted into one helper rather than repeated. Under the default policy this changes nothing, since OrganizationPolicy grants ViewAll on all resources to every user. It matters for deployments that layer restrictive or domain-scoped policies on top. listAttachmentsByFqn gains a SecurityContext parameter. Every asset it returns hangs off the same FQN, so one check covers the page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
❌ 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 |
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
✅ Generated Sources Auto-UpdatedThe generated TypeScript types ( |
| private static InetAddress[] resolve(String host) { | ||
| try { | ||
| return InetAddress.getAllByName(host); | ||
| } catch (UnknownHostException e) { | ||
| LOG.debug("Host [{}] did not resolve; skipping address-level SSRF checks", host, e); | ||
| return new InetAddress[0]; | ||
| } | ||
| } |
There was a problem hiding this comment.
DNS rebinding bypasses validation
Allowing resolution failures and discarding the validated addresses leaves the SSRF protection bypassable. An attacker-controlled hostname can be unresolved or public during validation, then resolve to a private address when WebhookSinkProvider independently connects using the original hostname. The outbound client must use the validated address or repeat equivalent validation at connection time.
How this was verified: The validator resolves with InetAddress.getAllByName and returns an empty result on failure, while the webhook later constructs its request from the original endpoint hostname without retaining those addresses.
| private void walkCollection(Collection<?> collection, String key, PasswordFieldVisitor visitor) { | ||
| int index = 0; | ||
| for (Object element : collection) { | ||
| if (isTraversable(element)) { | ||
| walkPasswordFields(element, createKey(key, String.valueOf(index)), visitor); | ||
| } | ||
| index++; | ||
| } | ||
| } |
There was a problem hiding this comment.
Indexes misassign collection secrets
Collection positions are not stable secret identities. During PUT and PATCH, the password map is built from the original configuration and applied to the updated configuration using keys such as servers.0.apiKey. Reordering or inserting masked elements therefore assigns the old secret at that position to a different server before it is encrypted and persisted. Removed or renumbered elements can also leave obsolete indexed entries in an external secret store because updates do not delete them. Match elements by a stable identity and clean up obsolete secret IDs rather than deriving identity solely from the index.
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
py-checkstyle fails on UP045: this module carries no `typing` imports since the typing modernization, and the new annotation reintroduced one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| * <p>Resolving here narrows the hole rather than closing it. The name is resolved again when the | ||
| * request is issued and may answer differently by then; only pinning the validated address into | ||
| * the HTTP client defeats DNS rebinding, which is a larger change than this fix. |
There was a problem hiding this comment.
DNS Rebinding Bypasses Validation
Resolving the hostname only during validateURL does not secure the later request. User-configurable webhook, OAuth token, and validation URLs are passed to HTTP clients by hostname and resolved again when sent. An attacker-controlled DNS name can answer with a public address here and an internal address at request time, allowing the new private-address check to be bypassed. The request must use the validated address while preserving the original Host and TLS identity, or perform an equivalent connection-time address check.
How this was verified: The validator discards the resolved addresses, while outbound callers later pass the original hostname to client.target(...) or HttpClient.send(...), causing an independent resolution.
| // This sink posts from the server's own network position, so it applies the same outbound-URL | ||
| // validation as the event-subscription webhooks. | ||
| URLValidator.validateURL(webhookConfig.getEndpoint().toString()); |
There was a problem hiding this comment.
Redirect Targets Skip Validation
Validating the configured webhook endpoint does not validate destinations reached through redirects. This provider uses an otherwise-default Jersey client, which follows redirects, so a public endpoint can return a method-preserving redirect to a private or link-local URL and cause the server to contact it without running URLValidator on the Location. Disable automatic redirects or handle each redirect explicitly and validate every destination.
How this was verified: The provider validates only webhookConfig.getEndpoint(), creates a default redirect-following client, and contains no validation of redirect Location values before sending.
…he governance webhook endpoint" This reverts commit 4369d5e.
Keying by index meant a stored secret was restored onto whichever element happened to occupy that position. With servers [alpha, beta], deleting alpha and saving sends [beta] with a masked apiKey; beta lands at index 0 and was handed alpha's key, while its own was lost. Reordering swapped them the same way. Before collections were traversed at all the value came back in plain text, so this is a regression introduced by that traversal rather than a pre-existing problem. Elements that expose a non-empty getName() are now keyed by it, and only those without one fall back to position. The same key feeds the secret ids built for external secret managers, so encrypt and delete stay aligned. Both scenarios are covered by tests that fail against positional keys. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The first version of the check took bare identifiers only, which would have rejected configurations that were previously valid: Postgres needs quoting for relation names that are case-sensitive or contain spaces, and the field is documented as a fully qualified name of a view or table. A double-quoted part is now accepted on either side of the dot. It cannot be used to break out, since the closing quote has to be followed by end-of-string or ".<part>" and "" is an escaped quote, so the value stays a relation reference. Also switches the annotation to "str | None" for ruff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…irst Assets are looked up by FQN and asset type, neither of which pins the parent entity type, so a single page can span more than one parent entity. Authorizing the first asset therefore did not establish access to the rest of the response. Each distinct parent is now authorized. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Pushed four commits addressing the review. Reverted the URL-validation commit ( Collection secrets are keyed by element identity, not position ( Quoted relation names are accepted again ( Attachment listings authorize every distinct parent ( On DNS rebinding: not addressed here, because the code it applied to is reverted. Worth carrying into #33439 though — resolving at validation time does not bind the address the client later connects to, and closing it properly means pinning the resolved address into the HTTP client rather than re-resolving by hostname. On redirects skipping validation: same, it belongs with #33439. The Jersey client in Checks: 59 Java tests green across the masker, secrets-manager and URL-validator suites, Two things still open that I have not resolved:
|
…t is unique Keying purely by name traded one failure for another. The mcpServerConfig schema requires a name but does not constrain it to be unique, so two elements sharing one produced the same key: the second overwrote the first in the password map and in the secret store, and both entries then restored to the survivor's value. Keys are now resolved per collection. A name is used only where it occurs once; duplicates and unnamed elements fall back to position, prefixed so a positional key can never collide with a name. Position is the best available answer for elements that are genuinely indistinguishable - what it must not do is silently merge them. Covered by a test that fails without the uniqueness check, restoring beta's key onto alpha. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
…d-validation-gaps
|
Merged latest On the visual-regression failure — it is the known data-quality flake, not this PR.
This PR cannot affect that page:
(Corrected: an earlier version of this comment described the failure as a timeout rather than a pixel diff. It is a pixel diff; the 15000ms is the retry window it kept differing through. The matching pixel count is the stronger evidence.) No snapshot was re-baselined, deleted or skipped here; the fix comes entirely from Still green locally after the merge: 60 Java tests across the masker, secrets-manager and URL-validator suites, On A maintainer needs to either add the |
|
✅ SSO Login Nightly — PASSED View workflow run · Commit Totals: 28 passed · 0 failed · 0 flaky · 0 skipped · duration 2m 52s |
|
The failing step is So it is an accounting gap, not a failure: the plan carried 4546 tests and the timing artifacts account for 4481 ( I re-ran it once with Worth noting it is not unique to this PR — #33734 currently shows the same |
Code Review ✅ Approved 2 closed / 2 findings🔴 High risk · Adds authorization checks and outbound URL validation across backend services Fixes secret masking for nested collection fields, validates outbound URLs and query sources, and enforces authorization on attachment metadata endpoints. Duplicate collection element names that could collide on secret key have been resolved. ✅ 2 closed✅ Edge Case: Duplicate collection element names collide on secret key
Closed: Edge Case: Index-based secret keys misassign on collection edits
OptionsDisplay: compact → Counting what did not apply, without listing it. 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:
Five related gaps in how connection secrets are masked and how externally-supplied
values are validated before use. They are grouped because the first two share a root
cause and the third fixes two call sites of one helper.
Secret masking skipped collections.
PasswordEntityMaskerandSecretsManageronlyrecursed into OpenMetadata objects, so a password field declared inside a JSON-schema
array —
mcpConnection.servers[].apiKey,testSuitePipeline.serviceConnections[]— wasnever visited: a
Listis neither an OpenMetadata object nor an annotated leaf, so thewalk stopped. Those fields were returned unmasked and stored unencrypted.
Three fields were missing
"format": "password".awsSessionToken, FivetranapiKeyand GCPprivateKeyIdhad no annotation, soPasswordAnnotatornever emitted@PasswordFieldand the masker treated them as ordinary strings — while their siblingsawsSecretAccessKey,apiSecretandprivateKeywere masked.URLValidatornever resolved the host. It matched a regex against the literal hoststring, so anything not already written as a private IP passed:
0.0.0.0,localhost,and any hostname pointing into the internal network. Separately, the governance webhook
sink checked only that its endpoint was non-empty and ran no URL validation at all.
queryStatementSourcewas interpolated verbatim into theFROMclause of thePostgres query-history SQL, at both the test-connection check and the usage query parser,
which left the rest of the statement open to being rewritten.
Two attachment endpoints checked nothing.
getAssetByIdandlistAttachmentsByFqnreturned an attachment's filename, content type, size and parent entity link without
authorization, while
downloadAssetanddeleteAttachmentresolved the parent entityand checked
VIEW_BASICagainst it.Type of change:
High-level design:
Touches 14 files across three modules, so briefly:
One traversal, three walkers. Rather than adding a collection branch to each of
maskPasswordFields/unmaskPasswordFields/buildPasswordsMap, they now share asingle walker with a visitor. That matters for correctness, not just duplication: mask
and unmask are a matched pair, and if they derived collection keys differently,
unmasking would fail to find a stored secret and would overwrite it with the mask
value. Sharing the traversal makes divergence impossible. The same reasoning applies to
SecretsManager, where encrypt and delete must derive identical secret ids or removinga service would strand its secrets in the store.
URLValidatorkeeps the regex as a pre-filter rather than replacing it, because itcovers IPv6 unique-local
fc00::/7, whichInetAddress.isSiteLocalAddress()does not.A host that fails to resolve is allowed through rather than rejected — rejecting would
make validation depend on DNS being reachable, which breaks air-gapped deployments and
the existing tests that use non-resolving hostnames, and an unresolvable host is
unreachable by the outbound request anyway. This narrows rather than removes the
rebinding window: the name is resolved again when the request is issued. Pinning the
validated address into the HTTP client would close it and is a larger change.
queryStatementSourceis validated, not quoted. It names a relation, so it cannotbe bound as a parameter. An allowlist of fixed names was rejected because the field's
own schema description documents custom views; requiring an optionally
schema-qualified identifier preserves that while leaving no room for anything else.
Matched with
fullmatchrather than an anchored pattern, since$would also accept atrailing newline.
Attachment authorization is one extracted helper, so the four endpoints cannot drift
apart again.
Tests:
Use cases covered
correctly through mask → unmask
0.0.0.0,localhostand[::]are rejected as outbound URL targetsqueryStatementSourceacceptspg_stat_statementsandmy_schema.custom_pg_stat_statements, and rejects statement-rewriting inputUnit tests
testArrayNestedSecretIsMaskedAndRoundTripstoTestEntityMaskertestHostsResolvingToPrivateAddressesBlockedandtestUnresolvableHostIsNotRejectedtoURLValidatorTestingestion/tests/unit/topology/database/test_postgres_query_statement_source.pyBoth new Java tests were confirmed to fail against the unpatched code and pass with it.
Full run over the masker, secrets-manager and URL-validator suites: 74 tests, 0 failures.
Backend integration tests
the added check is a no-op, since
OrganizationPolicygrantsViewAllon allresources to every user, so demonstrating it requires an IT that installs a
restrictive policy first. Flagging rather than skipping quietly.
Ingestion integration tests
test above.
Playwright (UI) tests
Manual testing performed
Covered by the unit tests above. The Python test file was written but not executed
locally — this worktree has no virtualenv and the system interpreter lacks the
dependencies; the validator logic itself was verified by executing the shipped source
directly against the accept/reject cases listed above.
UI screen recording / screenshots:
Not applicable.
Checklist:
annotation only. Worth noting though: values already stored for those three fields
remain unencrypted at rest until the service is next saved. They are masked from API
responses immediately, and plaintext reads back correctly because
Fernet.isTokenizedreturns false for it, so nothing breaks — but a re-encryptionpass would be a reasonable follow-up.
🤖 Generated with Claude Code
The PR does not appear safe to merge while collection-secret identity and outbound DNS rebinding remain unresolved.
Findings
Summary
This PR expands collection-aware secret masking and storage, annotates previously unprotected credentials, validates PostgreSQL query-history relation names, strengthens outbound URL handling, and applies parent-entity authorization to attachment metadata endpoints.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Stored connection configuration] --> B[Collection walker] B --> C[Derive unique-name or positional key] C --> D[Mask API response] C --> E[Restore masked values on update] C --> F[Encrypt or delete external secret] G[Configured outbound URL] --> H[Save-time validation] H --> I[Filtered HTTP client] I --> J[Connection-time validation] J --> K[Outbound request]Reviews (8) · Last reviewed commit: "Merge branch 'main' into fix/secret-mask..."