Skip to content

fix(social): verify weekly claims by uploaded artifact ID - #716

Merged
harlan-zw merged 1 commit into
mainfrom
fix/baseline-ci-7a5ef918b1ce
Nov 23, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/baseline-ci-7a5ef918b1ce

Conversation

@harlan-github-agent

Copy link
Copy Markdown
Contributor

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.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

@harlan-github-agent harlan-github-agent Bot added harlan-agent-baseline-repair Marks a pull request that repairs default branch CI. harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. and removed harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. labels Nov 23, 2026
@harlan-github-agent

harlan-github-agent Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-11-23 22:15 UTC.

GitHub merged this pull request.

  • Logged (78/100): A stale prepare lookup can allow duplicate weekly posts View code 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.
    • Ask an agent to verify and fix this finding
  • Logged (35/100): Publish test bypasses artifact lookup and claim enforcement View code Optional follow-up: 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

fa3f1bd9-d268-46a1-a373-a81a44a89846

Selected findings run after merge and open separate pull requests.

@harlan-github-agent harlan-github-agent Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harlan Agent Kit posted this automated review. AI open source policy.

Automated Review: READY.

Read the Review results

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.

View code

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.

View code

Comment thread scripts/weekly-social.ts
// 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 }), {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@harlan-github-agent harlan-github-agent Bot added the harlan-agent-ready The automated Review passed every gate on this head commit. label Nov 23, 2026
@harlan-zw
harlan-zw merged commit 81cf805 into main Nov 23, 2026
8 checks passed
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

harlan-agent-baseline-repair Marks a pull request that repairs default branch CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant