Skip to content

feat: add input validation/sanitization and error handling/logging in real-time gateway endpoints#145

Open
slopefields wants to merge 6 commits intodevfrom
justin_yoo/feature/endpoint_sanitization
Open

feat: add input validation/sanitization and error handling/logging in real-time gateway endpoints#145
slopefields wants to merge 6 commits intodevfrom
justin_yoo/feature/endpoint_sanitization

Conversation

@slopefields
Copy link
Member

@slopefields slopefields commented Mar 17, 2026

Description

Adds input (body, header, query) validation/sanitization and error handling/logging across real-time gateway endpoints

  • Plaky feature name: "Add comprehensive, Add input validation and sanitization for all API endpoints, error handling and logging middleware across all API endpoints"
  • Component, feature, or system affected: real-time gateway routes and input validation middleware
  • Purpose of change: improve endpoint reliability and request handling

Changes

  • Added standardized validation for request body, header, and query parameters
  • Added standardized sanitization of incoming request data before processing
  • Added/improved error logging for invalid requests and failures

Related

Related PRs (not dependent):
deepiri-external-bridge-service: Team-Deepiri/deepiri-external-bridge-service#35
deepiri-auth-service: Team-Deepiri/deepiri-auth-service#31
deepiri-api-gateway: Team-Deepiri/deepiri-api-gateway#40


Testing

  • Ran endpoint checks with dummy requests and confirmed validation/sanitization behavior
  • Verified service still builds successfully and health endpoint responds

Workflow Checklist

  • Branch is up to date with dev
  • PR is from branch → dev
  • PR title follows convention (feat:, fix:, refactor:, etc.)
  • Plaky feature/bug name included above
  • Tagged @Team-Deepiri/support-team
  • Plaky feature moved to "Needs QA"

Review Requests

@Team-Deepiri/support-team

const MAX_BODY_KEYS = 50;
const MAX_STRING_VALUE_LENGTH = 10000;
const APP_HEADER_PREFIX = 'x-';
const ALLOWED_GAMIFICATION_EVENT_TYPES = new Set([
Copy link
Member

Choose a reason for hiding this comment

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

This is useless, we don't need gamification types

};
};

export const validateEmitGamificationBody: BodyValidator = (body: Record<string, unknown>): string | null => {
Copy link
Member

Choose a reason for hiding this comment

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

Gamification is depreciated

res.json({ success: true });
});
// Emit based on type
switch (type) {
Copy link
Member

Choose a reason for hiding this comment

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

Factor this out, this is unnecessary

@jrb00013
Copy link
Member

@slopefields

@jrb00013
Copy link
Member

@Team-Deepiri/support-team someone test this

@slopefields reference your other PRs from other repos into here

@jrb00013
Copy link
Member

@slopefields take out all gamification stuff

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.

2 participants