Skip to main content

Goblin Secret Store v1 API (UI contract)

Base /api/mods/goblin-secret-store. JSON requests/responses. Never log bodies or retain passwords, protected field inputs, session tokens or backup passphrases in persistent browser storage. Use X-GSS-Session for local sessions (core forwards this header). Core authenticated operators need no local session. Errors: {error: "opaque_code"} with 400/401/403/404/409/413/429; unexpected internal failures return 500 internal_error. A missing management record returns 404 not_found; unauthorized agent lookups intentionally return a generic denial rather than revealing record existence.

Authentication​

  • GET /status → {authMode:"core"|"local", initialized:boolean, authenticated:boolean}; no secret metadata.
  • POST /bootstrap {password} → {session,expiresAt,expiresInMs}. Only auth-off, first visitor atomically claims local password on a trusted network. Minimum 12 characters. UI must explain trusted-network first-visitor claim. Clients must derive their local expiry from expiresInMs; expiresAt is informational server time.
  • POST /login {password} → {session,expiresAt,expiresInMs}; local mode only. Clients must not require synchronized server and browser clocks.
  • POST /logout → {ok:true}. All following endpoints require management authentication. Session expires after the configured sessionMs (one hour by default); mode changes clear local sessions. Keep token in memory.

Records​

  • GET /templates → {templates:[{id,fields:[{name,type,protected}]}]}. IDs token, id-secret, user-pass, ssh-key, custom.
  • GET /agents → core agent capability response (for explicit ACL assignment).
  • GET /records → {records:[Record]}
  • POST /records {name,serviceUrl?,template,fields,acl?} → {record:Record}
  • GET /records/:id → {record:Record}
  • PUT /records/:id {version,name,serviceUrl?,template,fields,acl} → {record:Record} (full replacement with optimistic version check)
  • DELETE /records/:id {version} → {ok:true}
  • PUT /records/:id/acl {version,acl} → {record:Record}

Record={id,name,serviceUrl,template,version,fields,acl}. fields=[{name,type,protected,value?}]; types text, url, username, credential, secret, token, password, private-key. Protected values are never returned. hasValue is false for an empty protected field. Public fields carry string values. All fields are strings. New records default denied. ACL is {mode:"none"|"agents"|"all",agents:string[],active:boolean}. Choosing all and Save is the explicit grant, with no second confirmation; it includes future agents. One/several agents both use agents mode. Restored ACLs are active:false and must be explicitly reassigned via ACL endpoint; even matching agent IDs are inactive. version is an opaque concurrency identity: return it unchanged on every edit/delete/ACL request, never parse or increment it. New writes use fresh UUID strings; existing legacy records may expose numeric versions until mutated. Every mutation and restore replaces the identity, revoking issued references. A stale identity returns 409 version_conflict, including across repeated restores and deleted/reintroduced IDs. Protected-field AAD binds that exact identity.

Validation bounds​

Credential names are nonempty strings of at most 256 UTF-16 code units; field names are unique within a record, nonempty, and at most 128 code units. The Settings editor trims these names before saving; direct API callers must not assume the same normalization. Field values are strings limited by UTF-8 valueBytes, including public and empty protected values. Record and field counts follow the configured limits. An ACL accepts at most 1,000 agent IDs, each a nonempty string of at most 256 code units, and deduplicates IDs. These fixed name/ACL bounds are not raised by GSS_LIMITS_JSON.

A PUT /records/:id replaces the submitted field list: omitting a field removes it. Starting in GSS 2026.11.27, omit value to retain a same-name, same-type protected value; to rename it, provide preserveFrom with the old field name and omit value. The types must match and each stored value can be carried forward only once. Supply a nonempty value to replace or clear:true without value or preserveFrom to intentionally empty it. An empty string is not an update-time clear. Empty protected fields cannot issue a managed tool reference. Send the current ACL when editing a record; omitting it defaults to No agents rather than preserving the assignment. The Settings editor supplies the current ACL for you.

Audit and portability​

  • GET /audit?date=YYYY-MM-DD&before=ID&limit=100 → {events:[{id,at,action,outcome,agentId,recordId,recordName}],nextCursor:string|null} newest first. recordName is the public credential name snapshotted at event time; it is null on older events and events without a known authorized record. Never resolve a historical ID to the current name. All parameters optional; UTC date filter, exclusive ID cursor, page size 1–500. Follow nextCursor until null; no 1000-event truncation. No protected values, field names, or passwords. Mod retention remains 10,000 events. Management authentication is mandatory.
  • POST /backup {passphrase} → {backup:string} encrypted portable JSON string. Download without logging; 12–1024 UTF-16 code units. The UTF-8 JSON restore envelope {passphrase,backup} must fit bodyBytes (default 16 MiB); export rejects with 413 backup_limit if it would not. This includes string escaping and the supplied passphrase overhead.
  • POST /restore {passphrase,backup} → {ok:true,restored:number}. Destructively replaces records after complete validation, clears references, restores all ACLs inactive. Requires explicit UI confirmation. Current installation management password stays unchanged. Backup includes all required encryption material and works on clean installations after management bootstrap. Send the unchanged archive and passphrase without additional properties under the same limits; host/proxy request limits must also allow this body size. Older numeric-revision backups remain accepted.

Agent tools​

gss_list, gss_read {id}, gss_use {id,field}. Only authorized metadata/public fields; protected use returns $burrowManaged, never plaintext. Agent identity comes solely from runtime caller context, never arguments. These tools are mod-authorized: a live enabled provider is available without stored per-agent Core tool grants. The record ACL authorizes both issuance and consumption; removing a Core per-agent tool grant does not revoke access. Revoke the record ACL or disable the provider. Consumption rechecks caller tuple, exact record version, expiry, current ACL and live provider availability. Grants do not restrict destination/command/task and revocation cannot retract plaintext already delivered.

Core credential-reference provider​

On compatible hosts, GSS registers scheme gss with context.secretReferences. Its catalog contains one reference per protected field, labeled with record and field names, plus applicable public metadata. Catalog output does not contain protected values. Resolution returns the protected field to Core's credential consumer. These are host capabilities, not additional HTTP management endpoints or new agent tools. Existing gss_list, gss_read and gss_use behavior remains separate; see operator references.

Optional Service URL​

serviceUrl is public descriptive credential metadata returned by authorized gss_list and gss_read and management record reads, without secret retrieval. It defaults to an empty string for new/legacy records. Supply an absolute HTTP(S) URL (up to 4096 characters, surrounding whitespace trimmed), or an empty string to clear it; omission on update preserves the current value. Embedded username/password URLs are rejected with invalid_service_url (400). Do not put credentials or sensitive query parameters in this public metadata. GSS does not fetch the URL or infer access from it: existing record ACLs and service-call authorization remain unchanged. Backup/restore preserves the URL, with restored grants still inactive.