Security

Scoped credentials

Short-lived store credentials that reach only one disk's folder in the bucket.

Agents and machines that mount a disk read and write the bucket directly. Scoped credentials let them do that without ever holding the bucket's own keys. Each set reaches only one disk's folder, and it expires on its own.

export SKYWAKE_STORE=skywake://app
export SKYWAKE_API_URL=https://api.example.com SKYWAKE_API_KEY=sw_...
skywake fork app agent-1

When the store is skywake://NAME, the CLI's local commands and skywaked ask the API for credentials that reach only that disk, and renew them before they expire. No key for the whole bucket ever leaves the server. NAME is the disk's full name: app in the default environment, prod/app in prod.

By default they ask for write credentials. Set SKYWAKE_STORE_ACCESS=read to get read-only ones.

The skywake:// store still reads SKYWAKE_API_URL, not SKYWAKE_URL, and the SDKs have no credentials() call yet. Until they do, ask for credentials over /v1, which goes away one release after v2.

Ask for them directly

curl -X POST "$SKYWAKE_URL/v1/namespaces/prod%2Fapp/credentials" \
  -H "authorization: Bearer $SKYWAKE_API_KEY" -H "content-type: application/json" \
  -d '{"access": "write"}'

access is read or write. For write, you need a key with the write role. The response holds store (as s3://bucket/prefix), region, endpoint, accessKeyId, secretAccessKey, sessionToken and expiresAt. When the API keeps branch heads on cache servers (below), it also holds heads: the servers, the disk's folder and a pass for them.

What they can do

  • They can read and write objects in the disk's folder, and nothing outside it.
  • They can never delete. Destroying a branch writes an empty head, and garbage collection runs with the server's own keys.
  • They can never write the head of a protected branch.
  • They can never take garbage collection's lock.
  • They can still overwrite other branches' heads, content and deleted/ records on that disk. Content is checked against its hash when it is read, so any damage is noticed. With heads on cache servers, they can't write any head in the bucket: every head changes through the servers, which check the pass.

Set it up

Give the API an IAM role that it may assume. The role needs read, write and list on the bucket. Each credential the API hands out gets a session policy that narrows it to one disk.

API settingMeaning
SKYWAKE_API_STS_ROLE_ARNThe role. Without it, the route fails with 501.
SKYWAKE_API_STS_ENDPOINTThe STS endpoint of an S3-compatible store, such as MinIO or RustFS.
SKYWAKE_API_STS_SECONDSHow long credentials last, 900 to 3600. 900 by default.

Heads on cache servers

Branch heads can live on the cache servers instead of the bucket, so forking or committing takes a few milliseconds instead of several bucket writes. Each set of credentials then comes with a pass that names its disk, its access and the protected branches, signed with the cache token. The servers check it without asking the API, and clients renew it on their own.

API settingMeaning
SKYWAKE_HEADStier keeps heads on the cache servers. bucket by default.
SKYWAKE_CACHE_NODESThe cache servers, or one address that reaches them.
SKYWAKE_CACHE_TOKENThe cache servers' token, which also signs passes.

This applies to disks in the default region.

Credentials already handed out keep working until they expire. If you revoke a key or protect a branch, those credentials are affected only once they expire.

Each request is recorded in the audit log as createCredentials, with the access that was asked for.

Next