Repository navigation
Conversation
The Jira Service Account token authenticates only through the API gateway (https://api.atlassian.com/ex/jira/<cloudId>), with Bearer or with Basic using the suffixed email on record. - jira-client.py: JIRA_EMAIL is optional (unset -> Bearer, set -> Basic); add get_server_info() (cached per process, fails loudly) + browse_url() and the get_server_info CLI subcommand. - /browse/ links (execute-actions, execute-triage-security-actions, pre_triage_security discover) come from serverInfo.baseUrl, never the REST base; the jira.invalid fallback is gone. - The email reaches only the fullsend CLI: _jira_native_env passes JIRA_USER_EMAIL through; both harnesses declare it (triage-security comment actions also post via post_jira_comment_native) and no longer map JIRA_EMAIL. pre-scripts no longer require JIRA_EMAIL. - Remove the unused env.sandbox.JIRA_BASE_URL from both harnesses. - fullsend.md: gateway setup, suffixed email, unsupported-setup caveat and fallback, exit condition, emergency personal-token procedure, and a secrets.env sample matching the harness variables. Implements TC-6191 Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements TC-6191 Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's GuideMoves runner Jira REST traffic to the Atlassian API gateway with Bearer service-account authentication, keeps Basic credentials isolated to fullsend comment posting, and makes all generated browse links resolve through cached Jira serverInfo while updating harness configuration, operational documentation, tests, and verify-pr pins. Sequence diagram for gateway Jira reads and browse linkssequenceDiagram
participant Runner
participant JiraClient as jira-client.py
participant Gateway as AtlassianGateway
participant Jira
Runner->>JiraClient: search_jql or get_issue
JiraClient->>Gateway: REST request with Bearer token
Gateway->>Jira: Forward REST request
Jira-->>Gateway: Jira response
Gateway-->>JiraClient: Jira response
Runner->>JiraClient: browse_url(issue_key)
JiraClient->>JiraClient: get_server_info()
JiraClient->>Gateway: GET /rest/api/3/serverInfo
Gateway->>Jira: Forward serverInfo request
Jira-->>Gateway: serverInfo.baseUrl
Gateway-->>JiraClient: serverInfo.baseUrl
JiraClient-->>Runner: baseUrl/browse/issue_key
Sequence diagram for fullsend Jira comment authenticationsequenceDiagram
participant Action as execute-actions.py
participant Fullsend as FullsendCLI
participant Gateway as AtlassianGateway
participant Jira
Action->>Fullsend: post_jira_comment_native()
Fullsend->>Gateway: POST Jira comment with Basic email plus token
Gateway->>Jira: Forward comment request
Jira-->>Gateway: Comment result
Gateway-->>Fullsend: Comment result
Fullsend-->>Action: Post result
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="plugins/sdlc-workflow/scripts/jira-client.py" line_range="64" />
<code_context>
+ if email:
+ auth_b64 = b64encode(f"{email}:{api_token}".encode('utf-8')).decode('ascii')
+ return f"Basic {auth_b64}"
+ return f"Bearer {api_token}"
+
+
</code_context>
<issue_to_address>
**Invalid Jira access silently skips verification**
When the gateway request is unauthenticated or otherwise returns a successful empty JQL response, `search_jql` can return an empty result without an HTTP error for an unauthenticated request; `pre-verify-pr.sh` passes that result to `resolve-gated-issue`, which treats no matching issue as a normal skip, so the run can finish green without verifying the PR. The shell reports authentication errors only when the Jira client exits nonzero.
Validate Jira identity or otherwise distinguish an unauthenticated empty search from a legitimate no-match result, and fail the run in that case.
</issue_to_address>
### Comment 2
<location path="plugins/sdlc-workflow/scripts/execute-triage-security-actions.py" line_range="80" />
<code_context>
- base_url = os.environ.get("JIRA_SERVER_URL", "https://jira.invalid").rstrip("/")
- return "{}/browse/{}".format(base_url, issue_key)
+ """Build a Jira browse URL for a generated issue reference from serverInfo.baseUrl."""
+ return _jira_mod.browse_url(issue_key)
</code_context>
<issue_to_address>
**Retry duplicates created Jira tasks**
When a task creation succeeds but the subsequent serverInfo request fails, a remediation or release-task action can create its Jira issue before `_browse_url` first calls `get_server_info`; if that lookup then fails, execution stops before the reference is registered. A retry can create the same task again, leaving duplicate Jira issues.
Fetch and validate serverInfo before any triage action that creates an issue, before issuing the Jira create request.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if the gateway URL or Bearer-versus-Basic selection is wrong, the runner may lose Jira access or perform Jira writes under an unintended identity; reverting restores the prior configuration, but comments or issues already created remain.
Blocking findings: plugins/sdlc-workflow/scripts/jira-client.py:64, plugins/sdlc-workflow/scripts/execute-triage-security-actions.py:80
| if email: | ||
| auth_b64 = b64encode(f"{email}:{api_token}".encode('utf-8')).decode('ascii') | ||
| return f"Basic {auth_b64}" | ||
| return f"Bearer {api_token}" |
There was a problem hiding this comment.
🟡 Medium · Invalid Jira access silently skips verification
When the gateway request is unauthenticated or otherwise returns a successful empty JQL response, search_jql can return an empty result without an HTTP error for an unauthenticated request; pre-verify-pr.sh passes that result to resolve-gated-issue, which treats no matching issue as a normal skip, so the run can finish green without verifying the PR. The shell reports authentication errors only when the Jira client exits nonzero.
Validate Jira identity or otherwise distinguish an unauthenticated empty search from a legitimate no-match result, and fail the run in that case.
Prompt for AI agents
In `plugins/sdlc-workflow/scripts/jira-client.py` at line 64:
**Invalid Jira access silently skips verification**
When the gateway request is unauthenticated or otherwise returns a successful empty JQL response, `search_jql` can return an empty result without an HTTP error for an unauthenticated request; `pre-verify-pr.sh` passes that result to `resolve-gated-issue`, which treats no matching issue as a normal skip, so the run can finish green without verifying the PR. The shell reports authentication errors only when the Jira client exits nonzero.
Validate Jira identity or otherwise distinguish an unauthenticated empty search from a legitimate no-match result, and fail the run in that case.There was a problem hiding this comment.
[sdlc-workflow/verify-pr] Classified as code change request — sub-task TC-7265 (https://redhat.atlassian.net/browse/TC-7265) created to address this feedback. The verify-pr gating flow (pre-verify-pr.sh) still treats an authenticated-looking empty JQL result (exit 0, []) as a normal skip, so a run can finish green without verifying the PR; the sub-task adds a fail-closed identity guard before the empty result is honored.
| base_url = os.environ.get("JIRA_SERVER_URL", "https://jira.invalid").rstrip("/") | ||
| return "{}/browse/{}".format(base_url, issue_key) | ||
| """Build a Jira browse URL for a generated issue reference from serverInfo.baseUrl.""" | ||
| return _jira_mod.browse_url(issue_key) |
There was a problem hiding this comment.
🟡 Medium · Retry duplicates created Jira tasks
When a task creation succeeds but the subsequent serverInfo request fails, a remediation or release-task action can create its Jira issue before _browse_url first calls get_server_info; if that lookup then fails, execution stops before the reference is registered. A retry can create the same task again, leaving duplicate Jira issues.
Fetch and validate serverInfo before any triage action that creates an issue, before issuing the Jira create request.
Prompt for AI agents
In `plugins/sdlc-workflow/scripts/execute-triage-security-actions.py` at line 80:
**Retry duplicates created Jira tasks**
When a task creation succeeds but the subsequent serverInfo request fails, a remediation or release-task action can create its Jira issue before `_browse_url` first calls `get_server_info`; if that lookup then fails, execution stops before the reference is registered. A retry can create the same task again, leaving duplicate Jira issues.
Fetch and validate serverInfo before any triage action that creates an issue, before issuing the Jira create request.There was a problem hiding this comment.
[sdlc-workflow/verify-pr] Classified as code change request — already addressed in this PR, so no sub-task was created. The requested hardening is present: execute-actions.py::_create_and_register now calls _jira_mod.get_server_info() before create_issue (with a comment noting this prevents creating an issue whose key is never registered, which a retry would duplicate), and in the triage-security executor _preflight_plan invokes _browse_url (→ cached get_server_info()) for reference-producing actions before any write, so a serverInfo failure aborts before any issue is created.
|
🤖 Finished Verify Pr · ✅ Success · Started 2:17 PM UTC · Completed 2:29 PM UTC Commit: Runtime: claude · Model: claude-opus-4-8 · Effort: high · Cost: $7.45 |
|
[sdlc-workflow/verify-pr] Re: @sourcery-ai[bot] review — this review body restates the two inline comments, classified as follows:
|
Verification Report for TC-6191 (commit fdf7b1d)
Overall: WARNOverall: WARN The PR is well-scoped, fully traceable, CI-green, and its acceptance criteria and tests are satisfied for everything verifiable from the diff. One reviewer-flagged defect remains open: the verify-pr gating flow can finish green on an unauthenticated/identity-unverified empty Jira search ( No code was modified and the PR was not merged — a human reviewer decides whether to merge. This comment was AI-generated by sdlc-workflow/verify-pr v0.13.10. |
An invalid credential (e.g. a Service Account token off the API gateway) makes JQL return an empty result with exit 0, which the gate turned into a green ADR-0072 skip without verifying the PR. - jira-client.py: add verify_identity() + CLI subcommand; exits non-zero unless GET /myself resolves to a non-empty accountId. - pre-verify-pr.sh: run verify_identity before the JQL gate, so an empty search is only honored as a skip once the principal is confirmed; per-run mktemp stderr file instead of a fixed /tmp path. - Tests: verify_identity unit tests, and integration tests running the real pre-verify-pr.sh against a local stub Jira (unverified identity + empty search fails; verified identity + empty search still skips). Implements TC-7265 Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jira silently drops issues the caller cannot see, so a valid account without Browse Projects on the project gets 200 [] from the gate's JQL -- indistinguishable from a genuine no-match -- and verify-pr skipped green. - jira-client.py: add verify_project_access(project_key) + CLI subcommand; exits non-zero unless GET /mypermissions grants BROWSE_PROJECTS. - pre-verify-pr.sh: require JIRA_PROJECT_KEY (pinned TC in the harness) and check project access after the identity check, before the search. - Tests: unit tests for verify_project_access; integration test running the real pre-verify-pr.sh against the stub Jira (denied/missing permission + empty search fails; granted still skips). - fullsend.md: document the fail-closed gate and its SA requirements. Implements TC-6191 Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements TC-7265 Implements TC-6191 Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Finished Verify Pr · ✅ Success · Started 3:47 PM UTC · Completed 3:55 PM UTC Commit: Runtime: claude · Model: claude-opus-4-8 · Effort: high · Cost: $5.57 |
Verification Report for TC-6191 (commit f4e27af)
Overall: WARNNo blocking issues. All correctness and security gates pass: CI is green (6/6 check-runs), no secrets detected, and the code-level acceptance criteria and test requirements are met in the diff (optional WARN items are informational:
This report is informational — a human reviewer decides whether to merge. This skill does not merge the PR or transition the Jira issue. This comment was AI-generated by sdlc-workflow/verify-pr v0.13.10. |
Summary
The Jira Service Account token (
tpa-fullsend-jira-sa) authenticates only through the Atlassian API gateway, using Bearer, or Basic with the suffixed email on record. This PR moves the runner's Jira access onto the gateway.jira-client.py:JIRA_EMAILis optional. When unset it sends Bearer (the runner); when set it sends Basic (interactive users, unchanged). Addsget_server_info()(cached per process, fails loudly),browse_url(), and aget_server_infoCLI subcommand./browse/links come fromserverInfo.baseUrlin all three builders (execute-actions.py,execute-triage-security-actions.py,pre_triage_security.py discover). They never use the REST base, and thehttps://jira.invalidfallback is removed.Email is used only by the fullsend CLI:
_jira_native_envpassesJIRA_USER_EMAILthrough unchanged. Neither harness mapsJIRA_EMAILany more, and the pre-scripts no longer require it.Removed the unused
env.sandbox.JIRA_BASE_URLfrom both harnesses.fullsend.md: documents the gateway setup, the suffixed-email requirement, the unsupported-setup caveat and its fallback (docs(#4885): document Jira auth model, token rotation, migration fullsend-ai/fullsend#8678, #4885), the exit condition, an emergency procedure for falling back to a personal token, and asecrets.envsample that matches the harness variables.Re-pinned and re-locked verify-pr to
b79eb1b2in the same PR. triage-security's pin is left alone (it is bumped under TC-7250).Fail-closed gate (TC-7265, from Sourcery/verify-pr review):
pre-verify-pr.shnow callsjira-client.py verify_identitybefore the JQL gate. The run fails unlessGET /myselfreturns anaccountId, so a broken credential's empty200 []search can no longer become a green ADR-0072 skip.Project-access gate (TC-6191 follow-up): the gate also runs
verify_project_access(GET /mypermissions,BROWSE_PROJECTSonJIRA_PROJECT_KEY). A valid account that can't see TC would otherwise also get a filtered[]and skip.Re-pinned and re-locked verify-pr to
02ba46de.Deviations from the task (agreed during implementation)
harness/triage-security.yamlalso declaresJIRA_USER_EMAIL. Triagecommentactions post throughpost_jira_comment_native, which is the fullsend CLI, so the AC wording "declared only in verify-pr" was wrong.test_triage_security_fullsend.py, got a 2-line fixture stub forget_server_info._create_and_registerfetches serverInfo beforecreate_issue. Without that, a serverInfo failure could leave a sub-task created but never registered (found by code review).Cutover (before merging)
After this merges the runner sends Bearer, and personal tokens fail with Bearer. Switch CI first:
JIRA_API_TOKEN(Service Account token) andJIRA_EMAIL(suffixed email), and the variableJIRA_BASE_URL(the gateway,https://api.atlassian.com/ex/jira/<cloudId>).JIRA_SERVER_URLandJIRA_PROJECT_KEY.Test plan
python3 -m pytest plugins/sdlc-workflow/scripts/ -q: 795 passed, 3 skippeduvx skillsaw: 0 errorsclaude plugin validate plugins/sdlc-workflow: passedfullsend issues post-commentthrough the gateway with Service Account Basic credentialsImplements TC-6191, TC-7265
🤖 Generated with Claude Code
Summary by Sourcery
Move runner Jira REST access to the Atlassian API gateway while keeping fullsend comment publishing compatible with Service Account credentials.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests:
Chores: