Skip to content

fix(sourcehut): assert HTTPS and reject redirects on GraphQL requests - #1107

Merged
potiuk merged 1 commit into
apache:mainfrom
onlyarnav:fix/sourcehut-redirect-policy
Aug 25, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
onlyarnav:fix/sourcehut-redirect-policy

Conversation

@onlyarnav

Copy link
Copy Markdown
Member

Summary

  • Add _require_https check in tools/sourcehut/src/magpie_sourcehut/client.py before building GraphQL requests.
  • Build an opener using NoAuthRedirectHandler to reject any HTTP redirect responses and prevent forwarding Authorization: Bearer <token> credentials.
  • Add comprehensive unit tests covering redirect rejection and HTTPS enforcement in tools/sourcehut and tools/bitbucket.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Tool / bridge contract (tools/<system>/*.md)
  • Python package (tools/*/ with pyproject.toml)
  • Groovy reference impl
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)
  • Project template (projects/_template/)
  • CI / dev loop (prek, workflows, validators)
  • Other:

Test plan

  • For Python packages touched: uv run pytest / ruff check / mypy passes:
    • uv run --directory tools/sourcehut --project . python -m pytest (28 passed)
    • uv run --directory tools/bitbucket --project . python -m pytest (117 passed)
    • uv run ruff check tools/sourcehut tools/bitbucket (passed)
    • uv run ruff format --check tools/sourcehut tools/bitbucket (passed)
    • uv run mypy --config-file tools/sourcehut/pyproject.toml tools/sourcehut (passed)
    • uv run mypy --config-file tools/bitbucket/pyproject.toml tools/bitbucket (passed)

RFC-AI-0004 compliance

  • HITL — any new mutation is gated on explicit user confirmation
  • Sandbox — no new unrestricted host access; network reach declared in the adapter
  • Vendor neutrality — placeholders used in all skill / tool prose
  • Conversational + correctable — agentic-override path documented if behaviour is adopter-tunable
  • Write-access discipline — no autonomous outbound messages; drafts only, sent on confirmation
  • Privacy LLM — private content does not reach a non-approved LLM; redactor invoked where needed

Labels

  • family:tools
  • contract:tracker
  • contract:source-control

fixes: #1091


Generated-by: Claude Code (Opus 5)

@onlyarnav
onlyarnav requested review from justinmclean and potiuk and removed request for potiuk August 21, 2026 18:15
Add an HTTPS assertion before building the GraphQL request in the SourceHut client, and build an opener using NoAuthRedirectHandler to reject any redirects outright so Authorization headers are not forwarded to redirect targets.

Add unit tests for HTTPS assertion and redirect rejection in both SourceHut and Bitbucket client test suites.

Generated-by: Antigravity
@onlyarnav
onlyarnav force-pushed the fix/sourcehut-redirect-policy branch from cf1dadb to c37dbde Compare August 22, 2026 12:32
@potiuk
potiuk merged commit 1ca6752 into apache:main Aug 25, 2026
10 checks passed
@potiuk potiuk added contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) contract:mail-archive Tool capability: mailing-list / forum archive reads contract:source-control Tool capability: branch / commit / diff / push (VCS) contract:tracker Tool capability: issue / board / label backend labels Sep 25, 2026
@potiuk potiuk added the family:tools tools/* label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) contract:mail-archive Tool capability: mailing-list / forum archive reads contract:source-control Tool capability: branch / commit / diff / push (VCS) contract:tracker Tool capability: issue / board / label backend family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools/sourcehut: POST forwards Bearer token on redirect and skips the HTTPS assertion

2 participants