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?
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:
And my authorization policy looks roughly like this:
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/booleanI can evaluate a flag from the default namespace using the token whose metadata contains:
namespace = productThe 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?