Skip to content

fix(face-validator): reject images exceeding 8000x8000 resolution - #1730

Open
singhanurag0317-bit wants to merge 1 commit into
souma9830:masterfrom
singhanurag0317-bit:feat/issue-811
Open

fix(face-validator): reject images exceeding 8000x8000 resolution#1730
singhanurag0317-bit wants to merge 1 commit into
souma9830:masterfrom
singhanurag0317-bit:feat/issue-811

Conversation

@singhanurag0317-bit

Copy link
Copy Markdown

Fix: Missing image resolution boundary check in face quality check

Closes #811

Problem

The assess_face_quality endpoint loads user-provided images directly into OpenCV via cv2.imread without validating their resolution. An extremely large upload (pixel-bomb) could exhaust memory and crash the process.

Change

  • Added check_image_resolution() in python-ai-service/app/services/face_validator.py that reads dimensions cheaply via PIL header metadata (Image.open(path).size) — no full pixel decode.
  • validate_image_bytes() now rejects any image whose width or height exceeds MAX_DIMENSION = 8000 before the OpenCV decode step.
  • New python-ai-service/app/services/test_face_validator_resolution.py covering normal-size accept plus over-limit rejection (width, height, and both).

Tests

  • New pytest cases: test_accepts_normal_size_image, test_rejects_image_with_both_dimensions_over_limit, test_rejects_image_wider_than_limit, test_rejects_image_taller_than_limit.

Verification

  • CI will run pytest on the python-ai-service.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@singhanurag0317-bit is attempting to deploy a commit to the souma9830's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Missing image resolution boundary check in face quality check

1 participant