feat: enhance API key management#63
Merged
Merged
Conversation
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
Add safer upstream API Key management for multi-key rotation. The admin upstream edit flow now shows masked existing keys, supports marking individual keys for deletion, and treats the edit textarea as “add new keys” instead of replacing the whole key set. Replacing one key can be done by deleting the old masked key and adding a new key in the same save.
The backend now supports
deleteAPIKeyIDsandaddAPIKeys, keeps the existing fullapiKeysreplacement contract for compatibility, validates that at least one active key remains, and exposes masked key metadata without returning plaintext secrets.Change type
Affected areas
Verification
cd backend && make swaggercd backend && go test ./...cd frontend && pnpm lintcd frontend && pnpm buildgit diff --checkScreenshots, API examples, or logs
N/A.
Configuration, migration, and compatibility notes
Configuration changes: None.
API changes:
UpdateUpstreamRequestnow supportsaddAPIKeysanddeleteAPIKeyIDs. ExistingapiKeysreplacement behavior is preserved for backward compatibility.Database migrations: None.
Deployment changes: None.
Backward compatibility: Existing upstream configs remain valid. Plaintext API keys are still never returned to the frontend.
Documentation
Swagger was regenerated.
Security and privacy
Masked API Key item IDs are derived with scoped HMAC identifiers and do not expose plaintext keys.
Checklist
.pycfiles,.envfiles, and local storage data are not committed.