Skip to content

Remove ESAPI's hardcoded sample Encryptor.MasterKey/MasterSalt - #3206

Open
terryozaki-wq wants to merge 1 commit into
devfrom
esapi-blank-sample-master-key-salt
Open

terryozaki-wq wants to merge 1 commit into
devfrom
esapi-blank-sample-master-key-salt

Conversation

@terryozaki-wq

Copy link
Copy Markdown

Summary

  • ESAPI.properties shipped with ESAPI's own publicly-documented sample values (Encryptor.MasterKey=tzfztf56ftv, Encryptor.MasterSalt=123456ztrewq) still in place, despite the file's own comment warning "Do NOT forget to replace these with your own values!". A hardcoded, publicly-known "secret" shipping in config is a standing finding for any secret scanner and a latent footgun for future code.
  • Confirmed via direct codebase search that this repo never calls ESAPI.encryptor() — the only ESAPI usage anywhere is ESAPI.encoder(), for SQL/HTML sanitization in Utility.java.
  • ESAPI's DefaultSecurityConfiguration.getMasterKey()/getMasterSalt() are separate, lazily-invoked methods (only reachable through the encryptor path) that already fail closed with a clear ConfigurationException if the property is missing or empty — so leaving them unset is safe today, and safe if an encryptor call is ever added later, since it forces whoever adds it to supply a real key.

Test plan

  • New UtilitySanitizerUnitTests behaviorally confirms ESAPI.encoder()-backed Utility.inputSanitizer()/inputSQLSanitizer() still work correctly with the properties commented out — 6/6 passing.

🤖 Generated with Claude Code

…sterSalt

ESAPI.properties shipped with ESAPI's own publicly-documented sample
values (Encryptor.MasterKey=tzfztf56ftv, Encryptor.MasterSalt=123456ztrewq)
still in place, despite the file's own comment warning "Do NOT forget to
replace these with your own values!". A hardcoded, publicly-known
"secret" shipping in config is a standing finding for any secret scanner
and a latent footgun for future code.

Confirmed via direct codebase search that this repo never calls
ESAPI.encryptor() - the only ESAPI usage anywhere is ESAPI.encoder(),
for SQL/HTML sanitization in Utility.java. ESAPI's
DefaultSecurityConfiguration.getMasterKey()/getMasterSalt() are
separate, lazily-invoked methods (only reachable through the encryptor
path) that already fail closed with a clear ConfigurationException if
the property is missing or empty - so leaving them unset is safe today
and safe if an encryptor call is ever added later, forcing whoever
adds it to supply a real key rather than silently inheriting ESAPI's
own sample value.

Added UtilitySanitizerUnitTests to behaviorally confirm
ESAPI.encoder()-backed Utility.inputSanitizer()/inputSQLSanitizer()
still work correctly with the properties commented out (previously
untested).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@terryozaki-wq
terryozaki-wq requested a review from a team as a code owner October 26, 2026 16:43
@snyk-io

snyk-io Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant