Status: Partially available
Grant and inspect permissions
Grant a role to give a principal more access, revoke it to take access away, and read the audit log to confirm what the server decided. Every command here changes access for the whole tenant; roles are not scoped to a space.
Prerequisites
- A credential with the
adminrole, such as the tenantadmin_credentialfrom Deploy Wyrd for a team, or the keywyrd server devsaved. - The principal’s ID.
wyrd principal listshows it.
If you are not sure which role you need, Identity and authorization lists what each built-in role allows.
1. Find the principal and its roles
The CLI uses your saved endpoint, or --server / WYRD_SERVER_URL:
wyrd principal list --kind service
wyrd principal role list --principal <principal-id>A Service or Agent principal created by wyrd declare starts with workload. A tenant administrator holds admin.
2. Grant or revoke a role
wyrd principal role grant --principal <principal-id> --role editor
wyrd principal role revoke --principal <principal-id> --role editorThe same call from an SDK:
from wyrd.auth import Principals
principals = Principals()
result = principals.grant_role(principal_id, "editor")
print(result["changed"], result["roles"])use wyrd_ai::auth::Principals;
let principals = Principals::connect().await?;
let result = principals.grant_role(&principal_id, "editor").await?;
println!("{} {:?}", result.changed, result.roles);import { Principals } from "wyrd-ai";
const principals = await Principals.connect();
const result = await principals.grantRole(principalId, "editor");
console.log(result.changed, result.roles);A grant is idempotent: granting a role the principal already holds returns changed: false and the unchanged role list.
The change reaches a running service within 5 minutes, when its access token is next renewed. Revoking a role that a person also gets from an identity-provider group does not remove it; change the group mapping instead.
3. Cut a principal off
To stop a principal entirely, suspend it:
wyrd principal revoke <principal-id> --kind service --reason "credential leaked in CI logs"New tokens are refused at once, and tokens already issued expire within 5 minutes. To stop one credential but keep the principal, revoke just that credential with the principals.revoke_credential MCP tool.
4. Confirm the decision
Every permission check is recorded in the audit log. To see what was refused recently:
SELECT created_at, sub_principal_id, permission, outcome
FROM vala.system.audit_log
WHERE outcome = 'denied'
ORDER BY created_at DESC
LIMIT 20Run it with any SDK’s Bifrost.sql, or the bifrost.query MCP tool. A refused call returns WYRD_PERMISSION_403_DENIED_RBAC, and the error names the permission the principal lacked.
What can go wrong
| Error code | Cause | Fix |
|---|---|---|
WYRD_PERMISSION_403_DENIED_RBAC on grant or revoke | Your credential does not hold admin | Use the tenant administrator’s credential |
WYRD_AUTH_401_CREDENTIAL_REVOKED | The principal or its tenant is suspended | Ask a tenant or platform administrator to restore it |
| The service still has the old access | Its token was issued before the change | Wait up to 5 minutes for the next renewal |
Last updated