Skip to content

Chore/audit fixes 20260601 1540 - #81

Merged
agjs merged 16 commits into
mainfrom
chore/audit-fixes-20260601-1540
Jun 1, 2026
Merged

Chore/audit fixes 20260601 1540#81
agjs merged 16 commits into
mainfrom
chore/audit-fixes-20260601-1540

Conversation

@agjs

@agjs agjs commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • bun run check (or bun run check:full for the cross-app pass) from the repo root
  • Stack smoke if compose/infra touched: cd infra/compose/compose && ./dev.sh up

App merge bars

Area Command
API cd apps/api && bun run validate
UI cd apps/ui && bun run validate
Docs cd apps/docs && bun run build:ci
Repo drift bun run check (from repo root)

Conventions

  • No any, no blind as, no !
  • New env vars in schema + .env.example (+ SECURITY.md when relevant)
  • Tests updated for changed behavior

Screenshots

agjs added 16 commits June 1, 2026 15:41
Matches root/ui/docs; removes monorepo Bun-version ambiguity.

Audit: F006
actions/checkout@v6.0.2, oven-sh/setup-bun@v2.2.0, lycheeverse/lychee-action@v2.8.0, opentofu/setup-opentofu@v2.0.1 — restores the repo's SHA-pin supply-chain posture. SHAs for lychee/opentofu resolved from each repo's latest release via GitHub API.

Audit: F002
Unifies on 7c1e4cf0 (v4), the SHA used by the other 10 security workflows.

Audit: F003
Removes a root RCE vector (unverified remote installer piped to bash) from first-boot cloud-init. Distro packages are GPG-verified by apt and need no SHA pin to maintain.

Audit: F001
Adds per-chunk gzip budgets for the 16 previously-unbudgeted lazy pages (SettingsPage 20KB down to NotFoundPage 2KB) so route-level bundle bloat is caught in CI, not in production. Budgets set ~30-50% above measured size.

Audit: F004
Adds apps/api/.dockerignore and apps/ui/.dockerignore to the prod-image-build paths filter so a .dockerignore edit (e.g. excluding a sensitive file) triggers a rebuild instead of leaving a stale image.

Audit: F011
…on overrides

5s default expect timeout was below full-stack assertion latency, causing false failures on slow CI. Raises baseline to 12s and removes the scattered 5s/10s overrides (all positive waits, so higher is strictly safer) so specs share one consistent timeout.

Audit: F009
Adds DATABASE_POOL_SIZE, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, RESEND_WEBHOOK_SECRET, SENDGRID_WEBHOOK_PUBLIC_KEY (the 5 schema vars genuinely absent — the other vars the audit listed were already present as commented entries).

Audit: F007
The page claimed to be 'generated from the registry' but hand-maintained static rule lists while LintMetaCatalog (and its generator + check) sat unused. Wire LintMetaCatalog into the page (mirroring ScriptsCatalog) so the claim is true and the lists can't drift, and regenerate the stale catalog JSON (ui 24->25, api 18->19).

Audit: F008
Replaces the Date.now()+Math.random() email suffix (theoretical collision window) with randomUUID(), making the unique-email index collision impossible by construction across parallel workers and re-runs. Removes the need for partial-state cleanup since a UUID email is never reused.

Audit: F010
Depending on me.data?.user re-ran the effect on every query refetch (new object reference) even when the identity was unchanged, re-firing Sentry.setUser. Depend on the stable id/email scalars instead.

Audit: F012
Adds a complete @sentry/react mock to the test setup so specs run off the real SDK and can assert capture/user calls, plus an ErrorBoundaryProvider test covering the happy path and the captureException-on-throw path.

Audit: F013
Adds a //overrides key (ignored by package managers; JSON has no comments) explaining the ws/devalue/qs/tmp security pins and cross-referencing osv-scanner.toml, so maintainers can safely prune them later.

Audit: F014
Explains why the template-preview script reads PREVIEW_PORT directly instead of via the validated env schema (dev-only, never runs in the deployed app), so the raw process.env read is intentional and discoverable.

Audit: F015
ScriptsCatalog/LintMetaCatalog cast imported JSON to a type without checking the template key exists (LintMetaCatalog silently rendered empty via ?? []). Narrow to | undefined and throw a clear, actionable build-time error so a corrupt/stale catalog surfaces immediately.

Audit: F016
Encode the stack's core value into both skills: when a finding is a *class*
of defect a linter/parser can catch, the fix is the guardrail PLUS the code
change — extend or create the rule, surface the bug through it (RED), then fix
(GREEN), then lock it in with a test + regenerated docs.

- audit-monorepo: new `guardrail` field on every finding (layer + rule to
  add/extend), classification mindset rule, and higher-leverage ranking for
  enforceable findings. Auditor now flags guardrail GAPS (a class a rule claims
  to cover but missed — e.g. action SHA-pinning had no lint-meta rule).
- execute-audit: new "Guardrail-first remediation" section + loop step that
  prefers extending lint-meta (in-repo) over one-off patches, with the
  eslint-plugins repo (cross-repo) noted as the other layer.
@agjs
agjs merged commit c70dffa into main Jun 1, 2026
31 checks passed
@agjs
agjs deleted the chore/audit-fixes-20260601-1540 branch June 1, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant