Skip to content

Drop the Owner Half of the Dot-Segment Guard, Which the URL Grammar Already Refuses - #1515

Merged
ptr727 merged 1 commit into
developfrom
feature/1513-drop-unreachable-owner-dot-check
Sep 10, 2026
Merged

ptr727 merged 1 commit into
developfrom
feature/1513-drop-unreachable-owner-dot-check

Conversation

@ptr727

@ptr727 ptr727 commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Copilot raised both of these as suppressed low-confidence findings on the
#1513 promotion pull request, and both hold.

The owner half of the guard is unreachable. GITHUB_URL_RE's owner group is
[A-Za-z0-9-]+, which cannot match a dot at all, so owner.strip(".")
is never empty and the branch says an owner can be a dot segment when the
grammar two lines above already settles that it cannot.

The comment's example was misattributed for the same reason.
https://github.com/../rate_limit no longer reaches the guard, it is
refused by the owner class, so citing it as a url that "passed the gate"
next to the guard credited the wrong half of the fix.

The comment now names each position with the evidence that belongs to it,
and the two differ. The owner position is where the traversal actually
resolved: repos/../rate_limit returns 200 with the rate-limit document
and repos/../.. returns the API root. The repo position is refused for a
narrower reason, measured while answering this: repos/ptr727/../rate_limit
returns 404 rather than a different document, so the claim is not that it
traverses but that the normalization eats a segment either way, which
leaves what a read addresses decided by the shape of that read rather than
by the declaration.

The test corpus keeps both positions rather than trusting whichever half
holds, since they are now refused by different halves. Dropping the
remaining guard fails three of its cases.

Both were suppressed findings, which open no thread, so this pull request is where they are answered.

🤖 Generated with Claude Code

…lready Refuses

Copilot raised both of these as suppressed low-confidence findings on the
#1513 promotion pull request, and both hold.

The owner half of the guard is unreachable. GITHUB_URL_RE's owner group is
`[A-Za-z0-9-]+`, which cannot match a dot at all, so `owner.strip(".")`
is never empty and the branch says an owner can be a dot segment when the
grammar two lines above already settles that it cannot.

The comment's example was misattributed for the same reason.
`https://github.com/../rate_limit` no longer reaches the guard, it is
refused by the owner class, so citing it as a url that "passed the gate"
next to the guard credited the wrong half of the fix.

The comment now names each position with the evidence that belongs to it,
and the two differ. The owner position is where the traversal actually
resolved: `repos/../rate_limit` returns 200 with the rate-limit document
and `repos/../..` returns the API root. The repo position is refused for a
narrower reason, measured while answering this: `repos/ptr727/../rate_limit`
returns 404 rather than a different document, so the claim is not that it
traverses but that the normalization eats a segment either way, which
leaves what a read addresses decided by the shape of that read rather than
by the declaration.

The test corpus keeps both positions rather than trusting whichever half
holds, since they are now refused by different halves. Dropping the
remaining guard fails three of its cases.
Copilot AI lite review requested due to automatic review settings September 10, 2026 19:17
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 58f11964-7a64-4e8d-8e30-25ce070be760


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

It removes dead code that cannot be reached given the current URL grammar and updates comments/tests to match the verified behavior without changing the effective validation outcomes.

Pull request overview

This PR tightens and clarifies the GitHub URL dot-segment handling in github_identity() by removing an unreachable owner-side guard (since the owner regex already forbids dots) and updating the explanatory comments and test corpus to reflect the measured behavior at each path segment position.

Changes:

  • Remove the unreachable owner.strip(".") == "" branch in spec/validate.py and keep the dot-only guard only for the repo segment.
  • Rewrite the in-code comment to accurately attribute which half of the grammar refuses which dot-only cases, including the measured API behavior.
  • Expand/reorder the dot-only segment test cases to cover both owner-position and repo-position variants explicitly.
File summaries
File Description
spec/validate.py Drops the unreachable owner-side dot-only check and updates the rationale comment for the remaining repo-side guard.
scripts/tests/test_spec_validate.py Updates the dot-segment test docstring and extends the URL corpus to cover both dot-only positions.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr727
ptr727 merged commit fc3a6c8 into develop Sep 10, 2026
9 checks passed
@ptr727
ptr727 deleted the feature/1513-drop-unreachable-owner-dot-check branch September 10, 2026 19:20
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.

2 participants