Skip to content

Refactoring#124

Merged
CedrikNikita merged 6 commits intodevelopfrom
feature/refactoring
May 7, 2026
Merged

Refactoring#124
CedrikNikita merged 6 commits intodevelopfrom
feature/refactoring

Conversation

@CedrikNikita
Copy link
Copy Markdown
Collaborator

@CedrikNikita CedrikNikita commented Apr 21, 2026

Note

Medium Risk
Touches API surface hardening (CORS, Swagger/GraphQL introspection, websocket behavior, API key auth) and DB sync behavior; misconfiguration could break clients or deployments, but changes are mostly additive safeguards.

Overview
Hardens production security defaults and reduces accidental data/PII exposure. Swagger is now disabled in production unless ENABLE_SWAGGER=true, GraphQL introspection/GraphiQL are disabled in production, helmet is added, and CORS/socket.io origins become configurable via new ALLOWED_ORIGINS parsing with credentials only enabled when an explicit allowlist is set.

Tightens sensitive endpoints and guards. TRENDING_TAGS_API_KEY no longer has a default, production logs warn when it’s missing/too short, and the ApiKeyGuard enforces minimum length plus constant-time comparison. Affiliation invite redemption now returns only minimal data (no full OAuth profile / claimed-by fields).

Reduces operational foot-guns. TypeORM DB_SYNC is ignored in production with a warning (preventing destructive schema sync), compose files bind Postgres/Redis ports to loopback, testnet runs with NODE_ENV=staging to keep DB_SYNC usable, and the Docker image runs as the unprivileged node user.

Fixes injection/broadcast vectors. The token rankings raw SQL query is parameterized, and the token websocket gateway removes client-driven @SubscribeMessage relays so only server-side services can emit events.

Reviewed by Cursor Bugbot for commit a0d5d4c. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0ddde14. Configure here.

Comment thread src/configs/constants.ts
Comment thread src/tokens/token-websocket.gateway.ts Outdated
Comment thread src/tokens/token-websocket.gateway.ts
Comment thread src/main.ts
@CedrikNikita CedrikNikita force-pushed the feature/refactoring branch 2 times, most recently from e312509 to b64a863 Compare April 21, 2026 08:14
@CedrikNikita CedrikNikita force-pushed the feature/refactoring branch from b64a863 to 6c0bf75 Compare May 7, 2026 05:37
@CedrikNikita CedrikNikita force-pushed the feature/refactoring branch from 6c0bf75 to a0d5d4c Compare May 7, 2026 05:48
@CedrikNikita CedrikNikita merged commit 217bbad into develop May 7, 2026
2 checks passed
@CedrikNikita CedrikNikita deleted the feature/refactoring branch May 7, 2026 05:59
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