refactor(security): centralize config obfuscation rules in ObfuscationUtil (#36923) - #36924
Open
wezell wants to merge 2 commits into
Open
refactor(security): centralize config obfuscation rules in ObfuscationUtil (#36923)#36924wezell wants to merge 2 commits into
wezell wants to merge 2 commits into
Conversation
…#36919) getDBOverrides() copied SystemTable.all() into the /api/v1/jvm response unmasked, while the system-properties and environment sections already run values through obfuscateIfNeeded(). Apply the same pattern-based masking (passw|pass|passwd|secret|key|token + OBFUSCATE_SYSTEM_ENVIRONMENTAL_VARIABLES) to config overrides shown in the maintenance portlet. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nUtil (#36923) The masking pattern lived as statics on JVMInfoResource (a JAX-RS resource) and was reached into by SystemTableImpl (business layer) and ConfigurationResource. Move the default pattern, the OBFUSCATE_SYSTEM_ENVIRONMENTAL_VARIABLES custom pattern, and the masking helpers into com.dotcms.util.ObfuscationUtil. JVMInfoResource keeps its public members as @deprecated delegates for plugin back-compat; in-repo callers now use the utility. No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Claude finished @wezell's task in 5m 53s —— View job Code Review — centralize config obfuscation
Solid, well-contained refactor. Behavior is preserved across all consumers, and keeping the old New Issues
Notes (non-blocking)
Test coverageBehavior is unchanged and the existing Nothing here blocks merge; the only real cleanup is the unused |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Extracts the sensitive-config masking rules into a single authoritative home,
com.dotcms.util.ObfuscationUtil:DEFAULT_OBFUSCATE_PATTERN(passw|pass|passwd|secret|key|token), the always-onBASE_PATTERN, and the config-drivenCUSTOM_PATTERN(OBFUSCATE_SYSTEM_ENVIRONMENTAL_VARIABLES)shouldObfuscate(),matchesCustomPattern(),obfuscateIfNeeded(),obfuscate()Consumers updated:
JVMInfoResource— uses the utility; its previously-public statics (obfuscateBasePattern,obfuscatePattern,obfuscateIfNeeded) remain as thin@Deprecateddelegates since plugins may reference themSystemTableImpl.set()— security logging no longer depends on a REST classConfigurationResource.isOnBlackList()— usesmatchesCustomPattern()(identical semantics to its previous direct pattern read)No behavior change anywhere — same patterns, same
a*********zmasking format.Stacked on #36920 (config-overrides obfuscation fix — same file); merge that first and this diff shrinks to the refactor only.
Checklist
🤖 Generated with Claude Code
This PR fixes: #36923