Files
floci/docs/services/verifiedpermissions.md
T
Hector Ventura 892927ceb5 feat(verifiedpermissions): run Cedar from the floci-sidecar-cedar image (#3799)
* feat(verifiedpermissions): run Cedar from the floci-sidecar-cedar image

The Cedar sidecar now comes from floci-io/floci-sidecars as
floci/floci-sidecar-cedar, pinned to an exact version because a cached
:latest is never re-pulled. CedarSidecarManager reads the contract JSON
that the image's /health returns: a sidecar speaking another contract
major is refused immediately with a message naming the image and the
FLOCI_SERVICES_VERIFIEDPERMISSIONS_CEDAR_IMAGE and _CEDAR_URL settings
to change, instead of polling for thirty seconds or failing later on a
request. A pre-configured URL is probed the same way. A sidecar whose
health body is not JSON predates the contract and is accepted with a
one-time warning.

* test(verifiedpermissions): exercise the published Cedar image

VerifiedPermissionsIntegrationTest no longer boots the in-tree sidecar in
process: CedarSidecarManager starts the pinned image through Docker, the
same path production takes, under a vp-test resource namespace so the
manager's remove-before-start cannot kill a developer's live sidecar. It
is skipped without Docker, and locally when the image is not present; in
CI a missing image fails. VerifiedPermissionsServiceTest keeps its
reject-before-persist coverage against a fake sidecar answering 400, and
CedarSidecarClientTest pins the request shapes and the 200/400/other
mapping Floci owns.

* chore(build): drop the in-tree Cedar sidecar

sidecars/cedar now lives in floci-io/floci-sidecars as cedar/ with its
history. The build-helper test source root and the test-scoped cedar-java
dependency existed only to boot that server inside the test JVM; the
tests now run against the published image, so both go, along with the
.dockerignore allowlist entry that let the sidecar Dockerfile see its
sources from the repository root context.

* ci: stop publishing the Cedar sidecar from this repository

The release, nightly and reusable image workflows no longer build a
Cedar image or record it in the provenance manifest; the sidecar is
released from floci-io/floci-sidecars on its own cadence. The
compatibility workflow no longer builds and starts the sidecar by hand:
Floci pulls the pinned image itself over the mounted socket onto
compat-net, exactly as it already does for floci-duck. The unit-test
shards prefetch the pinned image, reading the tag from application.yml
so the two cannot drift.

The floci/floci:*-cedar tags stop at this change; whether the next
release cut retags the sidecar image under the old name for a
deprecation window is a release decision, not a workflow default.

* docs(verifiedpermissions): document the external Cedar sidecar image

The Verified Permissions page names floci/floci-sidecar-cedar, why it is
pinned to an exact version, how to pre-pull it, where its API and the
sidecar contract are documented, and what a contract mismatch looks
like. The README's Docker integration table gains the Verified
Permissions row it never had. AGENTS.md records the sidecar rule: own
repository, no tag suffix on the Floci image, no :latest default, the
sidecar releases first, and how a sidecar is tested from here.
2026-09-17 09:16:20 -04:00

9.9 KiB

Amazon Verified Permissions

Protocol: JSON 1.0 (X-Amz-Target: VerifiedPermissions.*) Endpoint: POST http://localhost:4566/ Signing name: verifiedpermissions

Floci implements the Amazon Verified Permissions control plane and authorization APIs with persistent policy stores, schemas, policies, policy templates, policy store aliases, identity sources, tags, and idempotency state. Authorization decisions are evaluated with the official Cedar Java engine rather than a service-specific policy shortcut.

Policy stores support OFF and STRICT validation. In STRICT mode, Floci parses the stored Cedar JSON schema and validates new or updated static policies and policy templates before storing them. Static and template-linked policies participate in IsAuthorized and batch authorization decisions, including Cedar entity hierarchies, attributes, tags, context values, and the standard Cedar extension values accepted by the AVP API model.

Policy store aliases resolve anywhere AVP accepts a policy store ID. Soft-deleted aliases remain reserved in PendingDeletion state for 24 hours and stop resolving to the policy store. Hard delete removes the alias immediately. Create operations that accept clientToken persist an 8-hour idempotency record and reject token reuse with different request parameters.

Identity sources support Amazon Cognito user pools and generic OpenID Connect issuers. IsAuthorizedWithToken and BatchIsAuthorizedWithToken validate JWT signatures through the issuer's OIDC discovery and JWKS endpoints, check token lifetime and configured audiences or client IDs, and project token claims into Cedar principal entities or context.token according to the AVP token type.

Supported Actions

Action Description
CreatePolicyStore Creates a policy store with validation, deletion protection, tags, encryption settings, and idempotency
GetPolicyStore Returns policy store validation, encryption, deletion-protection, and optional tag state
UpdatePolicyStore Updates validation mode, deletion protection, and description
DeletePolicyStore Deletes an unprotected policy store and its child resources; aliases are rejected as identifiers
ListPolicyStores Lists policy stores with pagination
PutSchema Creates, replaces, or removes the Cedar JSON schema
GetSchema Returns the current Cedar JSON schema and namespace metadata
CreatePolicyTemplate Creates a Cedar policy template with persisted idempotency state
GetPolicyTemplate Returns a policy template and supports name/ aliases
UpdatePolicyTemplate Updates a Cedar policy template and name or description metadata
DeletePolicyTemplate Deletes an unused policy template
ListPolicyTemplates Lists policy templates with pagination
CreatePolicy Creates static or template-linked Cedar policies with persisted idempotency state
GetPolicy Returns static or template-linked policy details and supports name/ aliases
UpdatePolicy Updates the mutable fields of a static policy while preserving effect, principal, and resource scope
DeletePolicy Deletes a policy
ListPolicies Lists policies with policy type, template, principal, and resource filtering and pagination
CreateIdentitySource Creates a Cognito or OIDC identity source with persisted idempotency state
GetIdentitySource Returns an identity source and its normalized Cognito or OIDC configuration
UpdateIdentitySource Replaces an identity source configuration without changing the provider family
DeleteIdentitySource Deletes an identity source
ListIdentitySources Lists identity sources with principal-entity-type filtering and pagination
BatchGetPolicy Gets up to 100 policies and reports per-item not-found errors
IsAuthorized Evaluates Cedar policies against supplied principal, action, resource, entities, and context
BatchIsAuthorized Evaluates up to 30 Cedar authorization requests that share a principal or resource
IsAuthorizedWithToken Validates an identity or access token and evaluates the resulting Cedar request
BatchIsAuthorizedWithToken Evaluates up to 30 authorization requests using an identity or access token
CreatePolicyStoreAlias Creates an active alias for a policy store
GetPolicyStoreAlias Returns alias target and lifecycle state
ListPolicyStoreAliases Lists aliases with policy-store filtering and pagination
DeletePolicyStoreAlias Soft-deletes an alias for 24 hours or hard-deletes it immediately
TagResource Adds or replaces policy store tags
UntagResource Removes policy store tags
ListTagsForResource Returns policy store tags

Cedar evaluation

Cedar parsing, schema validation, and authorization run in a lazily started sidecar container, floci/floci-sidecar-cedar, published from floci-io/floci-sidecars. The main Floci JVM and native images do not include Cedar Java or its multi-platform native runtime. Floci starts the sidecar on the first Cedar-dependent AVP operation, probes its health endpoint, and reuses it until shutdown. The image is pinned to an exact version rather than latest: a cached latest is never re-pulled, so a pin is the only way a Floci upgrade reliably brings the matching sidecar. Pull it ahead of time on an air-gapped host with docker pull floci/floci-sidecar-cedar:1.1.0.

The sidecar implements the sidecar contract; its endpoints are documented in the sidecar's API reference. Floci checks the contract version the sidecar reports on /health: a sidecar speaking another contract major is refused immediately with an InternalServerException naming the image and the variable to change. A pre-configured sidecar URL can be supplied when Docker Compose or another supervisor owns the sidecar lifecycle; it is checked the same way.

The sidecar is required by operations that parse or validate Cedar, including PutSchema, identity-source entity-type validation, policy and policy-template create/update paths, and all IsAuthorized* and BatchIsAuthorized* evaluation paths. Read-only control-plane operations that do not parse or evaluate Cedar do not start the sidecar. If Docker is unavailable and FLOCI_SERVICES_VERIFIEDPERMISSIONS_CEDAR_URL is not configured, a sidecar-dependent operation returns the modeled InternalServerException response with HTTP 500. Configure an externally managed sidecar URL when running Floci without access to Docker.

The sidecar is stateless. Each authorization request includes the relevant policies, templates, entities, and context, so policy-store isolation does not depend on mutable shared sidecar state. It uses Cedar Java 4.10.0 to preserve the CEDAR_4 behavior advertised by AVP. A matching forbid policy overrides matching permit policies through Cedar's normal decision semantics.

entities.cedarJson is passed directly to Cedar. entities.entityList is translated to Cedar JSON and supports booleans, longs, strings, entity references, IP addresses, decimals, datetimes, durations, sets, records, entity parents, and entity tags. When duplicate entity identifiers are supplied in an entity list, the last definition wins.

Identity sources and tokens

Cognito identity sources derive the OIDC issuer from the user pool ARN, enforce same-Region user pools, optional app client IDs, group entity mapping, and AVP's <user-pool-id>|<subject> principal identifier convention. OIDC identity sources support identity-token-only or access-token-only selection, accepted client IDs or audiences, principal ID claims, entity ID prefixes, and group claims.

Token authorization uses the issuer discovery document and JWKS endpoint and currently verifies RS256 signatures. The token must contain a valid exp, must not be before nbf, and must match the configured token type and audience or client ID. Identity-token claims become principal attributes. Access-token claims are exposed under context.token.

Persistence and isolation

Policy stores and all child resources use Floci's configured storage backend. Keys include the resolved AWS Region and are wrapped by the normal account-aware storage layer, preserving account and Region isolation. /_floci/reset clears policy stores, policies, templates, aliases, identity sources, and idempotency records with other resettable service state.

Limitations

  • Token verification currently supports RS256 JWT signatures. Other OIDC signing algorithms are rejected rather than accepted without verification.
  • Identity source creation validates the configured issuer shape and AVP relationships, but does not contact the issuer until a token authorization request requires OIDC discovery or JWKS.
  • The emulator applies state changes synchronously. AWS may expose short eventual-consistency windows after some AVP mutations.
  • KMS-backed policy stores resolve and persist the configured KMS key ARN and encryption context, but local policy bytes are not encrypted at rest by Floci's storage backend.

Configuration

Environment variable Default Description
FLOCI_SERVICES_VERIFIEDPERMISSIONS_ENABLED true Enables Amazon Verified Permissions
FLOCI_SERVICES_VERIFIEDPERMISSIONS_CEDAR_URL unset Uses an externally managed Cedar sidecar URL and skips container management
FLOCI_SERVICES_VERIFIEDPERMISSIONS_CEDAR_IMAGE floci/floci-sidecar-cedar:1.1.0 Image used for the lazily managed Cedar 4 sidecar; pin an exact version

Examples

aws --endpoint-url http://localhost:4566 verifiedpermissions create-policy-store \
  --validation-settings mode=OFF

aws --endpoint-url http://localhost:4566 verifiedpermissions list-policy-stores