Skip to Content
Security and networking

Security

Create an Identity for a client outside funcd, give roles to it and to Functions at a scope, and allow or forbid requests with a Cedar Policy.

This page lists the spec and status fields of Identity, Role, RolesAssignment and Policy, each with its type, its limits and its description. The Platform page explains the concept, and the metadata of every kind is the same.

Identity

apiVersion: funcd.io/v1alpha1
kind: Identity
metadata:
  name: analyst
  namespace: default
  resourceGroup: rg1
spec:
  type: external
apiVersionkind
funcd.io/v1alpha1Identity

Identity.spec

FieldType and limitsDescription
credentialSecretNamestring, a DNS-1123 labelThe Secret, in the Identity's namespace, that funcd writes the credential to and deletes with the Identity: the S3 key pair as accessKeyId and secretAccessKey, and the Lake token as lakeToken. Empty means the Identity's name. funcd leaves alone a Secret of that name that no Identity of this name controls, and the Identity then stays Pending with reason SecretNotOwned; a Secret left by a deleted Identity of the same name is issued again.
rotateintegerRaise it above status.observedRotate to rotate the credential: funcd writes a new secretAccessKey and lakeToken under the same access key id, and the old ones stop authenticating, with no overlap.
typestring, required, one of externalWhat the Identity stands for: external, a caller outside funcd that authenticates with the credential funcd issues. The credential grants nothing: a RolesAssignment or a Policy grants the Identity its access.

Identity.status

FieldType and limitsDescription
accessKeyIdstringThe access key id of the issued key pair, also in the Secret. funcd derives it from the Identity's namespace and name, so it stays the same when the credential rotates.
conditionsarray of ConditionThe conditions that explain the phase.
observedGenerationintegerThe generation of the spec that funcd last acted on.
observedRotateintegerThe spec.rotate value that funcd last acted on: a rotation is done once it equals spec.rotate.
phasestring, one of Pending, Deploying, Ready, Idle, Degraded, Failed, TerminatingWhere the object is in its lifecycle.

Role

apiVersion: funcd.io/v1alpha1
kind: Role
metadata:
  name: object-writer
  namespace: default
  resourceGroup: rg1
spec:
  actions:
    - s3::write
apiVersionkind
funcd.io/v1alpha1Role

Role.spec

FieldType and limitsDescription
actionsarray of string values, requiredThe actions the role grants, at least one, such as s3::read, kv::write or lake::query. An action that funcd does not know grants nothing.

RolesAssignment

apiVersion: funcd.io/v1alpha1
kind: RolesAssignment
metadata:
  name: analyst-reads-namespace
  namespace: default
  resourceGroup: rg1
spec:
  principal:
    kind: Identity
    name: analyst
  scope:
    kind: Namespace
  assignments:
    - roleRef:
        kind: BuiltinRole
        name: Blob Data Reader
    - roleRef:
        kind: BuiltinRole
        name: Lake Query Reader
apiVersionkind
funcd.io/v1alpha1RolesAssignment

RolesAssignment.spec

FieldType and limitsDescription
assignmentsarray of RolesAssignment.spec.assignments[], requiredThe grants, at least one: each entry grants one role to a principal at a scope. funcd refuses an entry that sets no principal while spec.principal is unset, and likewise for the scope.
principalobject, RolesAssignment.spec.principalThe principal of each entry that sets none.
scopeobject, RolesAssignment.spec.scopeThe scope of each entry that sets none.

RolesAssignment.spec.assignments[]

FieldType and limitsDescription
principalobject, RolesAssignment.spec.principalWho the entry grants its role to. When unset, spec.principal.
roleRefobject, RolesAssignment.spec.assignments[].roleRef, requiredThe role the entry grants.
scopeobject, RolesAssignment.spec.scopeWhere the entry's role applies. When unset, spec.scope.

RolesAssignment.spec.assignments[].roleRef

FieldType and limitsDescription
kindstring, required, one of BuiltinRole, RoleWhere the role comes from: BuiltinRole for one of funcd's built-in roles, Role for a Role of the RolesAssignment's namespace.
namestring, requiredThe role's name. A built-in role is one of Blob Data Reader, Blob Data Writer, KV Data Reader, KV Data Writer, SQL Data Reader, SQL Data Writer, Secret Data Reader, Secret Data Writer, Lake Query Reader, Lake Contributor, Function Invoker, Reader, Contributor and Owner; the last three cover Bucket and KV data only. A name that matches no role grants nothing.

RolesAssignment.spec.principal

FieldType and limitsDescription
kindstring, required, one of Function, Job, IdentityThe kind of the principal: a Function, a Job, whose runs' workers act as it, or an Identity for a caller outside funcd.
namestring, required, a DNS-1123 labelThe principal's name, in the RolesAssignment's namespace. funcd does not check that it exists.

RolesAssignment.spec.scope

FieldType and limitsDescription
kindstring, required, one of Namespace, BucketPrefix, KVStore, Lake, SQLDatabase, SecretWhat the grant covers: with Namespace, every resource of the RolesAssignment's namespace; with another kind, the one resource that name gives, in that namespace.
namestringThe resource for each kind: <bucket>/<prefix> for one prefix of a Bucket, <store> for every table of a KVStore or <store>/<table> for one, <lake> for a Lake, <database> for a SQLDatabase and <secret> for a Secret. A Namespace scope covers the whole namespace, whatever its name.

Policy

apiVersion: funcd.io/v1alpha1
kind: Policy
metadata:
  name: analyst-writes-nothing
  namespace: default
  resourceGroup: rg1
spec:
  cedar: |
    forbid(
      principal == Identity::"default/analyst",
      action == Action::"s3::write",
      resource in Bucket::"default/lakehouse"
    );
apiVersionkind
funcd.io/v1alpha1Policy

Policy.spec

FieldType and limitsDescription
cedarstring, requiredOne or more Cedar permit or forbid statements, which apply with funcd's built-in rules to each request whose principal and resource are both in the Policy's namespace; a forbid wins over any permit. Each statement names one action funcd knows, such as kv::read, and its principal and resource scopes name only entity types funcd knows and, for a type with a namespace, ids that begin with the Policy's namespace and a slash. funcd refuses text that does not parse, holds no statement or breaks these rules.

HTTP API

The table lists each described operation of these kinds, with its method and path. The operation's page in the API reference gives its parameters, its body, its authentication and every answer, with when it happens and what to do.

MethodPathOperation
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/identitiesList the Identities of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/identitiesCreate an Identity
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/identities/{name}Read an Identity
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/identities/{name}Replace an Identity
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/identities/{name}Delete an Identity
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesList the Roles of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesCreate a Role
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/roles/{name}Read a Role
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/roles/{name}Replace a Role
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/roles/{name}Delete a Role
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesassignmentsList the RolesAssignments of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesassignmentsCreate a RolesAssignment
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesassignments/{name}Read a RolesAssignment
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesassignments/{name}Replace a RolesAssignment
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/rolesassignments/{name}Delete a RolesAssignment
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/policiesList the Policies of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/policiesCreate a Policy
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/policies/{name}Read a Policy
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/policies/{name}Replace a Policy
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/policies/{name}Delete a Policy

On this page