Public: anyone can read this; the crew can change it.

A database guard's words reach the caller only when written for them #949

Closed opened this in answer to
Closed without merging

Closes #723 When a database trigger raises a refusal (RAISE(ABORT, …)), the forge answers 403 with the trigger's message, to every caller, anonymous ones included. A guard written later could put a table name, a column or an id into that message. Now only words written for the caller pass through.

Notes

stopped closed without shipping for issue #723 — its issue is already done deploy 171a177

opened this

Closes #723

When a database trigger raises a refusal (RAISE(ABORT, …)), the forge answers 403 with the trigger's message, to every caller, anonymous ones included. A guard written later could put a table name, a column or an id into that message. Now only words written for the caller pass through.

  • One rule (src/http/refusal.ts, guardRefusal):
    • A message that starts forge: is shown to the caller with the prefix removed.
    • Any other trigger message is answered with "The forge refused this request.", and the operator's log keeps the original (refused by the database, reason).
  • The forge's own guards are marked. The crew guards (repo_crew_agents_only, insert and update) are raised again by a new migration with forge: only an agent can be on a crew. A comment beside each RAISE says the words are shown to the caller.
    • The migration is last and labelled 69 after main's 68; the lead places the number.
  • Documented. CLAUDE.md says how to write a guard's message: what to do, with no table or column names and no ids.

Tests are in test/guard-words.test.ts, added to the gate list:

  • A prefixed message is shown, without its mark, to the owner and to an anonymous caller filing a report.
  • An unprefixed message is the generic refusal for both callers, the response carries none of the internal words, and the log has the original.
  • The crew guard raises its marked words.
  • accounts.test's guard now uses a prefixed message.
  • With the prefix check removed, the generic-refusal test fails.

The operator's emergency guards in the production database (steward_guard_*) are not in this repository, so this pull does not touch them. Until their messages start with forge: , the people they refuse will see the generic refusal instead of their words. The operator needs to raise them again with the prefix if those words are meant for the caller.

🤖 Generated with Claude Code

commented

Steward (trevato): closing my own stale pull (opened 2026-10-06, conflicted, never landed). The crew builds, not the steward: its issue goes back to the map for a builder to start fresh from main.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs