Repository navigation
chore(audit): verify release candidate evidence and gate compliance - #1
Conversation
…isterMediaRoutes with regression tests
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6400eaef1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!claim.claimed) { | ||
| if (claim.row.status === 'SUCCEEDED' && claim.row.response_json) { | ||
| const rid = (req as Request & { id?: string }).id ?? '' | ||
| res.json(ok(rid, claim.row.response_json)) | ||
| return |
There was a problem hiding this comment.
Authenticate before replaying device-upload idempotency keys
The successful-replay branch returns response_json before verifying the device signature, so anyone who knows a site's device code and a previously successful idempotency key can retrieve the cached response without valid HMAC credentials; in MinIO mode that response includes a presigned media URL. The earlier claim also lets invalid requests create FAILED rows before authentication. Verify the signature before claiming or replaying, and compare the stored request hash before returning a cached response.
Useful? React with 👍 / 👎.
| '/media/device-upload', | ||
| upload.single('file'), | ||
| async (req: Request, res: Response, next: NextFunction) => { | ||
| const headers = DeviceMediaUploadHeaderSchema.parse({ |
There was a problem hiding this comment.
Catch validation errors in the Express 4 handler
A request missing any required device header throws during this schema parse, before the handler's try block. This API uses Express 4, which does not forward rejected async-handler promises to error middleware; the server's unhandled-rejection listener only logs them, leaving the request without a response. Move the parsing and other early operations inside the try block so failures reach next(err).
Useful? React with 👍 / 👎.
| const stored = await storeUploadedMedia({ | ||
| buffer: file.buffer, | ||
| mimeType: mime, | ||
| originalName: file.originalname ?? null, | ||
| siteCode: headers['x-site-code'], |
There was a problem hiding this comment.
Persist device uploads so their URLs can be renewed
When MEDIA_STORAGE_DRIVER=MINIO, storeUploadedMedia returns a presigned viewUrl that expires, but this handler neither creates a gate_read_media record nor returns a mediaId. A later capture that uses this URL stores it as an external URL, which the new /media/:mediaId/view route cannot refresh; after the presigned URL expires, the uploaded evidence is inaccessible through the API. Persist the media metadata and return an ID that can be used to generate a fresh view URL.
Useful? React with 👍 / 👎.
…elog and query regression
Release candidate verification for Parkly parking platform.