You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **After user sets the variables, verify they're exported correctly** using the check script above
93
-
- Should output: "JIRA_API_TOKEN is set" and "JIRA_EMAIL is set"
94
-
95
-
- **Only proceed to the next steps if both JIRA_API_TOKEN and JIRA_EMAIL are set**
57
+
Secrets may be injected by the Ambient session, a secrets manager, or an MCP server — do NOT rely solely on bash env var checks. Instead, attempt a lightweight test API call and let the response determine whether credentials are available.
# Retry once on network failure (curl exit code 000 = timeout/no response)
64
+
forATTEMPTin 1 2;do
65
+
TEST_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X GET \
66
+
--connect-timeout 10 --max-time 15 \
67
+
-H "Authorization: Basic ${AUTH}" \
68
+
-H "Content-Type: application/json" \
69
+
"${JIRA_BASE_URL}/rest/api/3/myself")
70
+
[ "$TEST_RESPONSE"!="000" ] &&break
71
+
echo"⚠️ Network timeout on attempt ${ATTEMPT}, retrying..."
72
+
sleep 3
73
+
done
74
+
```
75
+
76
+
-**HTTP 200** → credentials valid, proceed
77
+
-**HTTP 401** → credentials missing or invalid. Note: `/rest/api/3/myself` returns 401 for all authentication failures — there is no separate 403 for this endpoint. Only now inform the user:
78
+
- Check if `JIRA_API_TOKEN` and `JIRA_EMAIL` are configured as Ambient session secrets
79
+
- If not, generate a token at https://id.atlassian.com/manage-profile/security/api-tokens and export:
80
+
81
+
```bash
82
+
export JIRA_API_TOKEN="your-token-here"
83
+
export JIRA_EMAIL="your-email@redhat.com"
84
+
```
85
+
- **HTTP 000 after retry** → persistent network issue — inform user and stop
86
+
87
+
**Do NOT pre-check env vars with `[ -z"$JIRA_API_TOKEN" ]` and stop.** The variables may be available to the API call even if not visible to the shell check (e.g. Ambient secrets injection).
96
88
97
89
3. **Query Jira for CVE Issues**
98
90
99
-
a. Set up variables:
91
+
a. Set up variables (AUTH already set from Step 2):
0 commit comments