Skip to content

feat(server): add configurable flag metadata in ListFlags responses#4934

Merged
erka merged 2 commits into
v2from
rd/v2/flag-metadata-eval-api-config
Oct 26, 2025
Merged

feat(server): add configurable flag metadata in ListFlags responses#4934
erka merged 2 commits into
v2from
rd/v2/flag-metadata-eval-api-config

Conversation

@erka

@erka erka commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

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

@erka
erka requested a review from a team as a code owner October 23, 2025 13:51
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 23, 2025
@erka erka added the v2 Flipt v2 label Oct 23, 2025
@dosubot

dosubot Bot commented Oct 23, 2025

Copy link
Copy Markdown

Documentation Updates

Checked 4 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

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]>
@erka
erka force-pushed the rd/v2/flag-metadata-eval-api-config branch from 56e4d36 to 7e9baeb Compare October 23, 2025 13:56
@erka
erka requested review from Copilot and markphelps October 23, 2025 14:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WithFlagMetadata option
  • Adds conditional metadata inclusion logic in the ListFlags handler based on configuration
  • Exposes the new include_flag_metadata setting 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

codecov Bot commented Oct 23, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.29%. Comparing base (9497379) to head (d65c8e5).
⚠️ Report is 1 commits behind head on v2.

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              
Flag Coverage Δ
integrationtests 34.93% <75.00%> (+1.11%) ⬆️
unittests 51.26% <93.75%> (+1.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@markphelps

Copy link
Copy Markdown
Collaborator

@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

@erka

erka commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

@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

@markphelps

Copy link
Copy Markdown
Collaborator

@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

@erka

erka commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

In issue #2682, it’s mentioned that:

Often, feature flags are tied to pull requests, GitHub issues, or other internal documents.

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 /meta/config endpoint and how many times it led to secret leaks — I really don’t want to see the same thing happen here.

@erka

erka commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

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.

@markphelps

Copy link
Copy Markdown
Collaborator

In issue #2682, it’s mentioned that:

Often, feature flags are tied to pull requests, GitHub issues, or other internal documents.

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 /meta/config endpoint and how many times it led to secret leaks — I really don’t want to see the same thing happen here.

these are good points.

wdyt about us creating a evaluation configuration section and putting this include_flag_metadata there. that way its clear that it will be returned from the evaluation APIs like 'list flags' and we could also return it in the actual evaluation calls like was mentioned in #2682

@erka

erka commented Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

Yes, that may be a good place for such configuration.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 24, 2025
Signed-off-by: Roman Dmytrenko <[email protected]>
@erka
erka force-pushed the rd/v2/flag-metadata-eval-api-config branch from 4778792 to d65c8e5 Compare October 24, 2025 23:29
@erka
erka merged commit c15f032 into v2 Oct 26, 2025
41 of 42 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Flipt V2 Oct 26, 2025
@erka
erka deleted the rd/v2/flag-metadata-eval-api-config branch October 26, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs docs Requires documentation updates size:L This PR changes 100-499 lines, ignoring generated files. v2 Flipt v2

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants