Skip to content

fix(client): send credentials only to the configured jira origin - #7

Merged
plusky merged 1 commit into
mainfrom
fix/attachment-url-origin
Aug 8, 2026
Merged

fix(client): send credentials only to the configured jira origin#7
plusky merged 1 commit into
mainfrom
fix/attachment-url-origin

Conversation

@plusky

@plusky plusky commented Aug 8, 2026

Copy link
Copy Markdown
Owner

JiraClient::download_attachment_bytes used an absolute content URL from Jira's attachment metadata verbatim and attached the caller's credentials (Basic or Bearer) with no host check — and accepted http://. A compromised or misconfigured Jira instance could therefore exfiltrate the operator's API token to an arbitrary third-party host, potentially in cleartext. Everywhere else the base URL is authoritative; this was the one place attacker-influenceable data chose the request target.

Absolute content URLs must now match the configured base URL's origin (scheme + host + port); anything else is refused with a generic error that reveals nothing about issue or attachment existence. Relative URLs keep resolving against base_url. http:// remains possible only when the operator's own --jira-server is http.

Deviation from the finding: the optional global.attachment_hosts policy allowlist is deferred; the rule is strictly same-origin until a real deployment needs more.

Invariants: I12 (token custody, in spirit), I1 (no client-influenceable trust added), I2 (refusal text is generic).

Tests: wiremock test with a second mock server proving no request — and hence no Authorization header — ever reaches a foreign host; confirmed to fail against the unfixed code.

Process: AI-assisted — implemented and independently adversarially reviewed against docs/DESIGN.md (verdict: approve, with an empirical pre-fix-failure check). Full verification suite green at the commit.

download_attachment_bytes previously used absolute attachment content
URLs from Jira responses verbatim, sending the caller's Basic/Bearer
credentials to whatever host the metadata named. Absolute URLs are now
accepted only when their origin (scheme + host + port) matches the
configured base URL; anything else is refused fail-closed with a generic
error before any request is made. Touches I12 (spirit: token custody) and I1.
@plusky plusky added security Guard, key custody, or disclosure surface ai-assisted Found or drafted with AI assistance; claims verified against source, review independently labels Aug 8, 2026
@plusky
plusky enabled auto-merge (rebase) August 8, 2026 19:44
@plusky
plusky merged commit 9ec5488 into main Aug 8, 2026
11 checks passed
@plusky
plusky deleted the fix/attachment-url-origin branch August 8, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Found or drafted with AI assistance; claims verified against source, review independently security Guard, key custody, or disclosure surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant