Repository navigation
Open
Labels
Description
Context
The spec now supplies the bound domain to a provider's initialize function, and adds an opt-in domain-scoped provider declaration that the API enforces by binding such a provider to at most one domain. This lets stateful providers (e.g. an OFREP static-context provider with a persistent cache) scope their state to a single, unambiguous domain.
- Spec PR: feat: supply the bound domain to provider initialization #393
- Related protocol ADR: docs: amend ADR 0009 to tie cache key to OFREP resource (domain, url, auth) protocol#80 (OFREP cache key motivating this)
Relevant spec sections
Requirements summary
| Requirement | Level | Description |
|---|---|---|
| 1.1.2.2 | MUST | The provider mutator supplies the bound domain (if any) when invoking initialize |
| 2.4.1 | MAY | initialize accepts the global evaluation context and an optional bound domain |
| 2.4.3 | MAY | A provider may declare itself domain-scoped (maintains per-domain state that can't be shared) |
| 2.4.4 | MUST | A domain-scoped provider must accept the bound domain during initialization |
| 1.1.8 / 1.1.8.1 | MUST NOT | The provider mutator must not bind a domain-scoped provider instance to more than one domain, rejecting any attempt to bind an already-bound instance to an additional domain |
Section 1.8.4 prose was also updated: a provider instance can back multiple domains unless it declares itself domain-scoped.
Non-functional requirements
- Add the
domainparameter in a backwards-compatible way where the language allows it (optional/overloaded/default parameter). This is non-breaking in JS, Java, Python, .NET, Ruby, and Rust. - In languages where
initialize/Initis a required interface/protocol method (Go, Kotlin, Swift), introduce it via an optional secondary interface or batch it into the next major; thedomain-scopeddeclaration should likewise be opt-in. - PHP has no initialization hook today; adding one is out of scope here unless done separately.
- Associated testing and README/docs updates.
Implementation tracking
Child issues:
- JS: Supply the bound domain to provider initialization js-sdk#1434
- Java: Supply the bound domain to provider initialization java-sdk#1981
- Go: Supply the bound domain to provider initialization go-sdk#518
- Python: Supply the bound domain to provider initialization python-sdk#615
- .NET: Supply the bound domain to provider initialization dotnet-sdk#772
- Ruby: Supply the bound domain to provider initialization ruby-sdk#297
- Rust: Supply the bound domain to provider initialization rust-sdk#135
- Kotlin: Supply the bound domain to provider initialization kotlin-sdk#248
- Swift: Supply the bound domain to provider initialization swift-sdk#121
- Docs: Document the bound domain in provider initialization and domain-scoped providers openfeature.dev#1405
Reacted by Todd Baert
Activity
erka commentedon Jul 3, 2026
This is still ambiguous when there are two or more isolated API instances. I also have security concerns about domain infiltration by a malicious feature flag provider.
toddbaert commentedon Jul 3, 2026
If you mean that we can still have cache and other sorts of collisions when multiple instances are in use, I think that's at least mostly resolved by 2.4.4 - a provider can throw if it's (re)associated to a domain (even the same one) under a different API instance.
2.4.4 lets a stateful provider throw on a second initialize (from any API instance), which handles the cross-API cache-collision case. Two caveats: 2.4.4 is MUST accept the domain, not MUST reject a second bind, so it's a thing the provider has to choose to do; and 1.1.2.2's "already active, need not be initialized again" means the provider won't see a second initialize from the same API on the same instance, so intra-API cross-domain rebinds still rely on the SDK's 1.1.8.1 guard rather than provider-side detection.
I think this is why we added this language: "This is a contract on the provider; implementations may not be able to detect or reject a violation automatically, so it is not guaranteed to surface as a runtime error."
Does that cover it?
I think that's an interesting point to consider, but for an author to get into this situation, they are already running code-on-demand, and I think if that code is not trusted, there's a lot worse that can go wrong besides feature flags.
erka commentedon Jul 3, 2026
I don't think so but I may miss some parts of the spec. There are two isolated API instances, two instances of Flagd provider which are set in the different isolated API instances under the same domain name (in tests for an example). If provider instances use the domain name as part of their cache name there probably will be a collision.