Skip to content

Fix audit findings: crash, broken gRPC/scripting/auth, security and robustness hardening - #7

Merged
900Labs merged 1 commit into
mainfrom
audit-fixes
Sep 5, 2026
Merged

900Labs merged 1 commit into
mainfrom
audit-fixes

Conversation

@900Labs

@900Labs 900Labs commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Full-repo audit follow-up (security, correctness, robustness, CI). 29 files, +1443/−386. All gates green: cargo fmt, clippy -D warnings, 143 workspace tests, svelte-check, 28 vitest tests, production build, docs links.

Critical fixes

  • OpenAPI import crash: self-referencing schemas (Node.children → Node) caused a stack-overflow process abort; schema sampling now has a depth limit + cycle handling (regression test included).
  • gRPC always reported success: empty/malformed response bodies no longer map to grpc_status: 0 — they now surface UNKNOWN or an HTTP-derived status, with 30 s timeouts and 50 MB response caps. (Note: full trailer support requires a hyper/tonic client — reqwest 0.12 does not expose trailers; follow-up.)
  • Inert script engine: console.log/info/warn/error and test(name, condition|fn) are now captured and reported (with volume caps); failing/throwing assertions record as failures instead of vanishing.

Security

  • Removed 'unsafe-inline' from CSP script-src.
  • Export/import commands validate paths with the same guards as write_text_file (absolute, under $HOME, no traversal, no symlinks) — closes the arbitrary file write/read gap.
  • Auth no longer silently degrades: invalid URLs, missing credentials, and malformed header values are errors instead of sending unsigned requests. OAuth1 fixed to spec (HMAC-SHA1, all query params, order-independent base string), AWS SigV4 canonical path/query encoding fixed; golden-value tests for both.
  • CI least-privilege: ci.yml read-only, release write scoped to publishing jobs, all actions SHA-pinned, concurrency groups + timeouts.
  • Git sync stages only exported *.json files (no more git add -A).

Robustness

  • WS/SSE: 30 s connect timeouts, duplicate-connect race fixed, bounded WS outbound buffer (error on overflow), UI notified when a stream dies without a Close frame, SSE decoder caps lines at 1 MB.
  • Blocking export/import/git/write commands moved to spawn_blocking (no more UI freezes); Postman/OpenAPI imports are transactional (no partial state).
  • DbError::Io/Serialization variants replace NotFound-as-garbage.
  • Numeric assertions fail with a clear message instead of silently comparing 0.
  • Frontend: MockServer polling leak fixed + state re-synced on mount; unhandled rejections surfaced in TeamWorkflows/GitSync/ApiDocs/clipboard paths; global unhandledrejection reporter.

Deliberately deferred (needs follow-up)

  • Updater + code signing/notarization (requires certificates/secrets)
  • Keychain-backed secret storage; redacting auth from history snapshots
  • Full trailer-accurate gRPC via tonic; reqwest/tokio-tungstenite/rusqlite/axum major bumps
  • i18n rollout to the 21 untranslated components; RequestBuilder.svelte split

…obustness hardening

- Guard OpenAPI schema sampling against recursive references (process abort)
- Make script engine functional: console.* capture and test() assertions
- Report honest gRPC statuses, add timeouts and 50 MB response caps
- Surface auth errors instead of sending unsigned requests; fix OAuth1
  (HMAC-SHA1, query params, ordering) and SigV4 canonicalization with
  golden-value tests
- Add WS/SSE connect timeouts, fix connection races, bounded WS outbound
  buffer, SSE 1 MB line-break cap, WS close-frame notification
- Move blocking export/import/git commands off the main thread; atomic
  Postman/OpenAPI imports; shared path validation for export/import
- Restrict Git sync staging to exported *.json files
- Fix MockServer polling leak and stale state, unhandled promise
  rejections, strict tsconfig for vite config
- Remove script-src 'unsafe-inline' from CSP; least-privilege workflow
  permissions; SHA-pin all GitHub Actions; concurrency and timeouts
@900Labs
900Labs marked this pull request as ready for review September 5, 2026 10:15
@900Labs
900Labs merged commit b3f9d13 into main Sep 5, 2026
1 check failed
@900Labs
900Labs deleted the audit-fixes branch September 5, 2026 10:15
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