fix/mitigate secret key security vulnerability#14
Merged
ContextVM-org merged 1 commit intoContextVM:masterfrom Apr 27, 2026
Merged
fix/mitigate secret key security vulnerability#14ContextVM-org merged 1 commit intoContextVM:masterfrom
ContextVM-org merged 1 commit intoContextVM:masterfrom
Conversation
Contributor
|
Thanks you so much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR addresses a critical security vulnerability where the
process-pastryconfiguration manager was exposed without authentication. Because thestartServerconfig omitted credentials,process-pastrybypassed authentication entirely, leaving sensitive endpoints (like/process-pastry/api/existingand/process-pastry/api/config) publicly accessible. This allowed unauthenticated reads ofSERVER_SECRET_KEYand arbitrary environment variable writes/process restarts.To comprehensively harden the service, this PR introduces a 2-layer defense mechanism.
Changes Made
manager.tsto injectauthUserandauthPasswordfrom the environment (MANAGER_USER/MANAGER_PASSWORD).MANAGER_PASSWORDin their environment, the manager will now generate a 16-byte cryptographically secure random password on startup and print it to the console. The manager will never start unprotected.docker-compose.ymlto bind port3000exclusively to127.0.0.1by default. This prevents Docker from accidentally bypassing host firewalls (like UFW) and exposing the dashboard to the public internet on standard VPS deployments..env.exampleto include the new authentication variables.How to Test
docker-compose up --build.MANAGER_PASSWORDin your.env, you should see a newly generated password printed in the console.http://localhost:3000/process-pastry/api/configfrom an external tool (like cURL or Postman) without auth. You should receive a401 Unauthorizedresponse.http://localhost:3000in your browser. You will be prompted for Basic Auth. Useadmin(or your custom user) and the generated password to log in successfully.netstat -tuln | grep 3000(it should bind to127.0.0.1:3000).