Skip to content

[SECURITY][FLEET UPLOADS] Verify file signatures and reject image bombs #190

Description

@Obiajulu-gif

Summary

Vehicle uploads trust the caller-provided Content-Type and do not run the KYC file signature checks. A file labeled as an image can contain another format or pathological dimensions.

Repository evidence

  • app/api/upload/route.ts:71-85 checks the MIME header and byte length for both scopes.
  • Only the KYC branch calls validateKycFile at app/api/upload/route.ts:89-105; the vehicle branch writes bytes directly at :180-185.

Scope

  • Decode and validate approved image formats by magic bytes and bounded dimensions/pixels.
  • Normalize images or reject malformed, polyglot, truncated, and decompression-bomb inputs.

Acceptance criteria

  • Header-only MIME spoofing cannot pass.
  • Validation limits are shared, documented, and enforced before storage.

Tests

  • Use mismatched headers, polyglots, oversized dimensions, truncated files, and valid JPEG/PNG/WebP fixtures.

Non-goals

  • Adding new accepted image formats.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions