/compliance:report-to-jirafrom compliance
Posts completed CVE analysis reports as Jira comments on the source ticket. Used as the final step of compliance analysis and for PR follow-up comments.
Ships in compliance. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Posts the completed CVE analysis report as a comment on the source Jira ticket — the same ticket the CVE details were read from (SOURCE_TICKET, set in Phase 0.5 from --jira=/--jql=). Always called as the last step of Phase 4, after the report has been generated. Also reused by create-fix-pr (Phase 6) for a short follow-up comment containing the PR URL.
If no Jira ticket was involved (direct <CVE-ID> mode), this skill is skipped entirely — there is nothing to post to.
Before posting, verify the following are available from the parent command:
CVE-2024-45338)SOURCE_TICKET — the Jira ticket key from --jira=/--jql= (e.g. OCPBUGS-12345). This is the only ticket this skill writes to.jira_context — label snapshot from Phase 0.5 (jira_context["labels"]); used as a hint only — Step 4.5 re-fetches current labels before writingHIGH / MEDIUM / LOW / NEEDS_REVIEW)AUTO_APPROVE (yes/no, default no) — governs the Step 3b visibility-downgrade fallback promptIf SOURCE_TICKET is not available (direct CVE mode): return status: skipped with reason "no_source_ticket".
If the report is incomplete or Phase 3 did not finish, return status: skipped with reason.
Read ${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/${CVE_ID}/report.md from Phase 3 and post it in full. The Jira comment is the report — do not pre-emptively shorten it or write a separate jira-comment.md.
Write standard Markdown — Jira Cloud renders Markdown natively when posted with contentFormat: "markdown" (see markdown-for-jira reference if that plugin is installed; the syntax is standard CommonMark either way). No wiki-markup conversion is needed.
Default body = attribution header + entire report.md. If Phase 4 produced a remediation plan not already under ## Remediation in the report, append it as ## Remediation Plan (Phase 4).
Prepend the following attribution header before the report:
> ⚠️ **This analysis was performed automatically by `/compliance:analyze-cve`.**
> Results should be reviewed by a human before acting on remediation steps.
---
Jira comment bodies are capped at 32,767 characters. Apply these steps in order — only move to the next step if the comment is still over 32,000 chars:
govulncheck scrollback, call-graph DOT, or megabyte grep output with a one-line pointer:
_(Full output truncated — see `${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/<CVE_ID>/govulncheck-source.txt`)_
Keep executive summary, CVE context, evidence interpretations, call-graph results table, risk assessment, and remediation in full. Re-measure.report.md. Retain: risk level, repository/branch/commit, dependency versions, govulncheck conclusion, four-algorithm call-graph table, manual verification findings, recommendation, and artifact paths. Omit repeated narrative and any remaining large code blocks. Note at the top:
_(Full report exceeded Jira comment limit — summary below. See `${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/<CVE_ID>/report.md`.)_
Do not use a shortened summary unless steps 1–2 are insufficient.embargo_status: True, abort immediately.Credential rule: Never print, echo, or log any token, key, or password value. Reference credentials only via environment variable names. Never interpolate a credential value into a logged string.
CVE analysis reports contain security-sensitive findings. Prefer restricted (internal-only) visibility when the Jira instance supports it.
Write the Step 2 comment to a private temporary file once, before any posting path — every method below reads this file. Write the report with a file-writing tool, not a shell heredoc, so report text is never interpreted as shell source:
COMMENT_FILE=$(mktemp /tmp/cve-report-comment.XXXXXX)
chmod 600 "${COMMENT_FILE}"
Keep the file for the whole posting workflow and remove it in the cleanup step at the end of Step 3.
If a token is available in the environment, try the REST API directly — it remains the preferred restricted-visibility path. The Step 3b MCP fallback can carry the same restriction via commentVisibility, so a REST failure no longer forces an unrestricted comment. Try both auth schemes and let the HTTP response decide which one worked — credentials may be exposed differently depending on the runtime (a local shell with a bare token vs. a CI/RWS runner with a mounted service-account email+token pair):
JIRA_EMAIL and a token are available.JIRA_API_TOKEN="${JIRA_API_TOKEN:-${JIRA_TOKEN:-${ATLASSIAN_API_TOKEN:-}}}"
JIRA_BASE_URL="${JIRA_URL:-}"
JIRA_EMAIL="${JIRA_EMAIL:-}"
if [ -n "${JIRA_API_TOKEN}" ] && [ -n "${JIRA_BASE_URL}" ]; then
case "${JIRA_BASE_URL}" in
https://*) ;;
*) echo "ERROR: JIRA_BASE_URL must use HTTPS (got: ${JIRA_BASE_URL})"; rm -f "${COMMENT_FILE:-}"; exit 1 ;;
esac
COMMENT_BODY=$(cat "${COMMENT_FILE}")
RESPONSE_FILE=$(mktemp /tmp/jira-post-response.XXXXXX)
chmod 600 "${RESPONSE_FILE}"
COMMENT_JSON_BODY=$(echo "${COMMENT_BODY}" | python3 -c "import json,sys; print(json.dumps(sys.stdin.read()))")
post_comment() {
# $1 = auth mode: "basic" (email+token) or "bearer" (token only)
# Build the Authorization header inside this function after set +x so
# credentials never appear in traced argv when post_comment is invoked.
local auth_mode="$1" curl_cfg http_code auth_header
curl_cfg=$(mktemp)
chmod 600 "${curl_cfg}"
trap 'rm -f "${curl_cfg}"' RETURN EXIT INT TERM
[[ $- == *x* ]] && local _was_tracing=true || local _was_tracing=false
set +x
if [ "${auth_mode}" = "basic" ]; then
auth_header="Basic $(printf '%s:%s' "${JIRA_EMAIL}" "${JIRA_API_TOKEN}" | base64 | tr -d '\n')"
else
auth_header="Bearer ${JIRA_API_TOKEN}"
fi
printf 'header = "Authorization: %s"\n' "${auth_header}" > "${curl_cfg}"
unset auth_header
$_was_tracing && set -x || true
http_code=$(curl -s -o "${RESPONSE_FILE}" -w "%{http_code}" \
--connect-timeout 15 \
--max-time 60 \
-X POST \
-K "${curl_cfg}" \
"${JIRA_BASE_URL}/rest/api/2/issue/${SOURCE_TICKET}/comment" \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
"body": ${COMMENT_JSON_BODY},
"visibility": {
"type": "group",
"value": "Red Hat Employee"
}
}
EOF
)
echo "${http_code}"
}
HTTP_STATUS=""
if [ -n "${JIRA_EMAIL}" ] && [ -n "${JIRA_API_TOKEN}" ]; then
echo "Attempting REST post with Basic auth (email + token)..."
HTTP_STATUS=$(post_comment basic)
fi
# Only retry with the other auth scheme when Basic wasn't attempted at all
# (no JIRA_EMAIL) or came back with an actual auth failure (401/403). This
# POST is not idempotent: retrying it for every other status (400, 429,
# 5xx, or curl's own "000") risks creating a duplicate comment if the first
# request was actually accepted server-side but the response was lost or
# malformed. Any other failure goes straight to Step 3b instead of retrying.
if { [ -z "${HTTP_STATUS}" ] || [ "${HTTP_STATUS}" = "401" ] || [ "${HTTP_STATUS}" = "403" ]; } && [ -n "${JIRA_API_TOKEN}" ]; then
echo "Attempting REST post with Bearer auth..."
HTTP_STATUS=$(post_comment bearer)
fi
echo "Jira API HTTP status: ${HTTP_STATUS:-none attempted}"
if [ "${HTTP_STATUS}" = "201" ]; then
echo "✓ Comment posted with restricted visibility"
else
echo "✗ REST API failed (HTTP ${HTTP_STATUS:-n/a}) — will fall back to MCP tool"
cat "${RESPONSE_FILE}" 2>/dev/null || true
fi
fi
The
visibilityobject above targetsredhat.atlassian.net. On other Jira Cloud instances, adjusttype/valueto match an equivalent internal-only group. If no equivalent internal group exists, skip the REST post and continue to Step 3b — do not post unrestricted from here.
000) → do not retry with the other scheme (the POST is not idempotent) — go directly to Step 3b.JIRA_API_TOKEN, JIRA_EMAIL, the computed BASIC_AUTH value, or the contents of ${curl_cfg} — only the HTTP status code and response body (which contains no credentials).5xx and curl 000 leave the write's outcome unknown. Before posting via MCP, check for an existing comment: call listJiraIssueComments, paginating with startAt until isLast is true, and compare each body against the exact Step 2 comment — a match means the report is already on the ticket, so do not repost. A failed or incomplete read, or a restricted comment this account cannot see, is also an unknown outcome: take the Step 4 failure path instead of reposting.
addOrEditJiraIssueComment(
issueIdOrKey=SOURCE_TICKET,
commentBody="<constructed comment from Step 2>",
contentFormat="markdown",
commentVisibility={"type": "group", "value": "Red Hat Employee"}
)
The MCP tool supports restricted visibility via
commentVisibility({"type": "group"|"role", "value": "<name>"}). Pass the same internal group Step 3a uses —Red Hat Employeeonredhat.atlassian.net; on other instances pick an equivalent group per the note above.
Any post without the internal-only restriction is gated by AUTO_APPROVE, regardless of whether Step 3a was attempted:
commentVisibility; no approval needed.AUTO_APPROVE=no → ask the user:
⚠️ No equivalent internal group exists on this instance for `commentVisibility`. The comment will be visible to everyone with ticket access. Proceed?
If the user declines → display the comment body for manual posting.AUTO_APPROVE=yes → post and clearly log that the comment went out unrestricted.commentVisibility or an invalid group/role, and no comment was created) may fall back to an unrestricted post, under the same AUTO_APPROVE rules. Rate limits, server errors, timeouts, and ambiguous failures are plain errors: take the Step 4 failure path, keep commentVisibility on any retry, and retry only when the original write is known not to have succeeded. Do not switch to jira-cli to bypass this rule.Fallback — jira-cli (if MCP is also unavailable):
jira issue comment add "${SOURCE_TICKET}" \
--body "$(cat "${COMMENT_FILE}")" \
--no-input
jira-cliposts with no visibility restriction. Apply the unrestricted-post rule above before everyjira-clipost: ask underAUTO_APPROVE=no, proceed and log underAUTO_APPROVE=yes.
Cleanup — when the posting workflow finishes, on success or failure, remove the temporary files:
rm -f "${COMMENT_FILE}" "${RESPONSE_FILE:-}"
After posting, output to the session:
✅ Report posted to <SOURCE_TICKET>
<JIRA_BASE_URL>/browse/<SOURCE_TICKET>
CVE: <CVE_ID>
Risk level: <level>
If the post fails:
❌ Failed to post report to <SOURCE_TICKET>
Error: <error message>
The full report has been displayed above. Please copy and paste it
into <SOURCE_TICKET> manually.
Do not retry more than once. On failure, display the comment body in the session so the user can post it manually.
Add the label ai-cve-analyzed to SOURCE_TICKET to prevent redundant re-processing on future runs.
Only run this step if Step 3 succeeded. If Step 3 failed for any reason, skip this step entirely — do not add the label to a ticket that did not receive the comment.
Jira's update API replaces the entire label list — it does not append. Sending only ["ai-cve-analyzed"] will delete all existing labels on the ticket. This is a destructive operation and must never happen.
Before writing, always:
fresh = getJiraIssue(issue_key=SOURCE_TICKET)
current_labels = fresh["fields"]["labels"] # never start from an empty list
Use jira_context["labels"] only as a fallback if the re-fetch fails.ai-cve-analyzed to current_labels# current_labels comes from the mandatory re-fetch above (Step 4.5)
if "ai-cve-analyzed" not in current_labels:
new_labels = current_labels + ["ai-cve-analyzed"]
else:
new_labels = current_labels # already marked — nothing to write
editJiraIssue(
issue_key=SOURCE_TICKET,
fields={"labels": new_labels}
)
Fallback — jira-cli (appends without replacing — safe to use directly):
jira issue edit "${SOURCE_TICKET}" --label "ai-cve-analyzed" --no-input
After the update call, re-fetch the ticket labels and confirm:
updated = getJiraIssue(issue_key=SOURCE_TICKET)
updated_labels = updated["fields"]["labels"]
assert "ai-cve-analyzed" in updated_labels, "New label missing"
for label in current_labels:
assert label in updated_labels, f"LABEL LOST: {label}"
If the new label is missing: log a non-fatal warning — the report is already posted:
⚠️ Could not add 'ai-cve-analyzed' label to <SOURCE_TICKET>. Add it manually to prevent re-processing.
If an existing label was lost: this is a data integrity error — log it and output the original label list so the user can restore it:
❌ LABEL INTEGRITY ERROR on <SOURCE_TICKET>
The following labels were present before the update but are now missing:
<list of lost labels>
Original full label list (restore manually):
<current_labels>
If both checks pass:
✅ Label 'ai-cve-analyzed' added to <SOURCE_TICKET>. Labels verified intact.
Success:
{
"skill": "report-to-jira",
"status": "success",
"source_ticket": "<SOURCE_TICKET>",
"cve_id": "<CVE_ID>",
"risk_level": "<HIGH|MEDIUM|LOW|NEEDS_REVIEW>",
"method": "rest | mcp | jira-cli"
}
Skipped:
{
"skill": "report-to-jira",
"status": "skipped",
"reason": "<no_source_ticket | report incomplete | phase 3 did not finish>"
}
Failed:
{
"skill": "report-to-jira",
"status": "failed",
"source_ticket": "<SOURCE_TICKET>",
"error": "<error message>",
"fallback": "comment body displayed in session for manual posting"
}
Called from Phase 4 of the analyze-cve skill as the final step, after the report has been fully generated.
Input: complete report content, CVE ID, risk level, SOURCE_TICKET (from Phase 0.5), AUTO_APPROVE
Output: confirmation of comment and label posted to SOURCE_TICKET, or status: skipped/failed per above
Also called from Phase 6 (create-fix-pr) for a short follow-up comment containing only the GitHub PR URL. That path uses the section below and must not replace this analysis comment or change labels.
Post a new comment on SOURCE_TICKET after a remediation PR is opened. Invoked by create-fix-pr.
Do not run this path unless SOURCE_TICKET is set, Phase 6 produced a PR_URL, and the user approved opening the PR.
Do not:
ai-cve-analyzed stays as Phase 4 left it)embargo_status = True, abort)### Remediation PR opened
A pull request is open for this CVE.
- **PR:** [<PR_URL>](<PR_URL>)
- **CVE:** <CVE_ID>
- **Change:** <what Phase 5 changed — `<module>` <old> → <new> only for a dependency bump; otherwise a short source/config summary>
- **Base branch:** <BASE_BRANCH>
Use the same procedure as Step 3 (REST with restricted visibility first if configured, MCP/jira-cli fallback otherwise).
On failure, print the comment in the session for manual paste. Do not treat a Jira follow-up failure as a GitHub PR failure — the PR itself is still a success.
Return:
{
"skill": "report-to-jira",
"status": "success | skipped | failed",
"mode": "pr_followup",
"source_ticket": "<SOURCE_TICKET>",
"pr_url": "<PR_URL>"
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/analyze-cveFull Go CVE analysis workflow. Given a CVE identifier -- supplied directly, or
resolved from a Jira ticket or JQL batch -- resolves and clones the affected
repository, gathers vulnerability intelligence, analyzes codebase impact with
govulncheck and call-graph reachability, generates a risk report, and optionally
applies a fix and opens a GitHub pull request.
Use when the user gives a CVE ID (CVE-YYYY-NNNNN), a Jira ticket (--jira=), or a
JQL query (--jql=) for Go CVE triage; wants call-graph proof that a vulnerable
function is reachable; or wants an automated fix and PR for a Go dependency
vulnerability.
Triggers on: 'analyze CVE', 'CVE impact', 'is this repo affected by CVE',
'Go vulnerability analysis', 'triage this Jira CVE ticket', 'fix this CVE and
open a PR', or a bare CVE-YYYY-NNNNN identifier.
/call-graph-analysisPerform definitive call graph analysis to prove whether vulnerable functions are reachable from program entry points/codebase-impact-analysisAnalyze a Go codebase to determine if it is impacted by a specific CVE using multiple verification methods and assign a risk levelnpx claudepluginhub openshift-eng/ai-helpers --plugin complianceOther plugins' skills for the same job