You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "YLChen-007 (via GitHub)" <gi...@apache.org> on 2025/11/06 13:55:11 UTC
[PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
YLChen-007 opened a new pull request, #12006:
URL: https://github.com/apache/cloudstack/pull/12006
HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components #11988
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "YLChen-007 (via GitHub)" <gi...@apache.org>.
YLChen-007 commented on PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#issuecomment-3501223063
> 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.
Give me a moment to update it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "YLChen-007 (via GitHub)" <gi...@apache.org>.
YLChen-007 closed pull request #12006: HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components
URL: https://github.com/apache/cloudstack/pull/12006
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "YLChen-007 (via GitHub)" <gi...@apache.org>.
YLChen-007 commented on code in PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#discussion_r2502061363
##########
server/src/main/java/com/cloud/servlet/ConsoleProxyServlet.java:
##########
@@ -534,7 +534,7 @@ private boolean verifyRequest(Map<String, Object[]> requestParameters) {
// if api/secret key are passed to the parameters
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");
Review Comment:
@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:**
1. **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.
2. **Replay attack window**: If logs are compromised during the signature's validity period, attackers could potentially replay the request.
3. **API Key enumeration**: Logging API Keys reveals which accounts exist, enabling targeted attacks and violating information disclosure principles.
4. **Compliance & Best Practice**: OWASP and security standards recommend against logging authentication credentials, even derived ones like signatures.
5. **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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#issuecomment-3501224585
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/12006?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 3.58%. Comparing base ([`a50de02`](https://app.codecov.io/gh/apache/cloudstack/commit/a50de029bf1d22c2a9ef0de8591f61de0f350f92?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a98887b`](https://app.codecov.io/gh/apache/cloudstack/commit/a98887b795e5dd8f8383d44fd64e4c0cb3859df4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (a50de02) and HEAD (a98887b). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (a50de02) | HEAD (a98887b) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ 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
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/12006/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/12006/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.58% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/12006/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/12006?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#discussion_r2499321164
##########
server/src/main/java/com/cloud/servlet/ConsoleProxyServlet.java:
##########
@@ -534,7 +534,7 @@ private boolean verifyRequest(Map<String, Object[]> requestParameters) {
// if api/secret key are passed to the parameters
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");
Review Comment:
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.
##########
core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java:
##########
@@ -151,7 +151,7 @@ private void checkCredentials(String user, String password) {
client.getParams().setAuthenticationPreemptive(true);
Credentials defaultcreds = new UsernamePasswordCredentials(user, password);
client.getState().setCredentials(new AuthScope(hostAndPort.first(), hostAndPort.second(), AuthScope.ANY_REALM), defaultcreds);
- logger.info("Added username=" + user + ", password=" + password + "for host " + hostAndPort.first() + ":" + hostAndPort.second());
+ logger.info("Added username=" + user + ", password=******" + " for host " + hostAndPort.first() + ":" + hostAndPort.second());
Review Comment:
```suggestion
logger.info("Added username={}, password=****** for host {}:{}”, user, hostAndPort.first(), hostAndPort.second());
```
##########
agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java:
##########
@@ -331,7 +331,7 @@ private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, fi
final Object resource = this;
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={}", "******");
Review Comment:
```suggestion
logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=******");
```
##########
engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java:
##########
@@ -99,7 +99,7 @@ private static void initDB(String dbPropsFile, String rootPassword, String[] dat
String username = dbProperties.getProperty(String.format("db.%s.username", database));
String password = dbProperties.getProperty(String.format("db.%s.password", database));
String dbName = dbProperties.getProperty(String.format("db.%s.name", database));
- System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=%s", dbName, host, port, username, password));
+ System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=%s", dbName, host, port, username, "******"));
Review Comment:
```suggestion
System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=******", dbName, host, port, username));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#discussion_r2502149250
##########
server/src/main/java/com/cloud/servlet/ConsoleProxyServlet.java:
##########
@@ -534,7 +534,7 @@ private boolean verifyRequest(Map<String, Object[]> requestParameters) {
// if api/secret key are passed to the parameters
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");
Review Comment:
ok, @YLChen-007 makes sense.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#issuecomment-3497380136
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)
Here are some useful points:
- In case of a new feature add useful documentation (raise doc PR at https://github.com/apache/cloudstack-documentation)
- Be patient and persistent. It might take some time to get a review or get the final approval from the committers.
- Pay attention to the quality of your code, ensure tests are passing and your PR doesn't have conflicts.
- Please follow [ASF Code of Conduct](https://github.com/apache/.github/blob/main/.github/CODE_OF_CONDUCT.md) for all communication including (but not limited to) comments on Pull Requests, Issues, Mailing list and Slack.
- Be sure to read the [CloudStack Coding Conventions](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions).
Apache CloudStack is a community-driven project and together we are making it better 🚀.
In case of doubts contact the developers at:
Mailing List: dev@cloudstack.apache.org (https://cloudstack.apache.org/mailing-lists.html)
Slack: https://apachecloudstack.slack.com/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#issuecomment-3501206549
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HMAC Signatures and API Keys Logged in Plaintext Across Authentication Components [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #12006:
URL: https://github.com/apache/cloudstack/pull/12006#issuecomment-3501328357
> > 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. Give me a moment to update it.
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org