Address review: redact plant owner ids, cache-control, 400, DRY reset
Build image / build-and-push (push) Successful in 15s
Build image / build-and-push (push) Successful in 15s
- Security (2-model, security+correctness): the public payload zeroed Garden.OwnerID but referenced custom plants still carried Plant.OwnerID, leaking the owner's user id to anonymous viewers. Redact plant owner ids too, and assert it in the service test. - Set Cache-Control: no-store on the public read so a capability-URL response isn't held in a shared proxy cache and always reflects the live garden. - createShareLink now 400s on a present-but-malformed JSON body instead of silently enabling (an empty body still means enable-without-rotate). - Extract the transient-editor-state reset into a shared resetTransient store action (3-model finding) and use it from PublicGardenPage. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JdQpdYYsTgtkJBxbcpAszi
This commit is contained in:
@@ -84,6 +84,13 @@ func TestPublicShareLink(t *testing.T) {
|
||||
t.Errorf("public full = %d objs / %d plops / %d plants, want 1/1/1",
|
||||
len(full.Objects), len(full.Plantings), len(full.Plants))
|
||||
}
|
||||
// The referenced plant is the owner's custom plant; its OwnerID must be
|
||||
// redacted so an anonymous viewer can't learn the owner's user id.
|
||||
for _, pl := range full.Plants {
|
||||
if pl.OwnerID != nil {
|
||||
t.Errorf("public plant %d leaks OwnerID %d, want nil", pl.ID, *pl.OwnerID)
|
||||
}
|
||||
}
|
||||
|
||||
// Unknown / blank tokens are masked, never a distinct error.
|
||||
for _, bad := range []string{"does-not-exist", " ", ""} {
|
||||
|
||||
Reference in New Issue
Block a user