feat(server): add configurable flag metadata in ListFlags responses#4934
Conversation
Add server configuration option to control whether flag metadata is included in ListFlags API responses. This provides operators the ability to expose flag metadata for those who wants it be public. Signed-off-by: Roman Dmytrenko <[email protected]>
56e4d36 to
7e9baeb
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds server configuration to control whether flag metadata is included in ListFlags API responses, allowing operators to make flag metadata publicly available when desired.
Key Changes:
- Introduces a functional options pattern for Server initialization with
WithFlagMetadataoption - Adds conditional metadata inclusion logic in the ListFlags handler based on configuration
- Exposes the new
include_flag_metadatasetting through server configuration and schema files
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/server/server.go | Adds includeFlagMetadata field and functional options pattern to Server struct |
| internal/server/flag.go | Implements conditional metadata inclusion in ListFlags based on configuration |
| internal/server/flag_test.go | Updates test to use new Server initialization with metadata option enabled |
| internal/config/server.go | Adds IncludeFlagMetadata configuration field to ServerConfig |
| internal/cmd/grpc.go | Passes the configuration value when initializing the server |
| config/flipt.schema.json | Adds JSON schema definition for the new boolean configuration option |
| config/flipt.schema.cue | Adds CUE schema definition for the new configuration option with false default |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #4934 +/- ##
==========================================
+ Coverage 59.07% 60.29% +1.21%
==========================================
Files 135 136 +1
Lines 16908 13372 -3536
==========================================
- Hits 9988 8062 -1926
+ Misses 6239 4629 -1610
Partials 681 681
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@erka instead of making it a configuration thing, I thought we would just accept a parameter in the ListFlagsRequest to include metadata, that way it can just be done at request time, no configuration needed |
How will this prevent sensitive metadata from being exposed to someone with a hijacked request? @markphelps |
Im not sure how much we should be worried about that tbh. It just seems weird to me that we would make this a configuration thing as we dont have a precedence for it and it feels more like it should be a per request option |
|
In issue #2682, it’s mentioned that:
There’s a management v2 API for viewing and updating flag metadata, which already has authentication and authorization in place. Currently, I see that the List Flags v1 API is public and part of the evaluation API. I’m concerned that this could expose private data in existing deployments, which for some users might even result in a security incident. There should be an explicit configuration to prevent this. I still remember the v1 |
|
I see the Evaluation API and this V1 List Flags API as data API - read-only and safe to expose publicly. And V2 API as management API - read-write operations with authentication/authorization. |
these are good points. wdyt about us creating a |
|
Yes, that may be a good place for such configuration. |
Signed-off-by: Roman Dmytrenko <[email protected]>
4778792 to
d65c8e5
Compare
Add server configuration option to control whether flag metadata is
included in ListFlags API responses. This provides operators the
ability to expose flag metadata for those who wants it be public.
related #4848