Skip to content

Authorization policy does not seem to apply to the Evaluation API #6345

Description

@lawmatsuyama

Hi!

I'm trying to restrict access to namespaces using a custom policy.rego in Flipt v2.

My use case is to have static tokens scoped to specific namespaces. For example, I have a static token with the following metadata:

metadata:
  mode: readonly
  namespace: product

And my authorization policy looks roughly like this:

package flipt.authz.v2

import rego.v1

default allow := false

token_mode := input.authentication.metadata.mode
token_namespace := input.authentication.metadata.namespace

allow if {
    token_mode == "readonly"
    input.request.action == "read"
    input.request.namespace == token_namespace
}

allow if {
    token_mode != "readonly"
}

For Management API requests, I would expect this policy to prevent the token from accessing namespaces other than product.
However, when using the Evaluation API:

POST /evaluate/v1/boolean

I can evaluate a flag from the default namespace using the token whose metadata contains:
namespace = product

The request is successfully authenticated, but it looks like the authorization policy is not evaluated for this endpoint.

My expected behavior would be:

token namespace = product

/evaluate/v1/boolean with namespaceKey=product
→ allowed

/evaluate/v1/boolean with namespaceKey=default
→ forbidden

Is this expected behavior in Flipt v2?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status
    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions