feat!: replace global secret parameter with auto-generated secret#6
Merged
feat!: replace global secret parameter with auto-generated secret#6
Conversation
- Remove GLOBAL_SECRET environment variable and command line flag - Add LoadOrGenerateSecret function to automatically generate and persist secrets - Update documentation to remove global secret references - Add developer guidelines for conventional commits BREAKING CHANGE: GLOBAL_SECRET environment variable and --global-secret flag are no longer supported. Secrets are now automatically generated and persisted.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the global secret parameter system with an auto-generated secret mechanism. It removes the requirement for users to manually provide a global secret via environment variables or command line flags, instead automatically generating and persisting secrets to the filesystem.
- Removes GLOBAL_SECRET environment variable and --global-secret command line flag
- Implements automatic secret generation and persistence functionality
- Updates documentation to reflect the breaking changes
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/utils/keys.go | Adds LoadOrGenerateSecret function for automatic secret management |
| pkg/mcp-proxy/main.go | Replaces manual secret handling with auto-generated secret loading |
| main.go | Removes global secret command line flag and parameter |
| README.md | Updates documentation to remove global secret references and adds developer guidelines |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| func LoadOrGenerateSecret(secretPath string) ([]byte, error) { | ||
| _, err := os.Stat(secretPath) | ||
| if os.IsNotExist(err) { | ||
| secret := make([]byte, 32) |
There was a problem hiding this comment.
The secret size of 32 bytes is a magic number. Consider defining it as a constant (e.g., const SecretSize = 32) to improve code maintainability and make the intention clearer.
Suggested change
| secret := make([]byte, 32) | |
| const SecretSize = 32 | |
| func LoadOrGenerateSecret(secretPath string) ([]byte, error) { | |
| _, err := os.Stat(secretPath) | |
| if os.IsNotExist(err) { | |
| secret := make([]byte, SecretSize) |
Co-authored-by: Copilot <[email protected]>
Replace magic number 32 with SecretSize constant for better maintainability.
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.
Summary
BREAKING CHANGE: GLOBAL_SECRET environment variable and --global-secret flag are no longer supported. Secrets are now automatically generated and persisted.