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.
security: fix 7 credential exposure and secret management issues #391
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
Uh oh!
There was an error while loading. Please reload this page.
security: fix 7 credential exposure and secret management issues #391
Changes from all commits
c70bf06104e9a7aef77b8d438278bcd67d406b3f03043006edad5185573b0c98c83b46df4b153File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
🧩 Analysis chain
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 17019
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 637
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 1229
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 2822
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 432
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 790
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 42
sh -ccommand string still exposes password in process argv — fix requiresComputeBackend.ExecAPI changes.The review comment is correct. Using
sh -cwith embeddedMYSQL_PWD='<password>'still exposes the full command string (including password) in/proc/<pid>/cmdlinefor as long as the shell process runs, even though the intent was to avoid process list exposure. Any sibling process in the same container PID namespace can read this.This affects:
buildPasswordChangeCmdbuildPasswordChangeCmdThe comments claiming the password "won't appear in /proc/cmdline" (lines 567, 973) are incorrect.
To fix: Extend
ComputeBackend.Execinterface to accept environment variables (or stdin), then passMYSQL_PWDandPOSTGRES_PASSWORDas env map entries rather than shell command strings. Current signatureExec(ctx context.Context, id string, cmd []string) (string, error)provides no mechanism for this.🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
TEST_SECRETSis a production-active bypass.This branch isn't gated by build tag, env name, or test detection — it's just another env var that, when set in a real deployment, silently satisfies the missing-
SECRETS_ENCRYPTION_KEYcheck. That undermines the very guarantee this PR is trying to add.If you keep the package-init pattern in the short term, please at minimum gate the fallback on something only present in tests (e.g.,
testing.Testing()from Go 1.21+, orstrings.HasSuffix(os.Args[0], ".test")) so a misconfigured production env can't trip it. Removing the global (see other comment) eliminates the need for it entirely.🤖 Prompt for AI Agents
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.
Avoid
os.Exitfrom a package-level initializer; inject the secret instead.var serverSecret = getServerSecret()runs at package import, soos.Exit(1)here turns a missing env var into an opaque process termination duringinitfor anything that importsinternal/core/services(CLIs, migration tools, sibling-package tests, etc.). Per the repo guidelines this is also a "no panic / no global / use constructor injection" violation.Recommended shape:
SECRETS_ENCRYPTION_KEYonce ininternal/platform/config.go'svalidateConfig(whereSTORAGE_SECRETandPOWERDNS_API_KEYare already enforced).IdentityServiceand pass it viaIdentityServiceParams. ThencomputeKeyHashbecomes a method onIdentityServiceusings.serverSecret.TEST_SECRETSbranch — tests can constructIdentityServicewith whatever secret they want via the params struct.That removes the global, removes the
os.Exit, removes a production-active backdoor (TEST_SECRETS), and centralises the missing-key error in one place.As per coding guidelines: "Do not panic in production code - return errors instead", "Do not use global variables", and "Use constructor injection for dependencies instead of global initialization".
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.