Skip to content

Commit 56ba7b3

Browse files
committed
admin: refresh stale doc comments after write endpoints (Claude review)
Three doc-only fixes from Claude's review on PR #634 — the behavioural changes from this PR's commit series moved past their original comments: - ServerDeps.Tables description still said "read-only DynamoDB admin source" but TablesSource now exposes AdminCreateTable and AdminDeleteTable too. - buildAPIMux godoc layout omitted POST /dynamo/tables and DELETE /dynamo/tables/{name}, and the "(auth required, read-only)" annotation on the GET lines was wrong. - The dynamoChain wiring comment said "Read-only endpoints share the protect chain..." but the chain now serves both reads and writes; the rationale (Audit no-ops for GET) is unchanged. No behavioural change; doc-only.
1 parent 17c0fcd commit 56ba7b3

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

internal/admin/server.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ type ServerDeps struct {
3232
// ClusterInfo describes the local node's Raft state.
3333
ClusterInfo ClusterInfoSource
3434

35-
// Tables is the read-only DynamoDB admin source. Optional: a nil
36-
// value disables /admin/api/v1/dynamo/tables{,/{name}} (the mux
35+
// Tables is the DynamoDB admin source — covers list, describe,
36+
// create, and delete via TablesSource. Optional: a nil value
37+
// disables /admin/api/v1/dynamo/tables{,/{name}} (the mux
3738
// answers them with 404). This lets a build that ships only the
3839
// cluster page deploy without standing up the dynamo bridge.
3940
Tables TablesSource
@@ -143,8 +144,10 @@ func (s *Server) APIHandler() http.Handler {
143144
// POST /admin/api/v1/auth/login (no auth, rate-limited)
144145
// POST /admin/api/v1/auth/logout (auth required)
145146
// GET /admin/api/v1/cluster (auth required)
146-
// GET /admin/api/v1/dynamo/tables (auth required, read-only)
147-
// GET /admin/api/v1/dynamo/tables/{name} (auth required, read-only)
147+
// GET /admin/api/v1/dynamo/tables (auth required)
148+
// POST /admin/api/v1/dynamo/tables (auth required, full role)
149+
// GET /admin/api/v1/dynamo/tables/{name} (auth required)
150+
// DELETE /admin/api/v1/dynamo/tables/{name} (auth required, full role)
148151
//
149152
// Body limit applies uniformly. CSRF and Audit middleware apply to
150153
// write-capable protected endpoints; login and logout carry their own
@@ -204,11 +207,11 @@ func buildAPIMux(auth *AuthService, verifier *Verifier, clusterHandler, dynamoHa
204207
loginChain := publicAuth(loginHandler)
205208
logoutChain := protectNoAudit(logoutHandler)
206209
clusterChain := protect(clusterHandler)
207-
// Read-only endpoints share the protect chain so a missing
208-
// session or CSRF token still 401s/403s the same way as a write.
209-
// The Audit middleware is a no-op for GET (it only logs state-
210-
// changing methods) so we get the consistent guards without the
211-
// noise of an audit line per dashboard poll.
210+
// Dynamo endpoints (reads and writes) share the protect chain
211+
// so a missing session or CSRF token 401s/403s the same way
212+
// regardless of method. The Audit middleware is a no-op for
213+
// GET (it only logs state-changing methods) so dashboard polls
214+
// don't flood the audit log, while POST/DELETE always do.
212215
var dynamoChain http.Handler
213216
if dynamoHandler != nil {
214217
dynamoChain = protect(dynamoHandler)

0 commit comments

Comments
 (0)