-
Notifications
You must be signed in to change notification settings - Fork 1.2k
HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components #12006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
…n tokens) are being logged directly or exposed through exception messages.
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for picking this up @YLChen-007. some comments but clgtm.
engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java
Outdated
Show resolved
Hide resolved
| logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy"); | ||
| if (consoleProxyMain == null) { | ||
| logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", encryptorPassword); | ||
| logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", "******"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", "******"); | |
| logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=******"); |
core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java
Outdated
Show resolved
Hide resolved
| if ((signature == null) || (apiKey == null)) { | ||
| if (LOGGER.isDebugEnabled()) { | ||
| LOGGER.debug("expired session, missing signature, or missing apiKey -- ignoring request...sig: " + signature + ", apiKey: " + apiKey); | ||
| LOGGER.debug("expired session, missing signature, or missing apiKey -- ignoring request"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you consider this one harmful? if so, this is going over the connection as well. The apikey should not be a secret and the signature is generated from the apikey and the secretkey so should not give any information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaanHoogland Thank you for the feedback. While I agree that HMAC signatures are
cryptographically secure, I believe logging them still poses security risks:
Key concerns:
-
Log files ≠ Network transmission: Logs are persistent, often stored in plaintext, and accessible to more parties (developers, ops, log aggregation systems) than encrypted HTTPS traffic.
-
Replay attack window: If logs are compromised during the signature's validity period, attackers could potentially replay the request.
-
API Key enumeration: Logging API Keys reveals which accounts exist, enabling targeted attacks and violating information disclosure principles.
-
Compliance & Best Practice: OWASP and security standards recommend against logging authentication credentials, even derived ones like signatures.
-
Defense in depth: Even if theoretically safe, removing sensitive data from logs reduces attack surface at minimal cost.
Suggested approach:
- Keep the sanitized logging (no signature/apiKey in output)
- If debugging is needed, log only partial values (e.g., first 8 chars)
This aligns with the principle of least privilege and real-world security practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, @YLChen-007 makes sense.
…java Co-authored-by: dahn <[email protected]>
…loader.java Co-authored-by: dahn <[email protected]>
|
one more remark @YLChen-007 , could you rebase this on the 4.20 branch? It seems applicable to all versions. We usually merge forward from the oldest still supported branch so it will be in 20.3, 22.1 and 23 releases. |
@DaanHoogland Sure, I'll rebase this PR onto the 4.20 branch. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #12006 +/- ##
=============================================
- Coverage 17.56% 3.58% -13.98%
=============================================
Files 5909 445 -5464
Lines 529059 37534 -491525
Branches 64617 6901 -57716
=============================================
- Hits 92919 1346 -91573
+ Misses 425687 36024 -389663
+ Partials 10453 164 -10289
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks @YLChen-007 , the linter had some complaints about trailing spaces. Please take those into account as well. The rebasing can be considered for all you recent contributions, btw. |
HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components #11988