π Seamlessly Update API Keys at Runtime in GO Feature Flag (No Restarts Needed)
We're excited to announce a new feature in GO Feature Flag that makes API key management easier and more secure: Runtime API Key Updates! π
We've heard from the community that having to restart the relay proxy for every API key update or rotation was a real pain point. Managing API keys is crucial for security, but needing a restart for each change led to unnecessary downtime and interruptions.
With this new feature, you can now update, rotate, and manage API keys on the flyβyour relay proxy keeps running, and requests are served continuously, with no need for restarts.
π€ The Challenge: API Key Managementβ
API keys are essential for securing access to your GO Feature Flag relay proxy. However, managing them has always been challenging:
- Key rotation required service restarts, causing downtime
- Adding new keys meant taking the service offline
- Removing compromised keys couldn't be done immediately
- No flexibility to respond quickly to security incidents
These limitations made it difficult to follow security best practices like regular key rotation and immediate response to security threats.
β¨ Introducing Runtime API Key Updatesβ
GO Feature Flag starting v1.50.0 supports updating API keys at runtime without requiring a restart of the relay proxy.
This feature works in both default mode and flagset mode, giving you the flexibility to manage keys dynamically.
This feature is available starting from GO Feature Flag v1.50.0 and above.
Key Benefitsβ
- β Zero Downtime: Update keys without interrupting service
- β Immediate Response: Remove compromised keys instantly
- β Easy Rotation: Rotate keys as soon as you change your configuration file
- β Flexible Management: Add, remove, or update keys as needed
- β Automatic Detection: Changes are detected and applied automatically
π How It Worksβ
The relay proxy continuously monitors your configuration file for changes. When it detects updates to API keys, it:
- Validates the new configuration (if invalid your new configuration will be ignored)
- Updates the internal API key mappings
- Applies changes immediately
- Continues serving requests without interruption
All of this happens automatically in the background, with no manual intervention required.
βοΈ Configuration Requirementsβ
Default Modeβ
In default mode, only API keys can be updated at runtime:
- β
authorizedKeys.evaluation - β
authorizedKeys.admin - β All other configuration changes are ignored
π Usage Exampleβ
# Initial configuration
authorizedKeys:
evaluation:
- "key-1"
- "key-2"
admin:
- "admin-key-1"
# Updated configuration (runtime update - no restart needed!)
authorizedKeys:
evaluation:
- "key-1"
- "key-2"
- "key-3" # β
New key added
- "key-4" # β
Another new key
admin:
- "admin-key-1"
- "admin-key-2" # β
New admin key added
Flagset Modeβ
In flagset mode:
- β API keys for each flag set can be updated
- β
Flag sets must have a
nameconfigured - β Other flagset configuration changes are not supported
π Usage Exampleβ
flagSets:
- name: team-a # β
Name is required for runtime updates
apiKeys:
- "team-a-key-1"
- "team-a-key-2" # β
Can add new keys at runtime
retrievers:
- kind: file
path: /flags/team-a-flags.yaml
- name: team-b
apiKeys:
- "team-b-key-1"
# β
Can remove keys at runtime by removing them from the config
retrievers:
- kind: s3
bucket: team-b-flags
Important: For flagset mode, your flag sets must have a name configured for runtime updates to work.
Without a name (or if you use default as the name), runtime updates won't be possible since we are not able to target which flagset has changed.
π― Real-World Use Casesβ
Use Case 1: Multi-Tenant Key Managementβ
Scenario: Managing API keys for multiple customers in flagset mode.
Solution: Update keys for individual flag sets independently. Each customer's keys can be managed separately without affecting others.
Use Case 2: Scheduled Key Rotationβ
Scenario: Your security policy requires rotating API keys every 90 days.
Solution: Update the configuration file with new keys, keep old keys temporarily, migrate clients, then remove old keysβall without downtime.
Use Case 3: Team Onboardingβ
Scenario: A new team needs access to a flag set.
Solution: Simply add their API key to the flag set configuration. No restart needed, and they can start using the service immediately.
