Repository navigation
[improvement](fe) Improve audit logs for S3 streaming insert jobs - #67489
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
/review |
|
run buildall |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Adds internal query audit logging for S3 streaming insert tasks so audit events capture resolved S3 file paths (post-wildcard expansion) while masking sensitive TVF properties; also records audit events for both success and failure cases. CDC streaming insert behavior remains unchanged (no internal audit events).
Changes:
- Emit internal INSERT audit events for S3 streaming insert tasks with rewritten S3 URI and masked TVF properties.
- Ensure failed S3 streaming inserts also generate error audit events.
- Add regression/unit tests validating S3 audit emission and CDC non-emission.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertTask.java | Adds audit-enabled path for S3 streaming inserts, constructs masked/re-written audit SQL, and logs audit events on completion/failure. |
| fe/fe-core/src/test/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertTaskAuditTest.java | Introduces tests to assert S3 audit events are emitted (success/failure) and CDC tasks do not emit audit events. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Automated review status: complete after round 2 convergence. I am requesting changes for two distinct audit-correctness defects described inline.
Critical checkpoints:
- Goal and functional correctness: S3-only gating, success/error state capture, and CDC exclusion are generally coherent, but valid S3 inputs can either lose the required audit event or retain the unresolved wildcard beside the resolved URI.
- Lifecycle, concurrency, and error handling: I traced setup, each retry attempt, success, existing and synthesized ERR states, cancellation, cleanup, and asynchronous event ownership. Each command attempt reaches the audit finally block, the public audit helper contains its own failures, and the queued event does not retain task-owned context. No additional distinct lifecycle defect remained.
- SQL reconstruction and sensitive data: recognized credential aliases remain masked, but the rewritten property map is a display representation rather than reparsable SQL. This causes the P1 event-loss finding; case-preserving URI rewriting causes the separate P2 accuracy finding.
- Scope, parallel paths, compatibility, and performance: CDC behavior is unchanged. No persistence, protocol, configuration, migration, or material performance regression is introduced by this two-file change.
- Tests: the new unit tests cover basic S3 OK/ERR events and CDC non-emission, but they inject a lowercase, syntax-neutral rewritten map and therefore miss both accepted defects. Per the review-run instructions, I did not run builds locally. Live CheckStyle passed; FE UT, compile, and performance checks were still pending at submission time.
- Existing review context: all three existing inline threads were treated as duplicate fences and were not repeated.
User focus: no additional focus was supplied, so the full PR was reviewed.
TPC-H: Total hot run time: 16893 ms |
TPC-DS: Total hot run time: 82110 ms |
ClickBench: Total hot run time: 14.51 s |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
|
/review |
There was a problem hiding this comment.
Overall: request changes. One distinct P1 remains on the reviewed head; previously raised quote escaping, cancellation/finally isolation, replacement cardinality, URI case handling, and CDC-test concerns were treated as duplicate fences and were not repeated.
Finding
- The new audit reconstruction mixes ANTLR code-point coordinates with Java UTF-16 string indexes. A valid supplementary-Unicode S3 key can therefore suppress the audit event for a successful load or leave its final statement malformed.
Checkpoint conclusions
- Goal/data correctness and special cases: ordinary BMP-only S3 success/error attempts preserve final state, timestamp, executor statistics, resolved file URI, and sensitive-value masking. The Unicode range failure prevents the audit feature from being correct for all admitted S3 object keys.
- Concurrency, lifecycle, and transactions: each retry builds fresh context/command/executor/audit state, and auditing happens after the INSERT execution path. The concrete cancellation cleanup race is already covered by an existing thread. No additional transaction, lock-order, or unbounded-retention issue survived review.
- Configuration, compatibility, storage, and performance: no configuration, persisted format, FE/BE protocol, rolling-upgrade, or storage-layout change is introduced. The additional parsing/rendering is per S3 batch; no separate performance defect was substantiated.
- Tests: the new FE unit test covers S3 success/failure events, internal classification, resolved URI, masking, timestamp, URI case folding, and unchanged CDC behavior. Its reflective setup and ASCII-only fixture miss the reported Unicode failure. Per the review-runner instructions, I did not run builds or tests.
- Scope, parallel paths, and focus: the production change is focused on S3 audit emission; CDC remains unchanged. No additional user-provided review focus was supplied, so the full PR was reviewed.
Review completeness: complete after two rounds of whole-PR and risk-focused review; no unresolved candidates remain.
TPC-H: Total hot run time: 16576 ms |
TPC-DS: Total hot run time: 82031 ms |
ClickBench: Total hot run time: 14.65 s |
|
run p0 |
1 similar comment
|
run p0 |
FE Regression Coverage ReportIncrement line coverage |
1 similar comment
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
|
run buildall |
|
run external |
TPC-H: Total hot run time: 16924 ms |
TPC-DS: Total hot run time: 82668 ms |
ClickBench: Total hot run time: 14.75 s |
FE Regression Coverage ReportIncrement line coverage |
|
run external |
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
…7489) ### What problem does this PR solve? Problem Summary: S3 streaming insert tasks execute internal INSERT statements without emitting query audit events. This makes it difficult to identify the exact files imported after wildcard paths are resolved. This change emits internal audit events only for S3 streaming insert tasks. The audited statement contains the rewritten S3 URI and masks sensitive TVF properties. Both successful and failed executions are recorded. CDC streaming insert tasks keep the existing behavior and do not emit these audit events.
### Background Catalog output exposes safe connector locations. S3 streaming audit statements retain the files selected for each attempt, using escaped batch syntax. ### What problem does this PR solve? Issue Number: None Related PR: apache#67489 (resolved streaming audit inputs) PR Type: Bugfix Problem Summary: The generic address sanitizer hides supported local ADBC paths, SQLite file URIs, ViewFS locations and resolved S3 audit batches. Preserve these locations while applying credential rules at final output. | Input | Before | After | |---|---|---| | `driver_url=/opt/example/libdriver.so` | `*XXX` | Original absolute path | | `uri=file:/data/example/catalog.db` | `*XXX` | Original file URI | | `fs.defaultFS=viewfs://example-cluster` | `*XXX` | Original ViewFS location | | Final streaming audit URI | `*XXX` | Selected filenames with credentials sanitized | ### Details - **Change map:** Production +148/-25 across six files; tests +174/-16 across four. Shared masking handles local/ViewFS forms and resolved singleton paths; streaming snapshots selected files and uses a scoped final audit renderer. No generated, persistence, configuration or submodule changes. - **Frequency:** Always for the supported locations above; reproduced by final-event and property assertions. - **Root cause:** Host-based URI validation rejects authority-free file paths and unsupported ViewFS schemes. Re-parsing a generated glob/list as a generic URI loses the trusted singleton structure. - **Why existing tests missed it:** Streaming tests accepted hidden final URIs and inspected batches only before final masking. Property and SQL audit tests omitted local/ViewFS forms. Existing ADBC metadata tests already assert local visibility, but were not part of prior local validation. - **Fix:** Recognize absolute local driver paths and authority-free absolute file URIs; admit ViewFS under the HDFS policy. Snapshot selected singleton paths, sanitize each independently, and assemble escaped batch display at audit emission. Keep current name/JDBC/query/signature rules and sanitize all other TVF properties. - **Other paths and branches:** SHOW, catalogs(), lineage and property audit callers share the location rules. Success, failure and notification streaming events use the same renderer. Ordinary SQL/catalog URI lists remain conservatively masked. Only master changes; these regressions originate in this unmerged PR and have not been introduced into release branches. - **Behavior change:** Safe locations become visible again. Signed, unknown, nested and ambiguous connection values remain masked. No connection or execution inputs change; no new network requests occur. ### Testing | Check | Result | |---|---| | Before fix | 37 tests/3 classes run, 9 assertion failures, no errors/skips | | Literal filename renderer probe | Reproduces lost selected filenames before the singleton-path refinement; passes afterward | | Final repository FE runner | 553 tests/47 classes pass, no failures/errors/skips; includes streaming/audit helpers, offset/event providers, ADBC properties/resolver, shared masking, lineage and prior provider/config coverage | | FE Checkstyle | Pass | | SQL regression | Extended SHOW, catalogs() and persisted audit assertions; not executed locally without a cluster | ### Notes for Reviewers The scoped renderer runs only for internally prepared S3 streaming tasks. Ordinary SQL callers keep the default audit encryption path. Current name rules apply when publishing; ambiguous or signed selected inputs mask the entire batch. Literal path handling does not add a SQL-visible masking bypass. ### Release note Preserve supported local, file and ViewFS locations in masked output, and retain sanitized selected filenames in S3 streaming audit events. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: No (restores supported locations; full masking rules are documented in the PR). - Pre-submission status: Partially verified: cluster SQL regression not executed locally. ### AI Disclosure - Tool: Codex (GPT-6). - Generated: Production changes, tests and this description. - Human review: not stated. - Prompts: Fully fix the remaining PR comments and review the changes again.
…70705) ### Background External catalogs retain connector properties. Provider declarations feed the masking registry used by display, metadata and audit SQL. ### What problem does this PR solve? Issue Number: None Related PR: #70338 (provider-owned masking and ALTER CATALOG audit coverage), #70696 (overlapping metastore URI annotation fix), #55016 (all-FE configuration forwarding), #67489 (resolved streaming audit inputs) PR Type: Bugfix Problem Summary: Name-only matching exposes JDBC/URL and SDK/Hadoop credentials. Apply shared value-aware masking and a supplementary FE-local name regex, completing diagnostic annotations. An exercised `uri` value: | Before | After | |---|---| | `https://fixture:fixture-password@api.example.com/v1?region=east&token=fixture-token` | `https://api.example.com/v1?region=east&token=*XXX` | ### Details - **Change map:** Production: +514/-44 across 28 files; tests: +1237/-76 across 30; CI: +9/-0 in one. No generated/docs/submodule changes. Production covers shared masking, provider annotations, configuration forwarding and structured streaming audit rendering. - **Frequency:** Always when a retained credential uses one of the uncovered names or connection formats; reproduced in property display and CREATE/ALTER audit rewriting. - **Root cause:** `DatasourcePrintableMap` checked names without inspecting values; credential declarations were incomplete. Generic URI parsing also hid local files, ViewFS and resolved streaming batches; configuration forwarding lost SQL escapes. - **Why existing tests missed it:** Property tests missed format-specific locations; streaming assertions had accepted hidden final URIs. SQL audit tests missed these formats; existing ADBC metadata tests already require visible local paths. Admin tests missed string escaping. - **Fix:** Share catalog/audit/lineage masking, complete credential annotations and distinguish diagnostic URIs; preserve supported locations and independently sanitize selected streaming files at final audit emission; quote forwarded configuration strings correctly. - **Other paths and branches:** Shared output callers inherit the rules. Cached branch-3.1/4.0/4.1/4.2 retain the parsing gap; only master changes. No single introducing PR was identified. - **Configs and defaults:** `datasource_sensitive_property_pattern` is FE-local, mutable and case-insensitive, defaulting to `password|passwd|secret|token|credential|access[._-]?key|api[._-]?key`. Startup/custom-file/runtime validation rejects invalid stored expressions without replacing the previous value. `(?!)` disables only the supplement; empty matches every name. Configure all serving FEs consistently. - **Behavior change:** Stored properties and connections are unchanged. Display is more conservative: keyword matches can hide metadata, and URLs can lose userinfo/fragments or normalize query separators. The complete masking rules are: | Input | Output rule | |---|---| | Existing exact sensitive keys and provider prefixes | Remain masked, independently of the configurable pattern. Existing hidden-property rules still omit their entries. | | Recognizable JDBC property names | Names ending in a JDBC `url`/`uri` component, including `jdbc_url`, `jdbc.jdbc_url`, `iceberg.jdbc.uri`, and `paimon.jdbc.uri`, mask completely. `connectionString`, `connection_string`, `connection-string`, and `connection.string` suffixes also mask completely. | | JDBC values under any name | Any trimmed value beginning with `jdbc:`, case-insensitively, masks completely, including a bare `uri` alias and opaque/driver-specific JDBC syntax. | | Native SDK credentials | Bare or dot/underscore/hyphen-delimited final components `token`, `credential`, or `credentials` mask completely. Registered aliases and the configurable pattern add coverage. | | Hadoop credentials | The built-in families below mask completely, including dynamic bucket/account names and names prefixed before `fs.`; they do not depend on the configurable pattern. Other credential-like names receive the default pattern's protection. | | Custom names | A match against the configured regex masks the entire value. Matching is a search, so the default protects `custom.password`, `clientSecret`, and `custom.accessKey`. It is unioned with every permanent rule. | | Ordinary addresses | Hostnames, IPv4, bracketed IPv6, optional numeric ports in 0–65535, and comma-separated host lists remain visible. Empty address values stay empty. | | URL selection | Sanitize properties ending in a delimited `uri/url/host/endpoint/address` component, including plural forms, and hierarchical `scheme://` or `file:/`, `hdfs:/`, `viewfs:/` values under other names. A name already classified sensitive takes precedence and masks completely. | | Supported URL schemes | `http`, `https`, `thrift`, `hdfs`, `viewfs`, `file`, `s3`, `s3a`, `s3n`, `oss`, `cos`, `cosn`, `obs`, `gs`, `abfs`, `abfss`, `wasb`, `wasbs`. Preserve the host, port, ordinary path, and non-sensitive query parameters; remove authentication userinfo (Azure exception below) and the entire fragment. | | Local driver paths and file URIs | Recognized `driver_url` suffixes retain absolute POSIX paths, including spaces/Unicode; protocol-relative, control, query, fragment, userinfo, matrix or nested-URL syntax masks completely. Hierarchical `file:/absolute/path` and `file:///absolute/path` retain their spelling, require no authority, and use the common query/signature/fragment rules. Name/JDBC masking takes precedence. | | Native filesystem locations | `viewfs://mount-name/path` accepts validated ordinary-address authority syntax, including ASCII underscore mount names, with numeric-port checks; it names a logical mount table rather than requiring a DNS host. Hierarchical absolute `hdfs:/path`, `hdfs:///path` and `viewfs:///path` can omit authority and retain their slash form, using configured nameservice/default-mount semantics. GCS `gs://` authorities require 3–222 lowercase ASCII letters/digits/dots/underscores/hyphens, start/end with a letter/digit, and dot-separated components at most 63 characters; ports, escaping and other syntax mask completely. This accepts underscores rather than imposing DNS-host syntax; remove authentication userinfo and retain common query/path/signature checks. This is display-safety validation, not bucket-creation policy. HTTP/S3 host validation remains strict. [GCS naming rules](https://docs.cloud.google.com/storage/docs/buckets). | | Resolved S3 streaming audit inputs | Snapshot task-selected files; sanitize each singleton location independently, then assemble the existing escaped batch syntax. Preserve selected filenames in final success/failure/notification audit events, including tested literal commas, braces, brackets, backslashes, spaces, hashes, percent text and plus signs. Already-decoded selected keys treat `#` literally, including in query-shaped suffixes; temporary URI encoding is only for validation. Native path text is already decoded, so literal `%`, `%HH` and `+` are preserved without another decoding or URI-encoding-layer check. Native query-shaped suffixes preserve non-secret separator spelling, empty components and raw values. Whole-suffix temporary encoding is only for URI validation; names/signatures retain shared rules, while value inspection checks raw and at most three percent-decoded views (including form spaces) and masks residual encoding. Matrix/nested/list-shape path guards and unknown-name masking remain. Ordinary URL fragments still disappear. Query credentials/signatures retain their common policy. Any signed/unreliable location masks the entire batch. Apply current name rules and sanitize all other TVF properties at emission; execution inputs remain unchanged. Release temporary map/list snapshots on the worker after synchronous emission, including failure and early cancellation. This exception is internal and does not admit untrusted catalog/SQL URI-list strings. | | Azure storage locations | For `abfs`, `abfss`, `wasb`, and `wasbs` (case-insensitive), retain `container@host` after validating the raw container with the existing `AzureUri` grammar: one character for compatibility, or 3–63 lowercase ASCII letters/digits/hyphens, beginning and ending with a letter/digit. Missing, encoded, malformed or password-bearing containers mask the whole URI. Path/query checks and signed-URL masking still apply. | | URL query credentials | Decode parameter names, process duplicates and both `&`/`;` separators, and mask values whose names match permanent/configured rules or contain `password/passwd/pwd/secret/token/credential`, access/API/account/private/auth/app/application key variants, or `authorization`; exact `auth` and `key` are also protected. Ordinary URL query separators render as `&`; native selected-key suffixes retain their separators and empty components; decoded names must use ASCII letters/digits, dot, underscore, tilde, or hyphen. | | Signed URLs | A decoded query name containing `signature`, or a delimited `sig`/`sas` component, masks the entire URL, including AWS/GCS/OSS/CloudFront signatures and Azure SAS. | | Unreliable address parsing | For ordinary URL/address inputs, unknown schemes, opaque/invalid URLs, invalid host/port or escaping, unrecognized query names, matrix path parameters, repeated encoding, and nested connection strings in otherwise unclassified query values, including whitespace/form-space-prefixed JDBC, mask completely. Outside the structured streaming path above, any comma-containing URL masks completely, including ordinary query commas; decoded paths containing commas or nested `://` also mask completely. Valid plain host:port lists remain visible. No raw-value or parser-exception fallback is logged. | | All-FE configuration SQL | `ADMIN SET ALL FRONTENDS CONFIG` quotes decoded names and values according to the forwarded `sql_mode`; regex backslashes and quotes survive peer reparsing in default and `NO_BACKSLASH_ESCAPES` modes. | | Typed URI diagnostics | Iceberg/Paimon JDBC and REST URI fields, including the shared `uri` alias, use `sensitive=true, sensitiveInDiagnosticsOnly=true`: non-empty diagnostic values render as `***`, empty values as `<empty>`. They do not export URI aliases into the global secret-name registry; catalog output follows the value-aware rules above. | | Credential annotations | Access keys and every declared alias in S3, MinIO, GCS, OSS, COS, OBS, Iceberg Glue and Iceberg REST now join existing secret/token annotations; Ozone access keys and JDBC catalog URLs remain protected. These declarations mask typed diagnostics and contribute unconditional provider-sensitive names. These annotation additions do not reclassify account names, OAuth modes/scopes or credential-file paths; generic name rules can independently mask such names. | Permanent Hadoop families, matched case-insensitively: | Namespace | Credential fields | |---|---| | `fs.s3.` / `fs.s3a.` and optional `bucket.<bucket>.` | `access.key`, `secret.key`, `session.token`, `encryption.key`, `server-side-encryption.key`, `proxy.password`; dotted bucket names are supported. | | `fs.azure.` | `account.key`, `sas`, `sas.fixed.token`, `account.oauth2.client.secret`, `account.oauth2.refresh.token`, `encryption.encoded.client-provided.key`, including account/container suffixes. | | `fs.adl.oauth2.` | `credential`, `refresh.token`. | | `fs.oss.` | `accessKeyId`, `accessKeySecret`, `securityToken`. | | `fs.cosn.` with optional `userInfo.` | `secretId`, `secretKey`. | | `fs.obs.` | `access.key`, `secret.key`, `session.token`, `security.token`. | Masking uses `*XXX` in property output. Lineage continues omitting name-classified secrets and sanitizes other values. Non-empty annotated credentials render as `***` in typed diagnostics. The retained `mc.session_token` declaration does not add token authentication to the current binder. ### Testing - `run-fe-ut.sh` passes all 565 tests in 47 selected classes locally: masking/audit/lineage, configuration, metastore/filesystem holders, actual provider registration, security/metadata/plugin surfaces, dispatch, S3 offsets, ADBC paths, audit publication and config SQL roundtrips. Coverage includes URL lists, encoded/duplicate/signed URLs, 5,001-host lists, dynamic rules and unchanged connection values. FE Checkstyle passes. - Extended the P0/nonConcurrent SQL audit suite with SHOW, `catalogs()`, and persisted CREATE/ALTER assertions. It was not executed locally; the regular P0 configuration includes it, while cloud P0 skips nonConcurrent suites. | CI check | Evidence | |---|---| | Initial policy/annotation baselines | Before the policy change, 8 of 9 new tests expose credentials; the safe-endpoint control passes. Before the JDBC annotation, 2 of 18 tests fail. S3/Iceberg annotation tests reproduce 5 failures; Paimon separately reproduces 2. The multi-URL baseline exposes its later password. | | Configuration trimming | A targeted test reproduces a regex accepted before trimming that becomes invalid when stored. | | Azure container regression | Before the fix, 18 tests/2 classes reproduce 5 assertion failures: container loss in property display, token-query URLs, CREATE/ALTER audit and lineage, plus malformed authority passing through. New cases cover all four schemes, uppercase scheme, container length/character boundaries, encoded/password-bearing authority, query credentials and SAS signatures. The final expanded FE run passes all 565 tests/47 classes; the existing AzureUri parser suite is included. | | Existing FE integration tests | The previous head reproduces all 7 CI failures in 39 tests/4 classes. Provider fixtures use opaque names to prove admission independently of the generic regex. Final streaming audit assertions now require resolved batches, replacing the incomplete expectation that their URIs should be hidden. Malformed hosts and CREATE/ALTER JOB JDBC URLs remain masked. | | Location compatibility | Before this follow-up, 37 tests/3 classes reproduce 9 failures across final streaming events, local paths and lineage. A separate renderer probe reproduces literal-filename loss before its fix and passes afterward. Final tests cover one/multiple files, failed tasks, notifications, signed/embedded credentials, literal filenames, runtime rule changes, local/file URI rejection boundaries and ViewFS. | | Native locations and snapshot lifetime | Actual formatter probe reproduces three valid native locations masking; five focused methods reproduce five assertion failures in property/lineage and successful, failed and canceled task snapshot ownership. Added positive native audit/lineage cases, credential/signature/opaque/invalid-S3 controls and post-run release assertions. Final repository FE run passes 565 tests/47 classes; the same five focused methods and the actual native/literal renderer probes pass; Checkstyle passes. | | Literal hash identities | Before the fix, the actual final renderer collapses two selected hash keys to identical names. Before the fix, six focused methods execute: four expected hash/notification/credential/signature assertion failures and two existing controls pass. Tests require distinct hashes for one/multiple selected files on success/failure, notifications and query-shaped suffixes; ordinary URI fragment removal remains covered. Final FE run passes 565 tests/47 classes; Checkstyle and all original probes pass. Before its fix, a self-review probe initializes the pinned Hadoop ViewFileSystem with mount_table but observes MASK in display; named-ViewFS property/audit/lineage and malformed/encoded/port/signature controls now cover the repaired authority branch. | | Decoded native percent paths | Before the fix, the actual final renderer masks a batch containing100%.csv; four focused methods reproduce two percent failures with two existing controls passing. Tests add native percent/nonhex/%HH/repeated-looking/plus identities for one/multiple files, success/failure and notifications, with generic URI negative controls. Final repository FE run passes 565 tests/47 classes; the same percent renderer probe and four focused methods pass. Checkstyle passes. | | Independent local review | Qualified gpt-6-astra/xhigh lead and coverage reviewers approve exact head5a39cd98f66872ce9502f636d617bdae565ca5c5:59 changed files,17 checkpoints,0 findings/regressions,one-round convergence. [Commit-bound PASS receipt](#70705 (comment)). Static review is separate from the author-run tests above; cluster SQL/multi-FE RPC remain unverified. | | Native suffix spelling and inspection | Before repair, six focused methods produce four identity/credential/opaque-JDBC failures and two passing controls. Cases cover separator/empty-component identity, percent/space/plus/encoded-looking values, final success/failure/notification events, masked values with preserved non-secret syntax, and encoded/double/deep nested URLs beside malformed native percent text. A separate form-space JDBC guard fails before its repair. Final repository FE run passes 565 tests/47 classes; all seven focused identity/security/control methods and independent Checkstyle pass. | | GCP metadata | Identity roundtrips run with the supplementary pattern disabled using `(?!)`; permanent HMAC keys remain masked. A separate credential-keyword test checks that `gs.credential_provider_type` is masked, matching the default heuristic's conservative treatment of metadata names. The original pattern is restored after each test. | | Gitleaks 8.30.0 | The Gitleaks job scans the full PR commit range and misclassifies two adjacent Hadoop property-name literals as API-key values. The same scan reproduces 2 findings before the config fix and 0 after it. A generic-api-key exception requires both the exact test path and one of two exact synthetic property names. | | All-FE regex forwarding | Before the serializer fix, 2 of 9 admin-config tests fail: the peer exposes `custom.pin1`, and the regex loses its backslash. After the fix, all 9 pass; actual parser/serializer/Env application plus masking and a literal matrix cover both SQL modes and command scopes. Peer application is simulated in-process, without multi-FE RPC. | | Exception boundaries | Two fixture-name occurrences in another file and an unrelated synthetic API-key value in the allowed file remain detected; only the two intended occurrences are ignored. | ### Notes for Reviewers The new defaulted `ConnectorProperty.sensitiveInDiagnosticsOnly` metadata prevents shared URI aliases from hiding every REST endpoint. Connector/metastore SPI signatures and baselines are unchanged. Free-text secrets, SDK containers and unrelated logging remain outside scope. ### Release note External data source displays and audit property output now mask JDBC connection strings, native SDK/Hadoop credentials, credential-like custom properties, and URL authentication components. The new FE configuration `datasource_sensitive_property_pattern` adjusts extra name matching without disabling permanent credential rules. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: Yes (document the FE config and catalog-output rules in apache/doris-website; detailed rules are included above). - Pre-submission status: Partially verified: SQL regression and multi-FE RPC not executed locally. ### AI Disclosure - Tool: Codex (GPT-6). - Generated: Production changes, tests, and this description. - Human review: not stated. - Prompts: Mask MaxCompute/Ozone credentials, extend shared JDBC/URL/SDK/Hadoop/custom-name rules, then complete sensitive annotations and address review findings.
…pache#70705) External catalogs retain connector properties. Provider declarations feed the masking registry used by display, metadata and audit SQL. Issue Number: None Related PR: apache#70338 (provider-owned masking and ALTER CATALOG audit coverage), apache#70696 (overlapping metastore URI annotation fix), apache#55016 (all-FE configuration forwarding), apache#67489 (resolved streaming audit inputs) PR Type: Bugfix Problem Summary: Name-only matching exposes JDBC/URL and SDK/Hadoop credentials. Apply shared value-aware masking and a supplementary FE-local name regex, completing diagnostic annotations. An exercised `uri` value: | Before | After | |---|---| | `https://fixture:fixture-password@api.example.com/v1?region=east&token=fixture-token` | `https://api.example.com/v1?region=east&token=*XXX` | - **Change map:** Production: +514/-44 across 28 files; tests: +1237/-76 across 30; CI: +9/-0 in one. No generated/docs/submodule changes. Production covers shared masking, provider annotations, configuration forwarding and structured streaming audit rendering. - **Frequency:** Always when a retained credential uses one of the uncovered names or connection formats; reproduced in property display and CREATE/ALTER audit rewriting. - **Root cause:** `DatasourcePrintableMap` checked names without inspecting values; credential declarations were incomplete. Generic URI parsing also hid local files, ViewFS and resolved streaming batches; configuration forwarding lost SQL escapes. - **Why existing tests missed it:** Property tests missed format-specific locations; streaming assertions had accepted hidden final URIs. SQL audit tests missed these formats; existing ADBC metadata tests already require visible local paths. Admin tests missed string escaping. - **Fix:** Share catalog/audit/lineage masking, complete credential annotations and distinguish diagnostic URIs; preserve supported locations and independently sanitize selected streaming files at final audit emission; quote forwarded configuration strings correctly. - **Other paths and branches:** Shared output callers inherit the rules. Cached branch-3.1/4.0/4.1/4.2 retain the parsing gap; only master changes. No single introducing PR was identified. - **Configs and defaults:** `datasource_sensitive_property_pattern` is FE-local, mutable and case-insensitive, defaulting to `password|passwd|secret|token|credential|access[._-]?key|api[._-]?key`. Startup/custom-file/runtime validation rejects invalid stored expressions without replacing the previous value. `(?!)` disables only the supplement; empty matches every name. Configure all serving FEs consistently. - **Behavior change:** Stored properties and connections are unchanged. Display is more conservative: keyword matches can hide metadata, and URLs can lose userinfo/fragments or normalize query separators. The complete masking rules are: | Input | Output rule | |---|---| | Existing exact sensitive keys and provider prefixes | Remain masked, independently of the configurable pattern. Existing hidden-property rules still omit their entries. | | Recognizable JDBC property names | Names ending in a JDBC `url`/`uri` component, including `jdbc_url`, `jdbc.jdbc_url`, `iceberg.jdbc.uri`, and `paimon.jdbc.uri`, mask completely. `connectionString`, `connection_string`, `connection-string`, and `connection.string` suffixes also mask completely. | | JDBC values under any name | Any trimmed value beginning with `jdbc:`, case-insensitively, masks completely, including a bare `uri` alias and opaque/driver-specific JDBC syntax. | | Native SDK credentials | Bare or dot/underscore/hyphen-delimited final components `token`, `credential`, or `credentials` mask completely. Registered aliases and the configurable pattern add coverage. | | Hadoop credentials | The built-in families below mask completely, including dynamic bucket/account names and names prefixed before `fs.`; they do not depend on the configurable pattern. Other credential-like names receive the default pattern's protection. | | Custom names | A match against the configured regex masks the entire value. Matching is a search, so the default protects `custom.password`, `clientSecret`, and `custom.accessKey`. It is unioned with every permanent rule. | | Ordinary addresses | Hostnames, IPv4, bracketed IPv6, optional numeric ports in 0–65535, and comma-separated host lists remain visible. Empty address values stay empty. | | URL selection | Sanitize properties ending in a delimited `uri/url/host/endpoint/address` component, including plural forms, and hierarchical `scheme://` or `file:/`, `hdfs:/`, `viewfs:/` values under other names. A name already classified sensitive takes precedence and masks completely. | | Supported URL schemes | `http`, `https`, `thrift`, `hdfs`, `viewfs`, `file`, `s3`, `s3a`, `s3n`, `oss`, `cos`, `cosn`, `obs`, `gs`, `abfs`, `abfss`, `wasb`, `wasbs`. Preserve the host, port, ordinary path, and non-sensitive query parameters; remove authentication userinfo (Azure exception below) and the entire fragment. | | Local driver paths and file URIs | Recognized `driver_url` suffixes retain absolute POSIX paths, including spaces/Unicode; protocol-relative, control, query, fragment, userinfo, matrix or nested-URL syntax masks completely. Hierarchical `file:/absolute/path` and `file:///absolute/path` retain their spelling, require no authority, and use the common query/signature/fragment rules. Name/JDBC masking takes precedence. | | Native filesystem locations | `viewfs://mount-name/path` accepts validated ordinary-address authority syntax, including ASCII underscore mount names, with numeric-port checks; it names a logical mount table rather than requiring a DNS host. Hierarchical absolute `hdfs:/path`, `hdfs:///path` and `viewfs:///path` can omit authority and retain their slash form, using configured nameservice/default-mount semantics. GCS `gs://` authorities require 3–222 lowercase ASCII letters/digits/dots/underscores/hyphens, start/end with a letter/digit, and dot-separated components at most 63 characters; ports, escaping and other syntax mask completely. This accepts underscores rather than imposing DNS-host syntax; remove authentication userinfo and retain common query/path/signature checks. This is display-safety validation, not bucket-creation policy. HTTP/S3 host validation remains strict. [GCS naming rules](https://docs.cloud.google.com/storage/docs/buckets). | | Resolved S3 streaming audit inputs | Snapshot task-selected files; sanitize each singleton location independently, then assemble the existing escaped batch syntax. Preserve selected filenames in final success/failure/notification audit events, including tested literal commas, braces, brackets, backslashes, spaces, hashes, percent text and plus signs. Already-decoded selected keys treat `#` literally, including in query-shaped suffixes; temporary URI encoding is only for validation. Native path text is already decoded, so literal `%`, `%HH` and `+` are preserved without another decoding or URI-encoding-layer check. Native query-shaped suffixes preserve non-secret separator spelling, empty components and raw values. Whole-suffix temporary encoding is only for URI validation; names/signatures retain shared rules, while value inspection checks raw and at most three percent-decoded views (including form spaces) and masks residual encoding. Matrix/nested/list-shape path guards and unknown-name masking remain. Ordinary URL fragments still disappear. Query credentials/signatures retain their common policy. Any signed/unreliable location masks the entire batch. Apply current name rules and sanitize all other TVF properties at emission; execution inputs remain unchanged. Release temporary map/list snapshots on the worker after synchronous emission, including failure and early cancellation. This exception is internal and does not admit untrusted catalog/SQL URI-list strings. | | Azure storage locations | For `abfs`, `abfss`, `wasb`, and `wasbs` (case-insensitive), retain `container@host` after validating the raw container with the existing `AzureUri` grammar: one character for compatibility, or 3–63 lowercase ASCII letters/digits/hyphens, beginning and ending with a letter/digit. Missing, encoded, malformed or password-bearing containers mask the whole URI. Path/query checks and signed-URL masking still apply. | | URL query credentials | Decode parameter names, process duplicates and both `&`/`;` separators, and mask values whose names match permanent/configured rules or contain `password/passwd/pwd/secret/token/credential`, access/API/account/private/auth/app/application key variants, or `authorization`; exact `auth` and `key` are also protected. Ordinary URL query separators render as `&`; native selected-key suffixes retain their separators and empty components; decoded names must use ASCII letters/digits, dot, underscore, tilde, or hyphen. | | Signed URLs | A decoded query name containing `signature`, or a delimited `sig`/`sas` component, masks the entire URL, including AWS/GCS/OSS/CloudFront signatures and Azure SAS. | | Unreliable address parsing | For ordinary URL/address inputs, unknown schemes, opaque/invalid URLs, invalid host/port or escaping, unrecognized query names, matrix path parameters, repeated encoding, and nested connection strings in otherwise unclassified query values, including whitespace/form-space-prefixed JDBC, mask completely. Outside the structured streaming path above, any comma-containing URL masks completely, including ordinary query commas; decoded paths containing commas or nested `://` also mask completely. Valid plain host:port lists remain visible. No raw-value or parser-exception fallback is logged. | | All-FE configuration SQL | `ADMIN SET ALL FRONTENDS CONFIG` quotes decoded names and values according to the forwarded `sql_mode`; regex backslashes and quotes survive peer reparsing in default and `NO_BACKSLASH_ESCAPES` modes. | | Typed URI diagnostics | Iceberg/Paimon JDBC and REST URI fields, including the shared `uri` alias, use `sensitive=true, sensitiveInDiagnosticsOnly=true`: non-empty diagnostic values render as `***`, empty values as `<empty>`. They do not export URI aliases into the global secret-name registry; catalog output follows the value-aware rules above. | | Credential annotations | Access keys and every declared alias in S3, MinIO, GCS, OSS, COS, OBS, Iceberg Glue and Iceberg REST now join existing secret/token annotations; Ozone access keys and JDBC catalog URLs remain protected. These declarations mask typed diagnostics and contribute unconditional provider-sensitive names. These annotation additions do not reclassify account names, OAuth modes/scopes or credential-file paths; generic name rules can independently mask such names. | Permanent Hadoop families, matched case-insensitively: | Namespace | Credential fields | |---|---| | `fs.s3.` / `fs.s3a.` and optional `bucket.<bucket>.` | `access.key`, `secret.key`, `session.token`, `encryption.key`, `server-side-encryption.key`, `proxy.password`; dotted bucket names are supported. | | `fs.azure.` | `account.key`, `sas`, `sas.fixed.token`, `account.oauth2.client.secret`, `account.oauth2.refresh.token`, `encryption.encoded.client-provided.key`, including account/container suffixes. | | `fs.adl.oauth2.` | `credential`, `refresh.token`. | | `fs.oss.` | `accessKeyId`, `accessKeySecret`, `securityToken`. | | `fs.cosn.` with optional `userInfo.` | `secretId`, `secretKey`. | | `fs.obs.` | `access.key`, `secret.key`, `session.token`, `security.token`. | Masking uses `*XXX` in property output. Lineage continues omitting name-classified secrets and sanitizes other values. Non-empty annotated credentials render as `***` in typed diagnostics. The retained `mc.session_token` declaration does not add token authentication to the current binder. - `run-fe-ut.sh` passes all 565 tests in 47 selected classes locally: masking/audit/lineage, configuration, metastore/filesystem holders, actual provider registration, security/metadata/plugin surfaces, dispatch, S3 offsets, ADBC paths, audit publication and config SQL roundtrips. Coverage includes URL lists, encoded/duplicate/signed URLs, 5,001-host lists, dynamic rules and unchanged connection values. FE Checkstyle passes. - Extended the P0/nonConcurrent SQL audit suite with SHOW, `catalogs()`, and persisted CREATE/ALTER assertions. It was not executed locally; the regular P0 configuration includes it, while cloud P0 skips nonConcurrent suites. | CI check | Evidence | |---|---| | Initial policy/annotation baselines | Before the policy change, 8 of 9 new tests expose credentials; the safe-endpoint control passes. Before the JDBC annotation, 2 of 18 tests fail. S3/Iceberg annotation tests reproduce 5 failures; Paimon separately reproduces 2. The multi-URL baseline exposes its later password. | | Configuration trimming | A targeted test reproduces a regex accepted before trimming that becomes invalid when stored. | | Azure container regression | Before the fix, 18 tests/2 classes reproduce 5 assertion failures: container loss in property display, token-query URLs, CREATE/ALTER audit and lineage, plus malformed authority passing through. New cases cover all four schemes, uppercase scheme, container length/character boundaries, encoded/password-bearing authority, query credentials and SAS signatures. The final expanded FE run passes all 565 tests/47 classes; the existing AzureUri parser suite is included. | | Existing FE integration tests | The previous head reproduces all 7 CI failures in 39 tests/4 classes. Provider fixtures use opaque names to prove admission independently of the generic regex. Final streaming audit assertions now require resolved batches, replacing the incomplete expectation that their URIs should be hidden. Malformed hosts and CREATE/ALTER JOB JDBC URLs remain masked. | | Location compatibility | Before this follow-up, 37 tests/3 classes reproduce 9 failures across final streaming events, local paths and lineage. A separate renderer probe reproduces literal-filename loss before its fix and passes afterward. Final tests cover one/multiple files, failed tasks, notifications, signed/embedded credentials, literal filenames, runtime rule changes, local/file URI rejection boundaries and ViewFS. | | Native locations and snapshot lifetime | Actual formatter probe reproduces three valid native locations masking; five focused methods reproduce five assertion failures in property/lineage and successful, failed and canceled task snapshot ownership. Added positive native audit/lineage cases, credential/signature/opaque/invalid-S3 controls and post-run release assertions. Final repository FE run passes 565 tests/47 classes; the same five focused methods and the actual native/literal renderer probes pass; Checkstyle passes. | | Literal hash identities | Before the fix, the actual final renderer collapses two selected hash keys to identical names. Before the fix, six focused methods execute: four expected hash/notification/credential/signature assertion failures and two existing controls pass. Tests require distinct hashes for one/multiple selected files on success/failure, notifications and query-shaped suffixes; ordinary URI fragment removal remains covered. Final FE run passes 565 tests/47 classes; Checkstyle and all original probes pass. Before its fix, a self-review probe initializes the pinned Hadoop ViewFileSystem with mount_table but observes MASK in display; named-ViewFS property/audit/lineage and malformed/encoded/port/signature controls now cover the repaired authority branch. | | Decoded native percent paths | Before the fix, the actual final renderer masks a batch containing100%.csv; four focused methods reproduce two percent failures with two existing controls passing. Tests add native percent/nonhex/%HH/repeated-looking/plus identities for one/multiple files, success/failure and notifications, with generic URI negative controls. Final repository FE run passes 565 tests/47 classes; the same percent renderer probe and four focused methods pass. Checkstyle passes. | | Independent local review | Qualified gpt-6-astra/xhigh lead and coverage reviewers approve exact head5a39cd98f66872ce9502f636d617bdae565ca5c5:59 changed files,17 checkpoints,0 findings/regressions,one-round convergence. [Commit-bound PASS receipt](apache#70705 (comment)). Static review is separate from the author-run tests above; cluster SQL/multi-FE RPC remain unverified. | | Native suffix spelling and inspection | Before repair, six focused methods produce four identity/credential/opaque-JDBC failures and two passing controls. Cases cover separator/empty-component identity, percent/space/plus/encoded-looking values, final success/failure/notification events, masked values with preserved non-secret syntax, and encoded/double/deep nested URLs beside malformed native percent text. A separate form-space JDBC guard fails before its repair. Final repository FE run passes 565 tests/47 classes; all seven focused identity/security/control methods and independent Checkstyle pass. | | GCP metadata | Identity roundtrips run with the supplementary pattern disabled using `(?!)`; permanent HMAC keys remain masked. A separate credential-keyword test checks that `gs.credential_provider_type` is masked, matching the default heuristic's conservative treatment of metadata names. The original pattern is restored after each test. | | Gitleaks 8.30.0 | The Gitleaks job scans the full PR commit range and misclassifies two adjacent Hadoop property-name literals as API-key values. The same scan reproduces 2 findings before the config fix and 0 after it. A generic-api-key exception requires both the exact test path and one of two exact synthetic property names. | | All-FE regex forwarding | Before the serializer fix, 2 of 9 admin-config tests fail: the peer exposes `custom.pin1`, and the regex loses its backslash. After the fix, all 9 pass; actual parser/serializer/Env application plus masking and a literal matrix cover both SQL modes and command scopes. Peer application is simulated in-process, without multi-FE RPC. | | Exception boundaries | Two fixture-name occurrences in another file and an unrelated synthetic API-key value in the allowed file remain detected; only the two intended occurrences are ignored. | The new defaulted `ConnectorProperty.sensitiveInDiagnosticsOnly` metadata prevents shared URI aliases from hiding every REST endpoint. Connector/metastore SPI signatures and baselines are unchanged. Free-text secrets, SDK containers and unrelated logging remain outside scope. External data source displays and audit property output now mask JDBC connection strings, native SDK/Hadoop credentials, credential-like custom properties, and URL authentication components. The new FE configuration `datasource_sensitive_property_pattern` adjusts extra name matching without disabling permanent credential rules. - Behavior changed: Yes (see Details). - Does this need documentation: Yes (document the FE config and catalog-output rules in apache/doris-website; detailed rules are included above). - Pre-submission status: Partially verified: SQL regression and multi-FE RPC not executed locally. - Tool: Codex (GPT-6). - Generated: Production changes, tests, and this description. - Human review: not stated. - Prompts: Mask MaxCompute/Ozone credentials, extend shared JDBC/URL/SDK/Hadoop/custom-name rules, then complete sensitive annotations and address review findings.
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
S3 streaming insert tasks execute internal INSERT statements without emitting query audit events. This makes it difficult to identify the exact files imported after wildcard paths are resolved.
This change emits internal audit events only for S3 streaming insert tasks. The audited statement contains the rewritten S3 URI and masks sensitive TVF properties. Both successful and failed executions are recorded. CDC streaming insert tasks keep the existing behavior and do not emit these audit events.
Release note
S3 streaming insert jobs now record internal INSERT audit logs with resolved file paths and masked credentials.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)