Repository navigation
feat(flags): support obfuscated assignment keys - #1188
leoromanovsky wants to merge 7 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
7c915bf
fuzzybinary
left a comment
There was a problem hiding this comment.
This mostly LGTM, but the README is getting quite long and quite in the weeds - it might be worth looking into splitting it out into an overview and more detailed documentation / implementation details.
| import 'package:crypto/crypto.dart'; | ||
| import 'package:meta/meta.dart'; | ||
|
|
||
| const supportedFlagsCapabilities = ['assignment-encoding-flag-key-256-v1']; |
There was a problem hiding this comment.
Should this be an enum, in case we want to add new ones later?
| FlagKeyObfuscation._(this.salt); | ||
|
|
||
| /// Validates the wire fields, including explicitly null fields. | ||
| static FlagKeyObfuscation? fromSnapshot(Map<String, Object?> json) { |
There was a problem hiding this comment.
Does this library not use json_serializable?
| Encoded snapshots use `encodedFlags` and store their encoding descriptor. | ||
| Existing plaintext snapshots remain readable. | ||
| Older SDKs cannot use an encoded snapshot after a downgrade. They return defaults | ||
| until a normal plaintext network response provides assignments. |
There was a problem hiding this comment.
README in flutter package is public facing documentation for users. Some of this appears to be more for implementation details for maintainers. I'm fine retaining that information in the repo, but we should really find a better place for it.
| test,test_fonts,BSD-3-Clause,"Copyright 2019-2020 eBay Inc." No newline at end of file | ||
| test,test_fonts,BSD-3-Clause,"Copyright 2019-2020 eBay Inc." |
There was a problem hiding this comment.
Did the tool that generates this remove the newline here? If so I'll look into fixing it.
Tracking: FFLSDK-264
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 Dart 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 telemetrydatadog_flags. The Flutter wrapper uses this Dart implementation; no native bridge change is needed.encodedFlags; 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.