Enforce AuthZ policy checks and KMS secret isolation

Enforce explicit least-privilege checks via POST /v1/authz/check, store credentials strictly in /v1/kms/secrets, and verify mutations on GET /v1/audit.

Zero hardcoded credentials and zero implicit permissions. Every service and agent verifies access with POST /v1/authz/check and reads secrets on demand from Hanzo KMS.

Architecture & contract

Hanzo IAM authenticates who the principal is; AuthZ decides what (subject, action, resource) tuple is permitted; KMS injects scoped secret paths without persisting plaintext on disk; /v1/audit records every access.

Primary endpoint: POST /v1/authz/check · Status: shipped · Level: architect

Run it across all four surfaces

hanzo kms health
hanzo kms secrets list
hanzo audit list
import { Configuration, AuthzApi, KmsApi } from 'hanzoai';

const cfg = new Configuration({ accessToken: process.env.HANZO_API_KEY });
const [check, kms] = await Promise.all([
  new AuthzApi(cfg).postAuthzCheck({ subject: 'agent:deploy', action: 'deploy', resource: 'app:billing' }),
  new KmsApi(cfg).getKmsHealth(),
]);
console.log({ allowed: check.data, kms: kms.data });
import os
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AuthzApi, KmsApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
print(AuthzApi(client).post_authz_check({"subject": "agent:deploy", "action": "deploy", "resource": "app:billing"}))
print(KmsApi(client).get_kms_health())
curl -s -X POST https://api.hanzo.ai/v1/authz/check \
  -H "Authorization: Bearer $HANZO_API_KEY" -H "Content-Type: application/json" \
  -d '{"subject":"agent:deploy","action":"deploy","resource":"app:billing"}' | jq '.'

curl -s https://api.hanzo.ai/v1/kms/health \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'

curl -s https://api.hanzo.ai/v1/audit \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
curl -s -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "kms",
      "arguments": {"op": "get_kms_health", "input": {}}
    }
  }'

Verify the outcome

  • Verify an unauthorized subject returns allowed: false on POST /v1/authz/check and the check is logged in /v1/audit.

Production guardrails

  • Record KMS secret paths in documentation and runbooks — never log, commit, or echo secret values.

Next steps & Hanzo University

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.
Last updated Nov 25, 2026