Skip to content

Supply the bound domain to provider initialization across SDKs #403

Open

Description

@jonathannorris

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.

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 domain parameter 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/Init is a required interface/protocol method (Go, Kotlin, Swift), introduce it via an optional secondary interface or batch it into the next major; the domain-scoped declaration 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:

Activity

  1. erka commented on Jul 3, 2026

    @erka
    Member

    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.

  2. toddbaert commented on Jul 3, 2026

    @toddbaert
    Member

    This is still ambiguous when there are two or more isolated API instances.

    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 also have security concerns about domain infiltration by a malicious feature flag provider.

    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.

  3. erka commented on Jul 3, 2026

    @erka
    Member

    Does that cover it?

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementspecification

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions