-
Notifications
You must be signed in to change notification settings - Fork 4
Validate Jira base URL before API calls #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -101,9 +101,27 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MAX_DESC_CHARS: ${{ env.MAX_DESC_CHARS }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for v in JIRA_BASE_URL JIRA_EMAIL JIRA_API_TOKEN JIRA_KEY; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -z "${!v:-}" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Missing required Jira configuration: $v" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case "$JIRA_BASE_URL" in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| http://*|https://*) ;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "JIRA_BASE_URL must include scheme and host (e.g., https://your-domain.atlassian.net)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JIRA_BASE_URL="${JIRA_BASE_URL%/}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+104
to
+119
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for v in JIRA_BASE_URL JIRA_EMAIL JIRA_API_TOKEN JIRA_KEY; do | |
| if [ -z "${!v:-}" ]; then | |
| echo "Missing required Jira configuration: $v" | |
| exit 1 | |
| fi | |
| done | |
| case "$JIRA_BASE_URL" in | |
| http://*|https://*) ;; | |
| *) | |
| echo "JIRA_BASE_URL must include scheme and host (e.g., https://your-domain.atlassian.net)" | |
| exit 1 | |
| ;; | |
| esac | |
| JIRA_BASE_URL="${JIRA_BASE_URL%/}" | |
| jira_validate_jira_config() { | |
| for v in JIRA_BASE_URL JIRA_EMAIL JIRA_API_TOKEN JIRA_KEY; do | |
| if [ -z "${!v:-}" ]; then | |
| echo "Missing required Jira configuration: $v" | |
| exit 1 | |
| fi | |
| done | |
| case "$JIRA_BASE_URL" in | |
| http://*|https://*) ;; | |
| *) | |
| echo "JIRA_BASE_URL must include scheme and host (e.g., https://your-domain.atlassian.net)" | |
| exit 1 | |
| ;; | |
| esac | |
| JIRA_BASE_URL="${JIRA_BASE_URL%/}" | |
| } | |
| jira_validate_jira_config |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL scheme validation only checks if JIRA_BASE_URL starts with "http://" or "https://", but doesn't verify that there's actually a hostname after the scheme. This would allow invalid URLs like "http://" or "https://" to pass validation. Consider adding a more robust check that ensures the URL contains both a scheme and a hostname, for example by checking if the URL contains at least one character after the scheme and "://".
| host_and_rest="${JIRA_BASE_URL#*://}" | |
| jira_host="${host_and_rest%%/*}" | |
| if [ -z "$jira_host" ]; then | |
| echo "JIRA_BASE_URL must include scheme and host (e.g., https://your-domain.atlassian.net)" | |
| exit 1 | |
| fi |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After normalizing the trailing slash on line 399, the JIRA_BASE_URL is used on line 427 to construct the API endpoint. However, unlike the "Fetch Jira issue JSON" step (line 120), this step doesn't store the normalized URL in an intermediate variable (ISSUE_URL). While the current implementation works, consider adding an ISSUE_URL variable here as well for consistency with the first step and to make the curl command clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL scheme validation only checks if JIRA_BASE_URL starts with "http://" or "https://", but doesn't verify that there's actually a hostname after the scheme. This would allow invalid URLs like "http://" or "https://" to pass validation. Consider adding a more robust check that ensures the URL contains both a scheme and a hostname, for example by checking if the URL contains at least one character after the scheme and "://".