Repository navigation
fix(social): verify weekly claims by uploaded artifact ID - #716
Conversation
🤖 MERGED
GitHub merged this pull request.
fa3f1bd9-d268-46a1-a373-a81a44a89846 Selected findings run after merge and open separate pull requests. |
There was a problem hiding this comment.
Harlan Agent Kit posted this automated review. AI open source policy.
Automated Review: READY.
Optional follow-ups
Minor (78/100) · A stale prepare lookup can allow duplicate weekly posts
If a queued or manually dispatched run gets a stale zero-count result from the prepare lookup after a prior run has sent, it can upload another artifact with the same destination and week. GitHub permits the same artifact name in separate runs. The destination lock serializes the jobs, but the new publish check accepts each run's own artifact and no longer requires a unique claim. Both runs can post publicly.
Optional follow-up: Require a fresh name lookup for prior claims before uploading under the existing destination lock, and keep the direct artifact check before sending.
Trivial (35/100) · Publish test bypasses artifact lookup and claim enforcement
The test calls assertWeeklyClaim with a hard-coded artifact, then calls publishWeeklySocial separately. It never exercises the publishing command that reads the upload output and fetches the artifact. The test would still pass if that command ignored the artifact ID, used the list endpoint, or skipped claim verification.
Optional follow-up: Add a publish-entry-point test that verifies the artifact request and blocks the destination POST for a mismatched claim.
| // The prepare lookup can remain cached for 60 seconds after upload. | ||
| // Read the uploaded artifact directly instead of repeating that list request. | ||
| const artifactId = z.string().regex(/^\d+$/).parse(process.env.SKILLD_WEEKLY_CLAIM_ARTIFACT_ID) | ||
| assertWeeklyClaim(await weeklyClaims({ artifactId }), { |
There was a problem hiding this comment.
Minor (78/100): A stale prepare lookup can allow duplicate weekly posts
If a queued or manually dispatched run gets a stale zero-count result from the prepare lookup after a prior run has sent, it can upload another artifact with the same destination and week. GitHub permits the same artifact name in separate runs. The destination lock serializes the jobs, but the new publish check accepts each run's own artifact and no longer requires a unique claim. Both runs can post publicly.
Require a fresh name lookup for prior claims before uploading under the existing destination lock, and keep the direct artifact check before sending.
- Ask an agent to verify and fix this finding
Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy.
| const fetchImpl = vi.fn<typeof fetch>() | ||
| .mockResolvedValueOnce(Response.json({ guild_id: '931135234261532713', channel_id: '2' })) | ||
| .mockResolvedValueOnce(Response.json({ id: '123' })) | ||
| assertWeeklyClaim(claim, expectedClaim) |
There was a problem hiding this comment.
Trivial (35/100): Publish test bypasses artifact lookup and claim enforcement
The test calls assertWeeklyClaim with a hard-coded artifact, then calls publishWeeklySocial separately. It never exercises the publishing command that reads the upload output and fetches the artifact. The test would still pass if that command ignored the artifact ID, used the list endpoint, or skipped claim verification.
Add a publish-entry-point test that verifies the artifact request and blocks the destination POST for a mismatched claim.
- Ask an agent to verify and fix this finding
Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy.
Publishing repeats a cacheable artifact-list request, which can omit the newly uploaded claim and reject its owner. Verify the uploaded artifact directly, checking its ID, name, expiry, and owning run before sending.