fix: address pre-merge audit findings (WASM drift, RLS PII, FFI panics, config, tests)#150
Merged
Conversation
…s, config, tests) Sweep across the codebase resolving the highest-priority audit items: 1. Stale WASM (critical): the committed crates/solver/pkg/ was force-added against its own `*` gitignore, so local rebuilds were invisible to git and the binary drifted ~2 months behind the Rust source. Untrack pkg/, add scripts/ensure-wasm.mjs (rebuilds only when stale) wired as pre-hooks for dev/typecheck/test/build:apps, and give both CI `check` jobs the Rust+wasm-pack toolchain so the binding is always built fresh. 2. Submission PII (high): migration 010 restricts catune/cadecon base-table SELECT to owner+admin and exposes PII-free *_public views for community browsing (omits orcid/lab_name/notes). App reads repointed to the views; writes/deletes stay on the base tables. Adds 9 RLS matrix assertions. 3. FFI panic surfaces (high): clamp simulate bins_per_frame >= 1; validate array lengths in the WASM/PyO3 kernel-estimation wrappers (throw JsError / raise PyValueError instead of aborting the module); defensive guards + debug_assert in the core. (Audit's downsample factor==0 was a false positive — already guarded.) 4. Config-overridable tuning params: CaDecon inner-loop FISTA params moved to algorithm-store signals (identical defaults); Python kernel-length 5.0 -> named constant. 5. Cleanup + coverage: broaden .gitignore (crates/*/target, crates/*/pkg, .test_data, .playwright-mcp); add worker-pool state-machine tests. No behavior change for valid inputs; WASM binding surface is byte-identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sweep across the codebase resolving the highest-priority items from a pre-merge audit. No behavior change for valid inputs; the WASM binding surface is byte-identical. Full local CI equivalent passes (278 JS + 125 Rust tests, format/lint/typecheck/clippy/fmt).
Changes
1. Stale WASM artifact (CRITICAL)
crates/solver/pkg/was force-added against its own*gitignore, so local rebuilds were invisible togit statusand the committed binary drifted ~2 months behind the Rust source — every dev checkout and all of CI typechecked/tested the apps against a stale binding.pkg/(build-only, matching the existing intent).scripts/ensure-wasm.mjs— rebuilds only when missing/stale — wired aspredev/pretypecheck/pretest/prebuild:apps.checkjobs (ci.yml + deploy.yml) the Rust + wasm-pack toolchain so the binding is always built fresh.2. Submission PII read access (HIGH)
catune/cadeconsubmission tables grantedanon SELECT USING (true)overorcid/lab_name/notes— anyone with the public key could deanonymize contributors.010: base-table SELECT → owner+admin; PII-free*_publicviews for browsing.3. FFI panic surfaces (HIGH)
simulateclampsbins_per_frame >= 1(was degenerate for low spike rates).JsError/ raisePyValueErrorinstead of aborting the module; core has defensive guards +debug_assert.factor==0panic" was a false positive — already guarded.)4. Config-overridable tuning params
algorithm-storesignals (identical defaults).5.0→ named constant.5. Cleanup + coverage
.gitignore(crates/*/target,crates/*/pkg,.test_data,.playwright-mcp) — silences orphan dirs.Migration 010 must be applied to the production Supabase project before deploying this app build — the apps now read
*_publicviews that don't exist until 010 runs.Deferred (flagged, not in this PR)
is_admin()search_path,bandpass_filtersilent no-op, cross-language test tolerances.🤖 Generated with Claude Code