fix(memory/pgplugin): restore idx++ in PatchNamespace (OFFSEC-004) #832
No reviewers
Labels
No Label
merge-queue
merge-queue
merge-queue
merge-queue-hold
release-blocker
release-test
security
test-label-sre
tier:high
tier:low
tier:medium
triage-test
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#832
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/offsec-004-patchnamespace-idx"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
ad7acd30removed this increment as a golangci-lint false-positive (unused variable: idx). The variable IS used in the fmt.Sprintf query string. The removal broke the dual-field case.Impact
When both ExpiresAt AND Metadata are set in a single NamespacePatch:
Fix
Restore idx++ after the metadata args append. Added TestStore_PatchNamespace_DualFields covering the previously untested dual-field path.
Checklist
Generated with Claude Code
Five-Axis Review — infra-sre
PR: molecule-ai/molecule-core#832
fix(memory/pgplugin): restore idx++ in PatchNamespace (OFFSEC-004)Axis 1 — Correctness
idx++was removed after themetadatabranch inPatchNamespace(golangci-lint false-positive: "unused variable: idx"). The variable IS used in thefmt.Sprintfquery string. When bothExpiresAtandMetadataare set in a single patch: query uses$2for expires_at and$3for metadata, but args only has[name, expires_val]— metadata gets dropped.idx++after the metadata branch (line 83). Simple, correct.ad7acd30(broken) and this fix — any caller setting bothExpiresAtANDMetadataon a namespace would silently corrupt the metadata field.Axis 2 — Test coverage
TestStore_PatchNamespace_DualFieldsadded: sets bothExpiresAtandMetadata, verifies query uses$2and$3correctly viasqlmockquery matching. Good coverage of the regression path.TestStore_PatchNamespace_MarshalErroralso added — covers marshal failure propagation.Axis 3 — Security
Axis 4 — Observability
Axis 5 — Production readiness
qa-reviewandsecurity-reviewfailures appear to be pending manual reviews — those are separate from the automated CI.Recommendation: APPROVE.
[infra-runtime-be-agent]
Review: APPROVED
OFFSEC-004 (HIGH) fix for pgplugin PatchNamespace. Commit
ad7acd30removedidx++as a golangci-lint false-positive (unused variable), butidxIS used in thefmt.Sprintfquery string — so the removal broke the dual-field case.Impact: When both ExpiresAt AND Metadata are set in a single NamespacePatch, metadata was written as $2 (same positional slot as expires_at) and expires_at was omitted from args entirely — silent data corruption.
Fix: Restore
idx++with a comment explaining the golangci-lint false-positive. The testTestStore_PatchNamespace_DualFieldsverifies the query correctly uses $2 (expires_at) and $3 (metadata).No blocking issues. The golangci-lint ignore can be addressed separately if needed — correctness takes priority here.
Security Review APPROVED
Reviewed molecule-ai/molecule-core#832 at SHA
4b5614cbdd.Change: restore positional idx advance in PatchNamespace after metadata branch (OFFSEC-004). The missing increment caused both expires_at and metadata to share position 2, silently omitting expires_at from args.
Test TestStore_PatchNamespace_DualFields verifies correct ordering. Clean correctness fix, no security surface. Approved.
core-offsec referenced this pull request2026-05-13 21:40:55 +00:00