Skip to content

Support obfuscated feature flag assignment keys - #3941

Open
leoromanovsky wants to merge 21 commits into
developfrom
flag-key-obfuscation
Open

leoromanovsky wants to merge 21 commits into
developfrom
flag-key-obfuscation

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Tracking: FFLSDK-261

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_capabilities field. Existing request fields stay unchanged.

X-DD-FEATURE-FLAGS-CAPABILITIES: assignment-encoding-flag-key-256-v1

Capabilities 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, validate obfuscation: {scheme, salt} and hash the application key for lookup. The response scheme remains flag-key-sha256-v1:

lowercase_hex(SHA256(
  UTF8("datadog.feature-flags.flag-key.v1") || 0x00 ||
  decode_hex(salt) || UTF8(application_flag_key)
))

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 telemetry
Loading
  • Cache up to 1,024 lookup hashes per descriptor. Do not cache flag values or change exposure deduplication.
  • Use platform SHA-256. Update assignments and encoding together. Evaluation calls and original-key telemetry stay unchanged.
  • Notify first-flags listeners only for readable assignments. Return an empty key list for encoded configurations because original keys cannot be enumerated.
  • Persist encoded assignments under encodedFlags with their metadata and context. Continue reading legacy plaintext caches.
  • Advertise support only for native Android consumers. Block encoded cache reads until local source detection confirms support. React Native remains excluded.
  • Reject invalid encoding metadata without a plaintext retry. Preserve existing fallback behavior; failed context-switch behavior remains separate.
  • Keep API 23 compatibility and the existing JVM test structure. Add no application configuration or release tooling.

Release requires edge support for the new header. This PR does not deploy backend changes.

Related: edge rollout, browser implementation.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed. Datadog automation helped this PR pass.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
• Patch Coverage: 90.82%
• Overall Coverage: 71.80% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 27ba428 | Docs | View more details | Give us feedback!

@leoromanovsky
leoromanovsky marked this pull request as ready for review October 5, 2026 22:19
@leoromanovsky
leoromanovsky requested review from a team as code owners October 5, 2026 22:19
@leoromanovsky
leoromanovsky requested review from typotter and vjfridge and removed request for a team October 5, 2026 22:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T14:18:46.163663Z 27ba428 New commits
🔒 Security Review ✅ Completed 2026-10-08T14:18:54.224228Z 27ba428 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@maciejburda
maciejburda requested a review from satween October 6, 2026 07:05
Comment thread features/dd-sdk-android-flags/build.gradle.kts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

typotter
typotter previously approved these changes Oct 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

typotter
typotter previously approved these changes Oct 7, 2026
typotter
typotter previously approved these changes Oct 7, 2026

sdkCore.getFeature(Feature.FLAGS_FEATURE_NAME)
?.withContext(withFeatureContexts = setOf(Feature.RUM_FEATURE_NAME)) { datadogContext ->
val supportsObfuscation = datadogContext.source == "android"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why this is needed? the same SDK working in React Native SDK setup changes behavior?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

JavaScript consumes the snapshot through the bridge. It cannot decode obfuscated keys yet. A native SDK upgrade alone does not make that JavaScript reader compatible.

  • How do you think we should handle adding support for this given that the React Native changes have to be layer after this release?

@0xnm

0xnm commented Oct 8, 2026

Copy link
Copy Markdown
Member

Please also follow the convention for the feature PRs: title should contain JIRA ticket reference, branch should be <user.handle>/<jira-ticket>/<branch-name>.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71cc4df42d

ℹ️ 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".

@linear-code

linear-code Bot commented Oct 8, 2026

Copy link
Copy Markdown

FFLSDK-261

@leoromanovsky

Copy link
Copy Markdown
Contributor Author

Please also follow the convention for the feature PRs: title should contain JIRA ticket reference, branch should be <user.handle>/<jira-ticket>/<branch-name>.

@0xnm I don’t see this branch-naming convention documented in AGENTS.md or CONTRIBUTING.md. If it is required, could you please document it there so contributors can follow it from the start?

I’ve added the associated Linear ticket to the PR description. I’ll keep the existing branch for this PR rather than disrupt the review already in progress. We can follow the documented convention for future work.

@0xnm

0xnm commented Oct 8, 2026

Copy link
Copy Markdown
Member

@leoromanovsky Can you update your branch? I pushed some updates to AGENTS.md in #3968.

@leoromanovsky
leoromanovsky requested a review from 0xnm October 8, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants