Skip to content

Validate task ids and reject dot-segment sync paths#33

Merged
ryanmcmillan merged 1 commit into
mainfrom
encode-task-ids-validate
Jun 11, 2026
Merged

Validate task ids and reject dot-segment sync paths#33
ryanmcmillan merged 1 commit into
mainfrom
encode-task-ids-validate

Conversation

@ryanmcmillan

Copy link
Copy Markdown
Member

Defense-in-depth on top of encodeURIComponent for sync task-id paths.

Findings addressed

  • Dot-segment ids survive encoding: encodeURIComponent(".")/("..") are unchanged, so an id of .. still produces /tasks/../context, which URL normalization collapses to /context before the request leaves the machine. taskPathSegment now rejects ./../empty.
  • Unvalidated ids from .delega/tasks.jsonl: parseTasksJsonl now validates any present id against /^[a-f0-9]{32}$/, rejecting a hostile tasks file at parse time. Absent ids (new local tasks created on push) are still allowed.

Tests

Path-confusing/malformed ids (.., ../agents, task?x=y, non-hex, empty) through the parser, and dot-segment ids through taskPathSegment. 7/7 pass.

🤖 Generated with Claude Code

Defense-in-depth on top of encodeURIComponent for sync task-id paths:

- taskPathSegment now rejects "." / ".." / empty ids, which encodeURIComponent
  leaves untouched and URL normalization would otherwise collapse (e.g.
  /tasks/../context -> /context).
- parseTasksJsonl validates any present id against /^[a-f0-9]{32}$/, so a
  hostile .delega/tasks.jsonl is rejected at parse time. Absent ids (new local
  tasks created on push) are still allowed.

Tests cover path-confusing/malformed ids through the parser and dot-segment
ids through taskPathSegment. 7/7 pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@ryanmcmillan ryanmcmillan merged commit 6e6ac66 into main Jun 11, 2026
2 checks passed
@ryanmcmillan ryanmcmillan deleted the encode-task-ids-validate branch June 11, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant