Skip to content

Webhook: no authz on issue_comment commands; review sessions unbounded in memory #81

@haasonsaas

Description

@haasonsaas

Found during deep review of server/webhook handling

1. No authorization on issue_comment commands (MEDIUM)

The `issue_comment` webhook handler processes `@diffscope review` from any commenter. On public repositories, any GitHub user can comment on PRs. An attacker can trigger full reviews on public repos, consuming LLM API credits at will.

Fix: Check that the commenter has write access to the repo before processing commands.

2. Review sessions unbounded in memory (MEDIUM)

`ReviewSession` stores full diff content as `Some(diff_content.clone())` in the in-memory `reviews` HashMap. Large PRs (dependency updates) can be many MB. Concurrent webhooks could exhaust server memory.

Fix: Stream diffs or limit stored size. Add session count cap with LRU eviction.

3. No rate limiting on any endpoint

No rate limiting middleware. Review semaphore limits concurrency but the queue is unbounded — pending requests accumulate without limit.

Acceptance

  • issue_comment handler checks commenter repo permissions
  • Review session memory bounded (size limit or eviction)
  • Rate limiting on webhook and review endpoints

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: review-pipelineReview pipeline, context, promptsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions