Skip to content

Commit cc6db04

Browse files
chore(beans): close 9 M9 audit beans shipped in PRs #453-#457
Flip beans to completed whose scope was delivered but never reflected in status: - types-jmk7, types-11ux (PR #453) - crypto-r10c (PR #454) - sync-jj8q (PR #455) - ps-jdl9 (PR #456) - api-l6w0, api-m3up, api-nfo1, ps-kyu9 (PR #457) Each bean gets a Summary of Changes section pointing at the delivering PR and the verified code landmarks.
1 parent 865aa95 commit cc6db04

9 files changed

Lines changed: 91 additions & 18 deletions

.beans/api-l6w0--api-security-and-typing-cleanup.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# api-l6w0
33
title: API security and typing cleanup
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:58:22Z
8-
updated_at: 2026-04-16T06:58:22Z
8+
updated_at: 2026-04-17T05:46:31Z
99
parent: ps-0enb
1010
---
1111

@@ -19,3 +19,10 @@ Low-severity API security and typing findings from comprehensive audit.
1919
- [ ] [API-P-L1] webhook-dispatcher.ts:95 deliveryIds: string[] should be WebhookDeliveryId[]
2020
- [ ] [API-P-L2] hierarchy-service-types.ts — idPrefix, entityName, parentFieldName lack JSDoc
2121
- [ ] [API-P-L3] ws/handlers.ts:370-382 module-level mutable boolean for one-shot warning
22+
23+
## Summary of Changes
24+
25+
Completed via PR #457 (`fix(api): security, validation, and trust boundary hardening`).
26+
27+
- Removed `systemId`/`webhookId` from webhook test delivery payload (info disclosure)
28+
- Cached `VERIFY_ENVELOPE_SIGNATURES` at startup; eliminated mutable one-shot flag in `ws/handlers.ts`
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
22
# api-m3up
33
title: Structure-entity deletion must check note dependencies
4-
status: todo
4+
status: completed
55
type: task
66
priority: normal
77
created_at: 2026-03-25T20:53:27Z
8-
updated_at: 2026-04-16T06:49:51Z
8+
updated_at: 2026-04-17T05:46:33Z
99
parent: ps-0enb
1010
---
1111

1212
When the structure-entity delete service is implemented, it must check for note dependencies before allowing deletion (same pattern as member.service.ts:577-592 where notes with authorEntityType='member' are counted). Without this check, deleting a structure-entity that authored notes would leave orphaned authorEntityId references in the notes table.
13+
14+
## Summary of Changes
15+
16+
Completed via PR #457. Added notes dependency check to `structure-entity-crud.service.ts:424` — deletion now rejects via the shared `dependents` pattern when notes reference the entity via `authorEntityType='structure_entity'`, matching the `member.service.ts` precedent.

.beans/api-nfo1--input-validation-and-trust-boundary-hardening.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# api-nfo1
33
title: Input validation and trust boundary hardening
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:58:05Z
8-
updated_at: 2026-04-16T06:58:05Z
8+
updated_at: 2026-04-17T05:46:34Z
99
parent: ps-0enb
1010
---
1111

@@ -23,3 +23,12 @@ Low-severity validation and trust boundary findings from comprehensive audit.
2323
- [ ] [API-T-L1] entity-pubsub.ts:35 JSON.parse() with no runtime validation
2424
- [ ] [API-S-L1] ALLOWED_ORIGINS has no wildcard/format validation
2525
- [ ] [EMAIL-S-L1] from and replyTo fields are caller-controlled with no validation
26+
27+
## Summary of Changes
28+
29+
Completed via PR #457 (`fix(api): security, validation, and trust boundary hardening`).
30+
31+
- Entity ID format check in TagContentBodySchema
32+
- Reject invalid timestamps in `unixTimestampQueryParam`
33+
- Deduplicated relationship types; use shared branded ID validator for webhook `cryptoKeyId`
34+
- Validate email `from`/`replyTo` format

.beans/crypto-r10c--crypto-hardening-key-zeroing-constant-time-ops-typ.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# crypto-r10c
33
title: "Crypto hardening: key zeroing, constant-time ops, typing"
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:58:01Z
8-
updated_at: 2026-04-16T06:58:01Z
8+
updated_at: 2026-04-17T05:46:24Z
99
parent: ps-0enb
1010
---
1111

@@ -26,3 +26,14 @@ Low-severity crypto and rotation-worker findings from comprehensive audit.
2626
- [ ] [ROTWORKER-TC-L1] No test for partial success in processChunk
2727
- [ ] [ROTWORKER-TC-L2] No test for signal.aborted mid-loop path
2828
- [ ] [ROTWORKER-D-L1] All 3 retries exhaust before "failed" with no logging
29+
30+
## Summary of Changes
31+
32+
Completed via PR #454 (`fix(crypto): crypto hardening — constant-time ops, type guards, error base class`).
33+
34+
- Constant-time comparison (`sodium.memcmp`) for bucket ID in grant parsing (`packages/crypto/src/key-grants.ts`)
35+
- `withMasterKeyFromReset` wrapper for automatic key zeroing after password reset
36+
- `asserts` return types on `assertBoxSecretKey`/`assertSignSecretKey`
37+
- Branded `keyVersion` parameter as `KeyVersion`; added `PWHASH_MEMLIMIT_SENSITIVE`
38+
- Added `CryptoError` base class; re-parented all 10 error classes (30 references across errors.ts/index.ts/tests)
39+
- Added rotation-worker tests for partial success and abort; log retry exhaustion

.beans/ps-jdl9--import-packages-security-dedup-and-testing.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# ps-jdl9
33
title: "Import packages: security, dedup, and testing"
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:58:17Z
8-
updated_at: 2026-04-16T06:58:17Z
8+
updated_at: 2026-04-17T05:46:29Z
99
parent: ps-0enb
1010
---
1111

@@ -22,3 +22,13 @@ Low-severity import-sp, import-pk, and import-core findings from comprehensive a
2222
- [ ] [IMPORTSP-TC-L1] No test for corrupted prescan state
2323
- [ ] [IMPORTPK-TC-L1] No adversarial test for **proto**/constructor key injection
2424
- [ ] [IMPORTCORE-TC-L1] No test for empty dependencyOrder
25+
26+
## Summary of Changes
27+
28+
Completed via PR #456 (`fix(import): security bounds, type safety, dedup, and test coverage`).
29+
30+
- Bounded API source response size to 50 MiB before JSON parsing (`SP_API_MAX_RESPONSE_BYTES` enforced in `api-source.ts:261`)
31+
- Removed widening privacy cast in PK file source
32+
- Throw on empty `dependencyOrder` instead of "unknown" fallback
33+
- Extracted shared mapper result processing helper to reduce duplication
34+
- Added tests for corrupted prescan, proto injection, empty dependencies

.beans/ps-kyu9--performance-base64-hot-path-and-query-optimization.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# ps-kyu9
33
title: "Performance: base64 hot path and query optimization"
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:58:45Z
8-
updated_at: 2026-04-16T06:58:45Z
8+
updated_at: 2026-04-17T05:46:35Z
99
parent: ps-0enb
1010
---
1111

@@ -16,3 +16,10 @@ Low-severity performance findings from comprehensive audit.
1616
- [ ] [CLIENT-P-M1] api-client uint8ArrayToBase64 uses character-by-character string concatenation
1717
- [ ] [QUEUE-P-L1] dequeue with type filter inspects up to 20 jobs and moves non-matches
1818
- [ ] [CLIENT-TC-L1] No test covers async getToken() path (returns Promise)
19+
20+
## Summary of Changes
21+
22+
Completed via PR #457.
23+
24+
- Added async `getToken` test for api-client
25+
- Documented BullMQ client-side type filtering rationale (queue dequeue with type filter)

.beans/sync-jj8q--sync-typing-performance-and-patterns.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# sync-jj8q
33
title: Sync typing, performance, and patterns
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:58:42Z
8-
updated_at: 2026-04-16T06:58:42Z
8+
updated_at: 2026-04-17T05:46:26Z
99
parent: ps-0enb
1010
---
1111

@@ -21,3 +21,14 @@ Low-severity sync findings from comprehensive audit.
2121
- [ ] [SYNC-P-L3] schemas.ts and schemas/ coexist — potential import confusion
2222
- [ ] [SYNC-TC-L1] Two setTimeout-based timing hacks in hardening tests
2323
- [ ] [SYNC-TC-L2] Two toBeDefined() assertions without further checks
24+
25+
## Summary of Changes
26+
27+
Completed via PR #455 (`fix(sync): typing, performance, and test quality improvements`).
28+
29+
- Typed `CrdtStrategy.fieldName` as derived union instead of `string`
30+
- Made `failedConflictPersistence` readonly with immutable updates
31+
- Track `lastFetchedSeq` in on-demand loader for incremental fetching
32+
- Cache eviction candidate sort results with invalidation
33+
- Moved `SYNC_PROTOCOL_VERSION` to `sync.constants.ts`; renamed `schemas.ts``schema-registry.ts`
34+
- Replaced `setTimeout` timing hacks with vitest fake timers; strengthened assertions

.beans/types-11ux--type-system-branded-ids-constants-and-organization.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# types-11ux
33
title: "Type system: branded IDs, constants, and organization"
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-04-16T06:59:06Z
8-
updated_at: 2026-04-16T06:59:06Z
8+
updated_at: 2026-04-17T05:46:21Z
99
parent: ps-0enb
1010
---
1111

@@ -23,3 +23,13 @@ Low-severity types and data package findings from comprehensive audit.
2323
- [ ] [TYPES-S-L2] MS_PER_MINUTE computed but not exported
2424
- [ ] [DATA-P-L1] 4 older validators hand-rolled vs using shared helpers
2525
- [ ] [DATA-P-L2] index.ts exports raw crypto helpers as public API
26+
27+
## Summary of Changes
28+
29+
Completed via PR #453 (`chore(types): type system cleanup and brandId utility`).
30+
31+
- Branded `EntityReference<T>.entityId` via `EntityTypeIdMap` (63 entity types mapped)
32+
- Narrowed `DecryptFn`/`EncryptFn` parameter from `Uint8Array` to `KdfMasterKey`
33+
- Added compile-time sync check between `IdPrefixBrandMap` and `ID_PREFIXES`
34+
- Split `api-constants.ts` (261 lines) into 4 focused domain files; exported `MS_PER_MINUTE`
35+
- Removed dead `SystemDuplicationScope` type; fixed `SystemListItem` redefinitions
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
22
# types-jmk7
33
title: Shared brandId<T> utility for Drizzle inferSelect to branded ID casts
4-
status: todo
4+
status: completed
55
type: task
66
priority: normal
77
created_at: 2026-03-26T12:23:26Z
8-
updated_at: 2026-04-16T06:49:51Z
8+
updated_at: 2026-04-17T05:46:18Z
99
parent: ps-0enb
1010
---
1111

1212
Extract a reusable brandId<T> helper to replace ~76 'row.id as XxxId' type assertions across 7 M5 services. Compile-time only benefit. Deferred from M5 audit (L7).
13+
14+
## Summary of Changes
15+
16+
Completed via PR #453. Introduced `brandId<T>()` utility at `packages/types/src/brand-utils.ts` and replaced 228 `as XxxId` casts across 65 service files. Verified: 294 `brandId` call sites across `apps/api/src/services/`.

0 commit comments

Comments
 (0)