Skip to content

Critical Validations Needed #123

@DomGarguilo

Description

@DomGarguilo
  1. Frame Duration Bounds
    - Reject animations with frameDuration < 16ms (too fast for human eye)
    - Reject animations with frameDuration > 300000ms (5+ minutes causes UX issues)
  2. Memory Protection
    - Calculate total queue memory: sum(animations.length * frameCount * 768 bytes)
    - Reject if total exceeds maxQueueSizeBytes
    - Validate each frame is exactly 768 bytes
  3. Loop Prevention
    - Limit repeatCount to prevent near-infinite loops
    - Limit total frames to prevent memory exhaustion
  4. Injection Prevention
    - Sanitize animationID and frameID strings
    - Prevent path traversal attempts (../, ./, etc.)
    - Use allowlist patterns for IDs
  5. Queue Bounds
    - Limit total animations in single metadata update
    - Prevent oversized individual animations

Implementation Notes

  • Validate on metadata endpoint before storing/sending to ESP32
  • Return clear error messages for validation failures
  • Log validation failures for monitoring
  • Consider rate limiting to prevent spam validation attempts

Acceptance Criteria

  • All timing values validated within safe bounds
  • Memory usage calculated and limited
  • String inputs sanitized and length-limited
  • Queue size limits enforced
  • Clear error responses for validation failures
  • Validation failures logged for monitoring

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions