Skip to content

Validate JSON parsed from Redis before trusting cache payloads #1101

Description

@nanaf6203-bit

Context

redisCache.ts (and propertyCache paths) JSON.parse Redis payloads and cast/return them as Property/SearchResult without schema validation.

Problem

A poisoned or stale cache entry (or partial write) yields malformed objects into UI rendering, potentially causing runtime crashes or injected markup via dangerouslySetInnerHTML-adjacent paths.

Proposed approach

Parse through zod schemas (src/types/property schemas) with a safe fallback to miss/regenerate; log parse failures via structured logger.

Acceptance criteria

  • Cached values validated or safely discarded on mismatch
  • Parse failure counted in stats/logs
  • Unit test with corrupted payload

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programTrivial ComplexitysecuritySecurity issue or hardening opportunitytype-safetyTypeScript typing or any-cast removal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions