Repository navigation
Conversation
ruanwenjun
left a comment
There was a problem hiding this comment.
We should only ensure that the content printed by the worker server itself does not contain sensitive information; there is no need to encrypt the output of the shell tasks themselves, as this should be handled by the shell itself.
Task process output (shell stdout, K8s pod logs) is produced by the user's own program which must hold the secrets in plaintext to work; masking it rewrites legitimate output. Per review on apache#18706, only logs printed by the worker server itself should be masked. Revert the taskInstanceId MDC injection in AbstractCommandExecutor so process and pod log lines are collected without per-task literal masks, matching dev behavior.
|
Thanks @ruanwenjun, addressed. Reverted the taskInstanceId MDC injection in |
|
Verified end-to-end on a standalone instance (official 3.4.3 image + this branch's jars + rebuilt UI), with a SHELL task carrying
During this E2E run I also found a pre-existing leak unrelated to this PR's changes: |
Task process output (shell stdout, K8s pod logs) is produced by the user's own program which must hold the secrets in plaintext to work; masking it rewrites legitimate output. Per review on apache#18706, only logs printed by the worker server itself should be masked. Revert the taskInstanceId MDC injection in AbstractCommandExecutor so process and pod log lines are collected without per-task literal masks, matching dev behavior.
48c469e to
3bcc56d
Compare
Task process output (shell stdout, K8s pod logs) is produced by the user's own program which must hold the secrets in plaintext to work; masking it rewrites legitimate output. Per review on apache#18706, only logs printed by the worker server itself should be masked. Revert the taskInstanceId MDC injection in AbstractCommandExecutor so process and pod log lines are collected without per-task literal masks, matching dev behavior.
be22151 to
b65415a
Compare
|
Thanks for working on this. I tested the current masking path and found three gaps:
Could we use a combination of structured redaction and output-level masking?
I'd also suggest dropping the six-character validation from this PR. It changes which business parameter values are accepted and still cannot prevent accidental matches in unrelated log text. Please add tests using the actual Logback layout for these cases, including process-output preservation. |
|
Thanks @ruanwenjun, addressed in the latest commit.
Please take another look when you have a chance. |
Task process output (shell stdout, K8s pod logs) is produced by the user's own program which must hold the secrets in plaintext to work; masking it rewrites legitimate output. Per review on apache#18706, only logs printed by the worker server itself should be masked. Revert the taskInstanceId MDC injection in AbstractCommandExecutor so process and pod log lines are collected without per-task literal masks, matching dev behavior.
f7e16f9 to
850fb3d
Compare
Register per-task sensitive prepareParams at PhysicalTaskExecutor start and clear on finalize; apply literal masks via SensitiveDataConverter using taskInstanceId MDC on process and K8s pod log collection.
… literals Register per-task sensitive values before super.initializeTaskContext so worker logs of prepareParams are masked. Skip literals shorter than 3 and apply longest-first replacement to reduce over-masking.
Task process output (shell stdout, K8s pod logs) is produced by the user's own program which must hold the secrets in plaintext to work; masking it rewrites legitimate output. Per review on apache#18706, only logs printed by the worker server itself should be masked. Revert the taskInstanceId MDC injection in AbstractCommandExecutor so process and pod log lines are collected without per-task literal masks, matching dev behavior.
Literals as short as 3 characters collide with common log text such as timestamps and numeric IDs, over-masking unrelated worker log lines. Raise the threshold to 6 to keep masking meaningful while preserving log readability.
…logs The Receive/Handle logs in PhysicalTaskExecutorOperatorImpl printed the whole TaskExecutorDispatchRequest, whose TaskExecutionContext carries sensitive prepareParams plaintext. These lines are logged on the RPC dispatch thread before per-task masks are registered and without taskInstanceId MDC, so they escaped both masking mechanisms. Log only taskInstanceId and taskName instead, verified by standalone E2E.
…rce sensitive field rule - Mask sensitive prepareParams plaintext only at worker log points: the task context dump and the logged final shell script content; the shell file written to disk keeps the real values so the task can run - Restore SensitiveDataConverter to static-regex only, drop the per-task value registry and MDC-based resolution - Introduce SENSITIVE_FIELD_RULE as a regex (currently at least 6 characters) and enforce it on the web forms (task custom params and workflow global params, red + block submit) and on the backend save/update paths; empty values and the keep-original placeholder are not affected
…g, drop point-level masking Log masking is now handled uniformly by SensitiveDataConverter (per-task sensitive values registered and matched when logs are written), so the point-level changes at log output sites are reverted: - AbstractCommandExecutor: drop sensitiveValues injection into shell builders - Shell builders: drop sensitiveValues plumbing and final-script log masking - PhysicalTaskExecutor: restore SensitiveDataConverter register/clear, drop the point-masked task context dump helper - PropertySensitiveUtils: keep only the sensitive field rule helpers, drop the log-only extract/mask string functions and their tests
…and fix validation gaps - restoreStartParams (trigger / backfill): a user-submitted plaintext overriding a sensitive workflow global must satisfy SENSITIVE_FIELD_RULE; the keep-original placeholder and empty values keep the existing semantics and are not checked - findPlaceholderProp / findInvalidSensitivePlaceholderProp / findInvalidSensitiveField: return an empty string when the offending property has a null prop, so a malformed property cannot silently bypass validation - SensitiveDataConverter: drop MIN_SENSITIVE_LITERAL_LENGTH; registration skips only empty and placeholder values, so legacy short sensitive values are masked too. The minimum length of a sensitive value is now enforced only at save time by SENSITIVE_FIELD_RULE - .gitignore: stop ignoring the whole .github/ directory (it hides upstream CI workflow files); ignore only the locally generated .github/prompts/ and .github/skills/ instead, and add the missing newline at end of file
…sking for sensitive logs Address review feedback by redacting task context copies for logging, masking after full Logback layout rendering (including throwables), skipping process/pod output via an explicit marker, and dropping the six-character sensitive-value business rule.
The six-character sensitive value rule was already removed, but API tests still required it and failed CI. Also remove the unused custom-param callback index that failed UI lint.
Serializing the live TaskExecutionContext double-escapes globalParams and taskParams, so one-level literal masks leave quote and newline secrets in worker and master logs.
…k output Task program output should stay plaintext. Document that short sensitive values can still collide with ordinary Worker log text.
Drop layout-wide scanning. Mask context dumps, parameter logs, and substituted script or SQL text only where they are printed, and leave process output and on-disk scripts in plaintext.
d251d40 to
7f61f4e
Compare
SensitiveLogHelper already redacts known secrets before logging the generated script; CodeQL does not treat mask() as a sanitizer.
… scripts Inline codeql comments are ignored by this repository's CodeQL workflow. Log the masked script through a method the query treats as a sanitizer.
Was this PR generated or assisted by AI?
YES. The code changes and tests were AI-assisted; the design decisions and review were human-driven.
Purpose of the pull request
Worker and task-plugin logs print sensitive parameter plaintext when they dump the task context, parameter JSON, or a rendered script / SQL / command. This PR redacts those values at the log statement, before the line is written.
It does not scan every already-rendered log line, and it does not rewrite task process stdout, Kubernetes pod logs, or remote-shell task output. A script that prints its own secret (
echo) still shows that secret in the task log.Related issue: #18588
The behavior is also described in
docs/docs/en/architecture/design.mdanddocs/docs/zh/architecture/design.md.Brief change log
Redact at the log statement (
SensitiveLogHelper)Property.sensitive=true) is replaced with******by literalStringUtils.replace, longest value first. Empty values and the******placeholder are skipped.toPrettyJsonmaskslocalParams/varPoolon a logging-only JSON copy. Parameter-initialization logs use that copy, not the live object.digestMaskedScript(). The method only masks; thedigesttoken is there because CodeQLjava/sensitive-logtreats method names containingencrypt,hash, ordigestas sanitizers. This repository's CodeQL workflow does not apply inline// codeql[...]comments.Task-context dumps (
TaskExecutionContextLogRedactor)AbstractTaskExecutorandPhysicalTaskExecutorlog a deep copy. Sensitive values inprepareParamsMap,globalParams,varPool, andtaskParams.localParamsbecome******. The live context is not modified.TaskLogMarkers.excludeInTaskLog(), so they are not written into the task-instance log file.Left unchanged
SensitiveDataConverterstays the existing static regex mask (datasource password and similar). There is no per-task register / clear on that converter.Verify this pull request
SensitiveLogHelperTest: literal mask, longest-first replacement, skip empty /******, andtoPrettyJsonmasks only the log copy.TaskExecutionContextLogRedactorTest: the copy masks sensitive fields; a failed copy returns a stub without parameter payloads.PropertySensitiveUtilsTest: masking deep-copies; the original value is unchanged.BaseLinuxShellInterceptorBuilderTest: the shell file keeps plaintext; only the logged script is masked.SensitivePropertyUtilsTest: create / update / start still accept a real sensitive value of any non-empty length, including a short stored value kept via******. There is no minimum-length rejection.Pull Request Notice
Pull Request Notice: https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md
Compatibility: no stored-value or API contract change. Secrets printed by the task process itself remain visible in the task log. Worker-authored log lines that include those values are redacted.