-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Redact S3 credentials from logs #10811
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
base: main
Are you sure you want to change the base?
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)
|
DataStoreTO store = safeCmd.getDataStore(); | ||
if (store instanceof S3TO) { | ||
((S3TO) store).setAccessKey("***REDACTED***"); | ||
((S3TO) store).setSecretKey("***REDACTED***"); | ||
} | ||
logger.debug(LogUtils.logGsonWithoutException("Executing command %s [%s].", safeCmd.getClass().getSimpleName(), safeCmd)); |
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.
code looks good, but it seems this should be in LogUtils. There is other obfuscation code also scattered across the code base, so definately not a 👎 but a mere suggestion.
0dedb70
to
a43d34c
Compare
...er/src/test/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java
Outdated
Show resolved
Hide resolved
…udstack/storage/resource/NfsSecondaryStorageResourceTest.java
@blueorangutan LLpackage |
@DaanHoogland a [LL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10811 +/- ##
=============================================
- Coverage 16.57% 3.91% -12.67%
=============================================
Files 5745 415 -5330
Lines 510847 33793 -477054
Branches 62140 6078 -56062
=============================================
- Hits 84696 1322 -83374
+ Misses 416677 32313 -384364
+ Partials 9474 158 -9316
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:
|
Packaging result [LL]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 6219 |
@blueorangutan package |
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 14149 |
@jerome079 can you have a look at this PR?
|
Description
This PR addresses a security issue where S3 credentials used for Secondary Storage were being logged in plain text in CloudStack logs (
access.log
andmanagement-server.log
). Even when debug logging is enabled, secret credentials such asaccessKey
andsecretKey
should never appear in logs.Fix details:
accessKey
andsecretKey
from theS3TO
object before loggingDownloadCommand
inNfsSecondaryStorageResource.java
.NfsSecondaryStorageResourceTest.java
to verify that credentials are redacted.Steps to reproduce the issue:
/var/log/cloudstack/management/access.log
ormanagement-server.log
— credentials will be printed.Fixes: #10339
Types of changes
Bug Severity
How Has This Been Tested?
S3TO
and verifies thatsetAccessKey("***REDACTED***")
andsetSecretKey("***REDACTED***")
are called duringexecuteRequest
.