Visitar URL original
fix: remove sensitive property values from debug log output by gnodet · Pull Request #403 · apache/maven-filtering · GitHub
Skip to content

fix: remove sensitive property values from debug log output - #403

Merged
gnodet merged 1 commit into
apache:masterfrom
gnodet:fix/290-remove-sensitive-property-debug-dump
Sep 26, 2026
Merged

gnodet merged 1 commit into
apache:masterfrom
gnodet:fix/290-remove-sensitive-property-debug-dump

Conversation

@gnodet

@gnodet gnodet commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Fixes apache/maven-resources-plugin#133 (MRESOURCES-290).

Problem

BaseFilter.getDefaultFilterWrappers() contained a debug block that dumped every key=value pair from filterProperties when isDebugEnabled() (i.e. mvn -X). The filterProperties map is built from system properties and session properties, which includes the full env.* namespace — meaning every environment variable is logged in plain text:

[DEBUG] properties used:
[DEBUG] env.AWS_SECRET_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE/wJalrXUtnFEMI/K7MDENG
[DEBUG] env.GITHUB_TOKEN: ghp_xxxxxxxxxxxxxxxxxxxx
[DEBUG] env.DATABASE_URL: postgres://user:password@host/db

This silently leaks credentials and PII to anyone who can read the build log — a common scenario in CI systems where -X is enabled to debug a resource filtering issue.

Fix

Replace the full value dump with a count-only message that retains diagnostic value without exposing secrets:

[DEBUG] number of properties used for filtering: 342

This tells you whether properties were loaded (useful to detect empty/misconfigured filter sets) without revealing any values.

Note: the 3.x branch has the same issue and will be backported separately.

The debug dump in BaseFilter.getDefaultFilterWrappers() was logging
every key=value pair from the full filterProperties map, which includes
all system properties and environment variables exposed via the env.*
namespace (AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN, DATABASE_URL, etc.).

Replace the value dump with a count-only message that retains diagnostic
value (how many properties are in scope) without leaking credentials.

Fixes: apache/maven-resources-plugin#133

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean security fix. Replaces a debug block that dumped all filterProperties key=value pairs (including env.* — secrets, tokens, PII) with a safe count-only message. The isDebugEnabled() guard is retained, SLF4J parameterized logging is used correctly, and the TreeSet import cleanup is consistent. Backport PR #404 covers the 3.x branch.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet gnodet added bug Something isn't working java Pull requests that update Java code labels Sep 26, 2026
@gnodet
gnodet merged commit 2ebc736 into apache:master Sep 26, 2026
8 checks passed
@github-actions github-actions Bot added this to the 4.0.0-beta-2 milestone Sep 26, 2026
gnodet added a commit that referenced this pull request Sep 26, 2026
…from debug log output (MRESOURCES-290)

- Replace full key=value property dump with count-only message in BaseFilter.getDefaultFilterWrappers()
- Prevents env.* namespace from leaking in mvn -X debug output on 3.x branch
- Backport of #403
- Fixes apache/maven-resources-plugin#133 (MRESOURCES-290)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MRESOURCES-290] Configuration to Redact Environment Variable Values

3 participants