306 lines
10 KiB
Plaintext
306 lines
10 KiB
Plaintext
$ mail.tm inbox: scribaseqa7gckwncgzo@euploading.com
|
|
|
|
# 1. sign up -- zero-human account creation, mail.tm address
|
|
$ POST https://console.scribase.com/api/auth/signup
|
|
-> 200
|
|
{
|
|
"status": "authenticated",
|
|
"session": {
|
|
"subject": "builtin:f4d5195ae241f6b3ee131390fa2bfe54",
|
|
"email": "scribaseqa7gckwncgzo@euploading.com",
|
|
"displayName": "scribaseqa7gckwncgzo@euploading.com",
|
|
"isAdmin": false,
|
|
"expiresAtEpochSeconds": 1796100150
|
|
},
|
|
"created": true
|
|
}
|
|
$ POST https://console.scribase.com/api/auth/magic-link/verify
|
|
-> 200
|
|
{
|
|
"verified": true
|
|
}
|
|
|
|
# 2. create org, project, production environment
|
|
$ PUT https://console.scribase.com/api/control/v1/organizations/proof-zjulpw10
|
|
-> 200
|
|
{
|
|
"organization_id": "proof-zjulpw10",
|
|
"display_name": "Approval proof"
|
|
}
|
|
$ PUT https://console.scribase.com/api/control/v1/organizations/proof-zjulpw10/projects/approver-proof
|
|
-> 200
|
|
{
|
|
"organization_id": "proof-zjulpw10",
|
|
"project_id": "approver-proof",
|
|
"region": "eu-frankfurt",
|
|
"postgres_major": 17
|
|
}
|
|
$ POST https://console.scribase.com/api/control/v1/environments
|
|
-> 202
|
|
{
|
|
"id": "op-00eab1373d43453caa7e14831e64ca20",
|
|
"kind": "create_environment",
|
|
"environment": {
|
|
"organization_id": "proof-zjulpw10",
|
|
"project_id": "approver-proof",
|
|
"environment_id": "production"
|
|
},
|
|
"state": "pending",
|
|
"attempt_count": 0
|
|
}
|
|
production environment ready in 32.1s
|
|
|
|
# 3. name a production approver -- the human in the loop
|
|
$ PUT https://console.scribase.com/api/control/v1/organizations/proof-zjulpw10/projects/approver-proof/prod-approver
|
|
-> 200
|
|
{
|
|
"email": "scribaseqa7gckwncgzo@euploading.com",
|
|
"set_by": "builtin:f4d5195ae241f6b3ee131390fa2bfe54",
|
|
"set_at": "2026-11-30T16:43:07Z",
|
|
"notified": true
|
|
}
|
|
|
|
# 4. mint a NON-admin agent token -- no project:*:admin scope
|
|
$ POST https://console.scribase.com/api/control/v1/account/tokens
|
|
-> 201
|
|
{
|
|
"id": "pat-3502199cd50b40fe8f230de9d570929a",
|
|
"name": "ci-agent-non-admin",
|
|
"kind": "agent",
|
|
"token_prefix": "scb_agt_1p-rw-sqlw-x2611301843_fdd65c",
|
|
"scopes": [
|
|
"project:approver-proof:write",
|
|
"sql:read",
|
|
"sql:write"
|
|
],
|
|
"organization_id": "proof-zjulpw10",
|
|
"created_at": 1796056988,
|
|
"expires_at": 1796064187,
|
|
"agent_message": "Scribase agent token (scoped to project approver-proof, read/write, SQL read/write, no secret keys, expires in 2h, revocable at https://console.scribase.com/account/tokens). Designed to be shared with coding agents: scb_agt_1p-rw-sqlw-x2611301843_fdd65c***redacted***",
|
|
"revoke_url": "https://console.scribase.com/account/tokens",
|
|
"token": "scb_agt_***redacted***"
|
|
}
|
|
token scopes: project:approver-proof:write, sql:read, sql:write (no admin)
|
|
|
|
# 5a. CREATE a real table -- non-destructive, runs immediately
|
|
$ POST https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/execute
|
|
-> 200
|
|
{
|
|
"status": "committed",
|
|
"statements": [
|
|
{
|
|
"index": 0,
|
|
"command": "CREATE TABLE",
|
|
"statement": "create table public.proof_widgets (id bigint generated always as identity primary key, note text not null)",
|
|
"kind": "command",
|
|
"affected_rows": 0
|
|
},
|
|
{
|
|
"index": 1,
|
|
"command": "ALTER TABLE",
|
|
"statement": "alter table public.proof_widgets enable row level security",
|
|
"kind": "command",
|
|
"affected_rows": 0
|
|
},
|
|
{
|
|
"index": 2,
|
|
"command": "CREATE POLICY",
|
|
"statement": "create policy proof_widgets_read on public.proof_widgets for select using (auth.uid() is not null)",
|
|
"kind": "command",
|
|
"affected_rows": 0
|
|
}
|
|
],
|
|
"duration_ms": 6,
|
|
"lintFindings": []
|
|
}
|
|
|
|
# 5b. DROP the table, no confirm -- the SQL editor lists it back, nothing runs
|
|
$ POST https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/execute
|
|
-> 200
|
|
{
|
|
"status": "confirmation_required",
|
|
"statement_count": 1,
|
|
"destructive": [
|
|
{
|
|
"index": 0,
|
|
"command": "DROP TABLE",
|
|
"statement": "drop table public.proof_widgets",
|
|
"reason": "drops a database object and everything stored in it"
|
|
}
|
|
],
|
|
"lintFindings": []
|
|
}
|
|
|
|
# 5c. same DROP, confirm: true -- destructive + production + non-admin token
|
|
$ POST https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/execute
|
|
-> 202
|
|
{
|
|
"status": "approval_required",
|
|
"approval_id": "apr_4cef275e9dc2c3e7d6b9cb91",
|
|
"state": "pending",
|
|
"already_waiting": false,
|
|
"approver": "scribaseqa7gckwncgzo@euploading.com",
|
|
"expires_at": "2026-12-01T16:43:08Z",
|
|
"operation": {
|
|
"method": "POST",
|
|
"path": "/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/execute",
|
|
"summary": "Run SQL: drop table public.proof_widgets;"
|
|
},
|
|
"status_url": "/v1/organizations/proof-zjulpw10/projects/approver-proof/approvals/apr_4cef275e9dc2c3e7d6b9cb91",
|
|
"wait_url": "/v1/organizations/proof-zjulpw10/projects/approver-proof/approvals/apr_4cef275e9dc2c3e7d6b9cb91?wait=25",
|
|
"next": "Not run. `production` is production and this token is not an admin, so scribaseqa7gckwncgzo@euploading.com was emailed and has to approve. Wait: GET /v1/organizations/proof-zjulpw10/projects/approver-proof/approvals/apr_4cef275e9dc2c3e7d6b9cb91?wait=25 (MCP: approvals_wait with this approval_id) until state is executed, failed, denied or expired. Do not send the request again: on approve the stored request runs exactly as sent."
|
|
}
|
|
BLOCKED: the DROP did not run. approval_id=apr_4cef275e9dc2c3e7d6b9cb91
|
|
|
|
# 5d. confirm the table is still there -- nothing ran
|
|
$ POST https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/query
|
|
-> 200
|
|
{
|
|
"kind": "rows",
|
|
"row_count": 1,
|
|
"returned": 1,
|
|
"applied_limit": 100,
|
|
"truncated": false,
|
|
"rows": [
|
|
{
|
|
"still_there": true
|
|
}
|
|
]
|
|
}
|
|
|
|
# 6. the approval-request email -- the real decision link
|
|
email received, decision link carries approval_id=apr_4cef275e9dc2c3e7d6b9cb91
|
|
matches the approval_id from step 5c: True
|
|
|
|
# 7. approve -- the one human action, as a click on the email link would do
|
|
$ POST https://api.scribase.com/v1/prod-approvals/apr_4cef275e9dc2c3e7d6b9cb91/decision
|
|
-> 200
|
|
{
|
|
"approval_id": "apr_4cef275e9dc2c3e7d6b9cb91",
|
|
"state": "executed",
|
|
"result_status": 200,
|
|
"detail": "Approved. The request ran exactly as it was sent."
|
|
}
|
|
|
|
# 8. poll the status url until the stored DROP has actually run
|
|
state=executed
|
|
$ GET https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/approvals/apr_4cef275e9dc2c3e7d6b9cb91?wait=25
|
|
-> 200
|
|
{
|
|
"approval_id": "apr_4cef275e9dc2c3e7d6b9cb91",
|
|
"state": "executed",
|
|
"operation": {
|
|
"method": "POST",
|
|
"path": "/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/execute",
|
|
"summary": "Run SQL: drop table public.proof_widgets;"
|
|
},
|
|
"environment_id": "production",
|
|
"requested_by": {
|
|
"token_id": "pat-3502199cd50b40fe8f230de9d570929a",
|
|
"subject": "builtin:f4d5195ae241f6b3ee131390fa2bfe54"
|
|
},
|
|
"approver": "scribaseqa7gckwncgzo@euploading.com",
|
|
"created_at": "2026-11-30T16:43:09Z",
|
|
"expires_at": "2026-12-01T16:43:08Z",
|
|
"decided_at": "2026-11-30T16:43:12Z",
|
|
"decided_by": "scribaseqa7gckwncgzo@euploading.com",
|
|
"result": {
|
|
"http_status": 200,
|
|
"body": {
|
|
"duration_ms": 11,
|
|
"lintFindings": [],
|
|
"statements": [
|
|
{
|
|
"affected_rows": 0,
|
|
"command": "DROP TABLE",
|
|
"index": 0,
|
|
"kind": "command",
|
|
"statement": "drop table public.proof_widgets"
|
|
}
|
|
],
|
|
"status": "committed"
|
|
}
|
|
},
|
|
"next": "Approved by scribaseqa7gckwncgzo@euploading.com and run exactly as sent. `result` is the response the original request would have had. Continue."
|
|
}
|
|
$ POST https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/query
|
|
-> 200
|
|
{
|
|
"kind": "rows",
|
|
"row_count": 1,
|
|
"returned": 1,
|
|
"applied_limit": 100,
|
|
"truncated": false,
|
|
"rows": [
|
|
{
|
|
"still_there": false
|
|
}
|
|
]
|
|
}
|
|
table gone (only now, after approval): True
|
|
|
|
# 9. revoke the agent token, verify the next call is a real 401
|
|
$ DELETE https://console.scribase.com/api/control/v1/account/tokens/pat-3502199cd50b40fe8f230de9d570929a
|
|
-> 200
|
|
{
|
|
"id": "pat-3502199cd50b40fe8f230de9d570929a",
|
|
"revoked": true
|
|
}
|
|
$ POST (revoked token) https://api.scribase.com/v1/organizations/proof-zjulpw10/projects/approver-proof/environments/production/database/query
|
|
-> 401
|
|
{
|
|
"type": "urn:scribase:error:unauthorized",
|
|
"title": "Unauthorized",
|
|
"status": 401,
|
|
"code": "unauthorized",
|
|
"detail": "this agent token is unknown, revoked or expired; run `scribase login`, or mint a new one with `scribase token create --scope ...`"
|
|
}
|
|
|
|
# 10. clean up -- delete the demo account
|
|
$ POST https://console.scribase.com/api/control/v1/account/deletion
|
|
-> 202
|
|
{
|
|
"scheduled": true,
|
|
"id": "acd_e94502a8621c0d62569b9f9a",
|
|
"purge_after": 1796661793,
|
|
"grace_days": 7,
|
|
"replayed": false,
|
|
"organizations_deleted": [
|
|
"proof-zjulpw10"
|
|
],
|
|
"organizations_left": [],
|
|
"refund": "none",
|
|
"confirmation_email": "sent"
|
|
}
|
|
|
|
=== SUMMARY ===
|
|
{
|
|
"mail": "scribaseqa7gckwncgzo@euploading.com",
|
|
"org": "proof-zjulpw10",
|
|
"project": "approver-proof",
|
|
"approval_id": "apr_4cef275e9dc2c3e7d6b9cb91",
|
|
"steps": {
|
|
"signup": 0.4,
|
|
"email_verified": 4.5,
|
|
"org": 4.8,
|
|
"project": 5.1,
|
|
"env_requested": 5.5,
|
|
"env_ready": 37.2,
|
|
"approver_set": 37.7,
|
|
"token_minted": 37.9,
|
|
"table_created": 38.2,
|
|
"drop_listed_unconfirmed": 38.5,
|
|
"approval_required": 38.8,
|
|
"confirmed_still_there": 39.0,
|
|
"approval_email_received": 42.3,
|
|
"approved": 42.6,
|
|
"final_state_executed": 42.9,
|
|
"confirmed_dropped": 43.2,
|
|
"token_revoked": 43.3,
|
|
"revoked_token_rejected_401": 43.5,
|
|
"account_deleted": 44.0
|
|
},
|
|
"total_s": 44.0,
|
|
"result": "the named production approver gate blocked a non-admin agent token's destructive DROP TABLE on production, required a real human approval, then ran it exactly once after approval, and a revoked token was rejected"
|
|
}
|