Skip to content

fix: return error when ValidateJiraToken receives malformed URL#1186

Open
ambient-code[bot] wants to merge 1 commit intomainfrom
fix/jira-malformed-url-validation
Open

fix: return error when ValidateJiraToken receives malformed URL#1186
ambient-code[bot] wants to merge 1 commit intomainfrom
fix/jira-malformed-url-validation

Conversation

@ambient-code
Copy link
Copy Markdown
Contributor

@ambient-code ambient-code bot commented Apr 3, 2026

Summary

  • Fix ValidateJiraToken silently returning true, nil when all Jira API URL candidates fail request construction (e.g. malformed URL)
  • Add lastReqErr variable to capture request-construction errors and check it in the fallthrough path
  • Add regression test that passes a malformed URL (://not-a-url) and asserts valid == false and err != nil

Closes #1079

Test plan

  • New test: returns false with error for a malformed URL — passes malformed URL, asserts valid == false and err != nil
  • All 445 existing unit tests pass (go test -tags test ./handlers/)

🤖 Generated with Claude Code

When http.NewRequestWithContext fails for all Jira API URL candidates
(e.g. malformed URL), the loop silently swallowed every error via
continue. Because sawHTTPResponse and lastNetErr were never set, the
function fell through to return true, nil — falsely reporting a broken
Jira URL as a valid connection.

Capture the request-construction error in lastReqErr and check it in
the fallthrough path so malformed URLs correctly return false + error.

Closes #1079

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ambient-code ambient-code bot added this to the Review Queue milestone Apr 3, 2026
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.

ValidateJiraToken: malformed URL silently reports valid connection

1 participant