Skip to content

Reject non-public URLs in JIRA connection helper#14867

Open
Maffooch wants to merge 2 commits into
bugfixfrom
fix/jira-helper-url-validation
Open

Reject non-public URLs in JIRA connection helper#14867
Maffooch wants to merge 2 commits into
bugfixfrom
fix/jira-helper-url-validation

Conversation

@Maffooch
Copy link
Copy Markdown
Contributor

Summary

  • connect_to_jira in dojo/jira/helper.py passed the configured server URL straight into the JIRA() client with no pre-flight validation. URLs pointing at private, loopback, or link-local addresses (e.g. a typo'd hostname resolving to 127.0.0.1, or a copy-pasted internal address like 172.18.0.3) produced low-level connection errors / unhandled stacktraces instead of a clean form validation message.
  • Now connect_to_jira calls validate_url_for_ssrf from dojo.utils_ssrf (the same helper already used by dojo/tools/risk_recon/api.py) before constructing the JIRA client. A blocked URL raises ValueError("JIRA URL is not allowed: …"), which BaseJiraForm.test_jira_connection already catches and surfaces as a form-validation error on the username/password fields.
  • Added unittests/test_jira_helper_ssrf.py covering RFC 1918, loopback, link-local, an unsupported scheme, the happy-path public URL (mocking the JIRA client), and the form-level error path.

Test plan

  • python manage.py test unittests.test_jira_helper_ssrf
  • python manage.py test unittests.test_utils_ssrf
  • python manage.py check
  • ruff check . --fix

`connect_to_jira` in `dojo/jira/helper.py` passed the configured server
URL straight into the `JIRA()` client with no pre-flight validation.
URLs pointing at private, loopback, or link-local addresses produced
low-level connection errors instead of a clean form validation message.

Now `connect_to_jira` calls `validate_url_for_ssrf` from
`dojo.utils_ssrf` (the same helper already used by
`dojo/tools/risk_recon/api.py`) before constructing the JIRA client. A
blocked URL raises `ValueError`, which `BaseJiraForm.test_jira_connection`
already catches and surfaces as a form-validation error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Maffooch Maffooch requested a review from mtesauro as a code owner May 13, 2026 19:57
`connect_to_jira` now rejects unresolvable hostnames via
`validate_url_for_ssrf` before invoking the JIRA client, surfacing as
`ValueError`. Broaden the `assertRaises` to accept the new path while
keeping the original requests-level failure mode as a fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant