Harden client-warm cache writes against forged card and poster images
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nextjs, typescript
Hướng nghiên cứu
Start at app/api/cache-image/route.ts, then read components/WarmOnView.tsx to see how warm writes are triggered and lib/og/pngCache.ts for the cache key and expected card/poster dimensions. Check scripts/warm.mjs because it currently treats locally warmed handles as final, which affects how poisoned entries survive. Done means the route rejects unsigned/expired writes, invalid PNG bytes and wrong dimensions, enforces a documented write limit, and has tests covering unsigned, signed, bad bytes, wrong dimensions and the limit.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
POST /api/cache-image stores client-supplied bytes in R2 under a cache key built from the query string. It does not authenticate the caller, verify that the bytes are a PNG, or rate-limit writes. A third party can seed a valid-looking handle or pair with arbitrary image bytes; the card and poster routes will serve those bytes until the entry is replaced or expires.
This is a cache-poisoning and storage-abuse path, not a cosmetic issue.
Evidence
app/api/cache-image/route.ts:10-37acceptskind,login,aandb; it checks only the login shape and a 200 KB to 4 MB size before writing toGITONE_PNGS.components/WarmOnView.tsx:51-55makes the same route reachable from any public profile page.lib/og/pngCache.ts:80-86serves the stored object directly asimage/png.scripts/warm.mjs:139-142treats a handle as warmed once it is in local state, so a poisoned object can survive later warmer runs.
Expected behavior
- A warm write must prove it came from the app. Use a short-lived HMAC over
kind, the exact key, and an expiry, generated by the page or server and checked by the route. - Reject bytes that are not a valid PNG. Reject dimensions that do not match the card or poster contract.
- Add a per-IP or global write budget and a structured log line for rejected writes.
- Keep reads public; only writes need the token.
Scope
app/api/cache-image/route.tscomponents/WarmOnView.tsxlib/og/pngCache.tsfor the expected dimensions / key helpers- tests for the route
Acceptance
- Unsigned or expired warm requests return 401/403.
- A correctly signed request still stores and serves the image.
- A file with a bad PNG header or wrong dimensions returns 400 and writes nothing.
- Repeated writes are bounded by a documented limit.
- Tests cover unsigned, signed, bad bytes, wrong dimensions and the limit.
- Ngôn ngữ chính
- TypeScript
- Star
- 7
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của LangerSword/gitone
-
bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
LangerSword/gitone#7 ·
-
accessibility bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
LangerSword/gitone#6 ·
-
bug help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
LangerSword/gitone#5 ·
-
bug help wanted
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 72/100
LangerSword/gitone#4 ·
-
Add a /health endpointCó thể đã có người làm @LangerSword đã nhận hôm nay. Đang mởgood first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 45/100
LangerSword/gitone#2 · 1 bình luận ·
Tất cả issue của LangerSword/gitone
Issue tương tự
-
MCP tool results drop structuredContent when text is only a summaryCó thể đã có người làm @Pankaj-bit361 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
n8n-io/nod#1474 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Clean-up indicator: two polish points from the dev look (kit clock spacing, row description)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
inblockio/siwx-oidc-matrix-server#101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pingdotgg/t3code#42253 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày