Skip to content

fix(platform): audit remediation for caching, rate limiting, and ops - #1568

Closed
CluelessBiker wants to merge 5 commits into
mainfrom
fix/audit-remediation
Closed

fix(platform): audit remediation for caching, rate limiting, and ops#1568
CluelessBiker wants to merge 5 commits into
mainfrom
fix/audit-remediation

Conversation

@CluelessBiker

@CluelessBiker CluelessBiker commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up fixes from a full-stack audit of Conduit and Conduit-UI. This PR hardens the backend around caching, rate limiting, error responses, and local Docker setup.

  • Route cache invalidation — When schemas, documents, or custom endpoints change, related REST and GraphQL route caches are cleared so clients do not see stale data after writes.
  • Rate limiter fail-closed — If Redis is unavailable, rate limiting now returns 429 instead of silently allowing traffic through. OPTIONS preflight requests are skipped.
  • 409 for duplicate resourcesALREADY_EXISTS gRPC errors are mapped to HTTP 409 instead of a generic 500.
  • GET /live health endpoint — Adds a lightweight liveness route for load balancers and ops checks.
  • Docker cleanup — Removes tracked docker/.env (replaced with .env.example), fixes the authorization service port in docker-compose.yml, and ignores .pnpm-store/ and build artifacts.

Why

Stale route caches were the highest-risk finding: admin changes to schemas or endpoints could leave cached responses in place until TTL expiry. Rate-limiter bypass on Redis failure and missing health checks were medium-risk operational gaps. Tracking docker/.env in git was a security hygiene issue.

Related PRs

  • Conduit-UI (admin panel): Conduit-UI PR #302 — audit remediation for auth, errors, and environment handling on the UI side. Land both PRs together for the full audit fix.
  • Conduit (backend): Conduit PR #1567 — communications template params guard; no file overlap; both should land.

Test plan

  • Create or update a schema/document and confirm cached GET /database/... responses refresh without waiting for TTL
  • Call GET /live on the admin API — expect 200
  • Trigger a duplicate create — expect 409, not 500
  • With Redis down, confirm rate-limited routes return 429
  • docker compose up with .env copied from .env.example — authorization service starts on the correct port

Harden the platform after a full-stack audit: invalidate route caches when
schemas or custom endpoints change, fail closed on rate-limiter Redis errors,
map ALREADY_EXISTS to 409, expose GET /live for health checks, and stop
tracking docker/.env in git.
@CluelessBiker
CluelessBiker requested a review from kkopanidis July 31, 2026 10:40
Comment thread modules/database/src/utils/route-cache-invalidation.ts Fixed
CodeQL flagged incomplete sanitization in escapeRedisScanGlob — backslashes
must be escaped before other glob metacharacters so SCAN match patterns
stay literal.
Snyk runs pnpm test when package manifests change; the previous root
script always exited 1, which failed PR checks after adding hermes tests.
Move glob escaping into StateManager.invalidateCacheIndexByPrefix so
prefixes are sanitized where SCAN match patterns are built, avoiding
duplicate escaping upstream.
Comment thread libraries/grpc-sdk/src/utilities/StateManager.ts Fixed
Remove duplicate escapeRedisScanGlob, fix Redis Cluster scanStream typing,
and build grpc-sdk in the root test script so Snyk's clean-checkout test
run succeeds.
@kkopanidis

Copy link
Copy Markdown
Contributor

This PR touches too many things and introducing inconsistencies. Route cache invalidation needs global handling and not just the DB CRUD routes. Rate limiting assumes (incorrectly) that redis will go down, which if it does, it introduces more problems than the rate limit. The assumption is that redis needs an HA deployment, not mitigation on the server side. 409 is OK, /live endpoint is redundant since /ready covers the case. Docker folder's .env is being used by existing scripts and this would break functionality, while the port changes will probably do the same

@kkopanidis kkopanidis closed this Jul 31, 2026
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.

3 participants