Repository navigation
Support obfuscated feature flag assignment keys - #3941
leoromanovsky wants to merge 8 commits into
Conversation
|
✅ All CI checks and tests passed. Datadog automation helped this PR pass. 🎉 All green!🧪 All tests passed 🔄 Datadog retried 1 test - 1 passed on retry 🎯 Code Coverage (details) 🔗 Commit SHA: 1c1f39f | Docs | View more details | Give us feedback! |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 185a1fa917
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @RunWith(AndroidJUnit4::class) | ||
| internal class FlagKeyObfuscationDeviceTest { | ||
| @Test | ||
| fun resolvesEncodedAssignmentAfterCacheRoundTrip() { |
There was a problem hiding this comment.
Follow the required test method naming convention
Rename this newly added camelCase test to the required M <expected behavior> W <method()> {context} format so the instrumentation test remains consistent and searchable alongside the rest of the suite.
AGENTS.md reference: AGENTS.md:L95-L95
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I don't think changes in this file are needed, given no instrumented test is required.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3779f8916
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| internal data class PrecomputedAssignments( | ||
| val flags: Map<String, PrecomputedFlag>, | ||
| val obfuscation: FlagKeyObfuscation? = null | ||
| ) |
There was a problem hiding this comment.
Register a factory for PrecomputedAssignments
This new data class is constructed repeatedly by the module's tests, but no corresponding ForgeryFactory was added or registered in ForgeConfigurator. Add and register the required factory so the new test model follows the module's fixture convention.
AGENTS.md reference: AGENTS.md:L99-L99
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Added and registered PrecomputedAssignmentsForgeryFactory in 751cb76. A repository test obtains the generated assignments through ForgeConfigurator and checks that setFlagsAndContext retains them. Flags JVM tests, ktlint, and Detekt pass.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 751cb7629d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| @Test | ||
| fun `M restore latest salt and value W init { after multiple writes }`() { |
There was a problem hiding this comment.
Name constructor tests after the invoked constructor
Fresh evidence after the earlier suite-wide naming comment is that this test and the native-cache test at line 232 still use W init, which is neither the required <method()> form nor the concrete constructor being exercised. Rename these labels to identify DefaultFlagsRepository() so the new tests comply with the repository's mandatory naming convention.
AGENTS.md reference: AGENTS.md:L95-L95
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Renamed both constructor tests to W DefaultFlagsRepository(). The develop merge also preserves the new first-flags callback. All 501 Flags tests and 76 OpenFeature tests pass, with ktlint and Detekt passing.
Motivation
Readable flag keys can reveal upcoming features. Support obfuscated assignments without changing application evaluation calls.
This reduces readable names in payloads; it does not hide values or prevent dictionary guessing. It is not encryption or response signing.
Changes and Decisions
Advertise support through this header instead of a JSON
supported_capabilitiesfield. Existing request fields stay unchanged.X-DD-FEATURE-FLAGS-CAPABILITIES: assignment-encoding-flag-key-256-v1Capabilities are sorted and comma-separated. They describe support, not a requirement. The edge still selects plaintext or obfuscated responses through its rollout.
For
obfuscated: true, validateobfuscation: {scheme, salt}and hash the application key for lookup. The response scheme remainsflag-key-sha256-v1:The public salt contains 16 bytes, encoded as 32 lowercase hexadecimal characters. Keys use exact UTF-8 bytes without normalization.
sequenceDiagram participant App participant SDK as Android Flags client participant Edge as Fastly SDK->>Edge: Precompute request + capability header Edge-->>SDK: Plaintext, or encoded keys + scheme + salt SDK->>SDK: Validate and retain assignments with encoding App->>SDK: Evaluate original flag key SDK->>SDK: Hash lookup key only for encoded assignments SDK-->>App: Original value and evaluation details SDK->>SDK: Keep original flag key in telemetryencodedFlagswith their metadata and context. Continue reading legacy plaintext caches.Release requires edge support for the new header. This PR does not deploy backend changes.
Related: edge rollout, browser implementation.