Protection manifests and upload

Prev Next

Configure overview: Configure business policies. This page is the detailed CLI workflow for integration/.protection/ YAML.

Create and publish protection manifests under integration/.protection/ that map principals to dimension grants.

Prerequisites

  • Datasource uploaded and dimensions in catalog with correct valueType
  • Dimension bindings on Business Entity JSON (Configure business policies)
  • aifabrix auth status green

Where it lives

integration/.protection/
  <datasourceKey>.yaml    # one file per datasource key

CLI arguments use datasourceKey (e.g. my-crm-companies), not systemKey.

How to set

To remove deployed protection, first run aifabrix protection delete <datasourceKey> --key <protectionKey> --dry-run. Review the stored key and principal-grant/dynamic-value counts, then repeat without --dry-run to confirm. The key comes from Dataplane state, not the local file. Without --key, deletion proceeds only when exactly one stored protection exists; otherwise select one of the listed keys. Deletion removes that protection and its lineage-generated grants/values, while leaving records and local files in place.

Publishing an interface makes a capability discoverable; it does not grant permission to execute it. Current caller policy still applies. Owner-configured path values are bound by the compiler, while the caller must supply the declared per-record identity; an owner-bound credential is not that record identity.

  1. Optional starter — probe live datasource + catalog:
aifabrix protection create <datasourceKey> --type country-sales
  1. Edit the manifest — replace the datasource, group and dimension with your deployed values:
apiVersion: dataplane.aifabrix.ai/v1
kind: Protection
metadata:
  key: my-crm-companies-regions
  displayName: Company region access
spec:
  enabled: true
  datasourceKey: my-crm-companies
  mode: replaceForSource
  rules:
    - key: sales-managers
      principal:
        type: group
        expression: Sales Managers
      grants:
        - dimensionKey: customerRegion
          valueExpression: "{{metadata.country}}"
  1. Validate locally + on dataplane:
aifabrix protection validate <datasourceKey>
aifabrix protection validate <datasourceKey> --warnings-as-errors
  1. Upload:
aifabrix protection upload <datasourceKey>
# upload and wait for the resulting datasource sync when required:
aifabrix protection upload <datasourceKey> --sync --sync-timeout 1800
# or batch:
aifabrix validate .protection --warnings-as-errors
aifabrix upload .protection
  1. Inspect deployed state:
aifabrix protection list
aifabrix protection show <datasourceKey>

Use --dry-run on upload in CI to fail without mutating production protection. With --sync, Builder follows the typed sync job until it is terminal. If the wait reaches --sync-timeout, the job keeps running, Builder exits 5 with SYNC_STILL_RUNNING, and prints the job id. Inspect that job before starting another sync; timeout does not mean the server cancelled it.

Defaults and examples

Step Command
create Starter from live probe
validate Schema + dataplane rules
upload Publish grants
show Effective grants per dimension

After upload, re-sync datasource when your workflow requires protection projection on stored records.

The complete manifest above uses spec.rules[] to resolve a group and project grants from each synced record. The referenced dimension must exist in the catalog. Omit grant-level valueType for a static or dynamic catalog dimension; supply it only when the catalog mode is both.

Validate references datasource key, displayName, systemKey, entityType, resourceType, and dimension catalog keys — typos fail before upload. Protection manifests never replace datasource JSON — they reference deployed datasources by datasourceKey under integration/.protection/.

Validate

Verify that a permitted caller can execute the intended record operation and a denied caller cannot. Check missing record identity and attempted overrides of owner-configured path values. Published interface presence alone is not authorization proof.

aifabrix protection validate <datasourceKey> --warnings-as-errors
aifabrix protection upload <datasourceKey>
aifabrix verify-governance <systemKey> --subject-email scoped-user@example.com

Common mistakes

Mistake Fix
Using systemKey as CLI arg Use datasourceKey
valueType mismatch Fix catalog before upload
Manifest under system folder Use integration/.protection/
Upload before datasource deploy Upload integration first

Limits

Compilation does not waive current-request access checks. This workflow defines no additional manifest fields for caller identity or internal authorization storage.

Protection expressions are environment-specific — no secrets in git. Complex FK inheritance scenarios need coordinated dimension + FK configuration; see foreign keys page.

Before protection upload, confirm the datasource key is deployed and dimension catalog valueType matches manifest grants. Batch upload via upload .protection still requires each file to reference a valid datasourceKey and systemKey context from live dataplane state.

Protection grants reference dimension keys bound on datasource JSON — fix top-level dimensions and indexed externalId on the datasource before iterating on YAML grants alone. Run protection validate --warnings-as-errors in CI before protection upload to catch datasourceKey typos early.

FK inheritance: child Business Entity protection may reference parent dimensions — ensure parent foreignKeys[] and indexed externalId are deployed first (Configure business policies).

RecordStorage datasource context (protection applies after deploy):

{
  "key": "example-customers",
  "systemKey": "example-crm",
  "entityType": "recordStorage",
  "resourceType": "customer",
  "primaryKey": ["externalId"]
}

Batch upload .protection in CI should pair with protection validate --warnings-as-errors on every changed manifest file — partial batch success leaves some dimensions unprotected while others publish.

Subject-scoped proof uses verify-governance <systemKey> --subject-email after upload — protection YAML alone does not satisfy the governance pillar without live dataplane evaluation.

Dimension catalog valueType must match grant expressions — static region lists fail validation when the catalog expects dynamic identity-bound types even when YAML syntax is valid.

Protection upload order matters when FK inheritance applies — publish parent datasources and dimensions before child protection manifests that reference inherited scopes.

Static grant lists in protection YAML must match dimension catalog keys exactly — typos in customerRegion vs customer_region fail validate with messages that resemble RBAC misconfiguration.

Never store resolved principal secrets in protection YAML — principals reference identity groups and roles already synchronized via identity sync.