Repository navigation
Conversation
E2E tests did not runE2E tests run automatically for pull requests authored by users with write access or higher. For other contributors, someone with write access must add the Reason: See E2E testing guide for details. |
PR Summary by QodoRead Jira authorization lists from environment variables
AI Description
Diagram
High-Level Assessment
Files changed (24)
|
Code Review by Qodo
1.
|
Site previewPreview: https://a8b2559a-site.fullsend-ai.workers.dev Commit: |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
waynesun09
left a comment
There was a problem hiding this comment.
Two review findings below, both MEDIUM.
| return cr | ||
| } | ||
| } | ||
| if err := checkJiraAuthorizationEnvSupport(ctx, d, cfg, refResolver); err != nil { |
There was a problem hiding this comment.
MEDIUM: repos status does not run the new groups_from/accounts_from support check that install fails on
checkJiraAuthorizationEnvSupport is called only from convergeRepo (here). The repo's convention is that status reports any configuration error install would fail on. status.go:421-427 already does this for checkEstablishedServiceAccountSupport, with the comment "Report the configuration error install would fail on". So when the jira entry uses groups_from/accounts_from with a fullsend_ref or stamped scaffold ref that predates them, repos status reports the repo as clean and repos install then rejects it.
Suggestion: call checkJiraAuthorizationEnvSupport in the status path next to checkEstablishedServiceAccountSupport (status.go:424) and set status.Error. If that is not wanted, say in docs/cli/repos.md that only install runs this check.
There was a problem hiding this comment.
Fixed in 3da5167. repos status now runs checkJiraAuthorizationEnvSupport next to checkEstablishedServiceAccountSupport and sets status.Error.
One case is not covered: a repo that is not installed yet still shows "not installed" with no error, because status returns before that line. Tell me if you want that covered too.
| return nil | ||
| } | ||
| names := strings.Join(d.jira.authEnv, ", ") | ||
| if refResolver == nil { |
There was a problem hiding this comment.
MEDIUM: support check fails hard with no GitHub client, unlike the sibling GitLab checks
Take a GitLab-only converge on a source or dev build: there is no fullsend_ref, cfg.UpstreamRef is empty, and the scaffold is stamped. establishedScaffoldRef then returns the stamped ref. With refResolver nil, this branch returns "... cannot be checked for support without an upstream GitHub client" and install stops. checkGitLabJiraOAuthSupport (gitlab_jira_poll.go) returns nil when the resolver is nil. The pinned-and-differing case is already rejected earlier, at converge.go:1501. So this branch only adds a new hard failure for unpinned dev-build GitLab installs. No test covers it, and neither a comment nor the docs explain why it differs from the sibling checks.
Suggestion: decide whether this branch should fail closed. If yes, add a test and a line in the docs and the code comment explaining why it differs from checkGitLabJiraOAuthSupport. If no, return nil when refResolver is nil and the ref came from establishedScaffoldRef.
There was a problem hiding this comment.
Fixed in 3da5167, with your second option. The check now returns nil when there is no GitHub client and the ref comes from establishedScaffoldRef. A pinned ref keeps its error.
I also added a test for the stamped scaffold with no client.
71c9aa0 to
3da5167
Compare
3da5167 to
ed07311
Compare
The fix for
The catalog still lists this finding as active, so it should close on the next review. I have not dismissed it, since you didn't ask me to.
|
waynesun09
left a comment
There was a problem hiding this comment.
Two review findings below, both MEDIUM.
| 2. Mask it before anything else prints it: | ||
|
|
||
| ```bash | ||
| echo "::add-mask::$VALUE" |
There was a problem hiding this comment.
MEDIUM: the recipe for a store with no GitHub Action breaks on a one-ID-per-line list and can print IDs to the log
Line 965 says a list stored one entry per line also works. This recipe then runs echo "::add-mask::$VALUE" and echo "FULLSEND_JIRA_WRITE_GROUPS=$VALUE" >> "$GITHUB_ENV". When $VALUE has more than one line:
- Only the first line is a workflow command, so only that line is masked. The other lines go to the job log as plain text. That leaks the IDs this feature is meant to hide, and on a public repo anyone can read them.
- The
NAME=valueform in$GITHUB_ENVcan't hold newlines. The runner either rejects the file or reads it wrong.
The earlier thread on this recipe was about readability. This is a separate problem.
Suggestion: turn the value into one line before masking, e.g. VALUE="$(printf '%s' "$VALUE" | tr '\n' ',')". Or mask each line in a loop and write $GITHUB_ENV with the NAME<<EOF_<random> delimiter form. Then run the recipe once and paste its real output.
There was a problem hiding this comment.
Fixed in 5bcc93c. Step 1 now joins the value into one line: VALUE="$(<command> | tr -s '\r\n' ',')".
I added \r to your first suggestion. With tr '\n' ',' alone, a list with Windows line endings still printed entries 2 and 3.
I ran it on a GitHub runner with fake IDs, on 8 input shapes: run, jobs join_tr__*. No ID is printed, and a later step sees the variable as *** with the right entries.
| continue-on-error: true | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: | ||
| name: fullsend-jira-dispatches |
There was a problem hiding this comment.
MEDIUM: a fixed artifact name with overwrite: true mixes up dispatches when a run calls the reusable workflow twice
Both uploads (lines 168 and 178) and both downloads (lines 207 and 213) use the fixed name fullsend-jira-dispatches, and the uploads set overwrite: true. Artifact names are unique per workflow run.
Say a user's own caller calls reusable-poll-jira.yml twice in one run, with a strategy matrix or two poll jobs:
- The second upload replaces the first.
- Both matrix jobs build from the same file.
- One poll's dispatches are lost after its Jira checkpoints have already moved. The other poll's dispatches run twice.
- Both runs still show green.
Before this PR the matrix went through a job output, so those callers worked. The managed caller calls the workflow only once, so only custom callers are affected.
Suggestion: give each call its own name. For example, have the poll job output a random suffix (e.g. from openssl rand -hex 8) next to dispatch_count, and use fullsend-jira-dispatches-${{ needs.poll.outputs.artifact_suffix }} in both the upload and the download. Or document that a run may call this workflow only once.
There was a problem hiding this comment.
Fixed in 5bcc93c, with your first suggestion. The poll job outputs a random artifact_suffix, and both uploads and both downloads use it.
Tested on GitHub runners with a copy of the workflow and a fake poll step:
- Before: two poll jobs in one run both got the second poll's dispatches (run).
- After: each call gets its own (run).
- "Re-run failed jobs" still reads the same artifact (run).
A strategy matrix still returns one leg's matrix to the caller. It does the same on main (run), because GitHub keeps one leg's output.
ed07311 to
5bcc93c
Compare
waynesun09
left a comment
There was a problem hiding this comment.
Two review findings below, both MEDIUM.
|
|
||
| #### GitLab: CI/CD variables | ||
|
|
||
| The Jira poll job receives the project's CI/CD variables, so any variable |
There was a problem hiding this comment.
MEDIUM: the GitLab recipe with the example FULLSEND_JIRA_* names makes repos status fail on orphan variables, and the guide doesn't say so
This subsection says "any variable name works", but every example in the guide uses FULLSEND_JIRA_WRITE_GROUPS and the other FULLSEND_ names. CheckOrphanVars (internal/repos/drift.go, lines 181-220) flags every repository variable that starts with FULLSEND_ and is not in the managed set. So a GitLab user who copies the example names gets orphan drift, and repos status exits with an error. The PR body lists this under "Not in this PR" (#9108), but a reader of the guide gets no warning.
Suggestion: add a sentence here that names #9108 and says these variables show up as orphan drift until it is fixed. Or, since GitLab accepts any name, tell readers to pick a name without the FULLSEND_ prefix (for example JIRA_WRITE_GROUPS) so no drift appears.
| matrix: | ||
| description: Dispatch matrix accepted by reusable-dispatch.yml. | ||
| value: ${{ jobs.poll.outputs.matrix }} | ||
| value: ${{ jobs.matrix.outputs.matrix || '{"include":[]}' }} |
There was a problem hiding this comment.
MEDIUM: the two-job hand-off was tested only as copied steps, never through workflow_call from a real caller
The PR body says "The caller and the workflow's matrix output are unchanged." The real run behind that (gwenneg/fullsend run 42791612406) copied the poll, check, save and matrix steps into a top-level push workflow and passed the secrets in directly. Three things have not run at the PR head:
- This
workflow_calloutput fallback,jobs.matrix.outputs.matrix || '{"include":[]}', when thematrixjob is skipped on a 0-dispatch cycle, and how thedispatchjob'sif:in the managed caller handles it (jira-poll-per-repo.yaml, line 53). - List secrets arriving through the caller's
secrets:mapping orsecrets: inherit. - The matrix output still arriving through
workflow_callwhen a list secret equals the acting account ID.
The code looks right: a skipped job's output is empty, so the fallback applies. The gap is in the validation, not a known bug.
Suggestion: before merge, run the rendered managed caller once on a fork, calling reusable-poll-jira.yml at the PR head. Cover one 0-dispatch cycle (dispatch is skipped cleanly) and one cycle where a list secret equals the actor ID (the matrix arrives), and link the runs. Or reword the PR body to say only the copied steps were tested.
There was a problem hiding this comment.
Done. I ran the rendered managed caller on my fork, calling reusable-poll-jira.yml at e49176a, with the real CLI and a mock Jira.
- 0-dispatch cycle: the
matrixjob is skipped, the caller gets{"include":[]}, anddispatchis skipped. - List secret equal to the actor ID: the list secrets arrive through the caller's
secrets:mapping, and all 4 dispatches reach thedispatchjob.
Differences from a real install:
uses:points to the commit on my fork. GitHub can't resolve it throughfullsend-ai/fullsendbefore merge.- The trigger is a push.
dispatchcalls a stub that prints the matrix, so no agent starts. Itsneeds,if:andmatrixare the rendered ones.- A
showjob prints what the caller received. - The CLI is a vendored build of the same commit, behind a wrapper that starts the mock.
The PR description lists these runs.
…cenario zero (to be deleted)
…cenario actor (to be deleted)
…cenario zero (to be deleted)
…cenario actor (to be deleted)
5bcc93c to
e49176a
Compare
waynesun09
left a comment
There was a problem hiding this comment.
One review finding below, MEDIUM.
| } | ||
| if exists && !scaffold.IsManagedJiraPollCaller(have) { | ||
| // A reusable workflow gets only the secrets its caller passes. | ||
| if missing := userJiraCallerUnforwarded(have, req.AuthorizationEnv); len(missing) > 0 && req.Warn != nil { |
There was a problem hiding this comment.
MEDIUM: the user-owned caller warning gives advice that cannot work for non-standard names, and says nothing under secrets: inherit
For a user-owned caller, Ensure passes every *_from variable name to userJiraCallerUnforwarded(have, req.AuthorizationEnv), then tells the user to "add it to that job's secrets". But reusable-poll-jira.yml declares only the four FULLSEND_JIRA_{WRITE,TRIAGE}_{GROUPS,ACCOUNTS} list secrets (lines 51-57). Its poll step maps only those four into the poller env (lines 124-127).
- Advice that cannot work. A name outside
scaffold.JiraAuthorizationSecrets, such asMY_WRITE_GROUPS, cannot reach the poller through any secrets mapping. Adding it to the job's secrets does nothing. - No warning under inherit.
jiraJobUnforwardedreturns nil forsecrets: inherit(lines 226-227). Inherit still reaches the poller only through those four env mappings. So a non-standard name under inherit gets no warning, and that list grants no one without saying so.
The managed-caller branch (lines 306-309) already gives the right advice: "rename it to one of ...". This fails closed (deny), so the impact is a misleading or missing warning, not a security hole.
Suggestion
- Split the names first with
splitJiraAuthorizationEnv. - For the forwardable names, keep the "add it to that job's secrets" advice, and treat
secrets: inheritas forwarding exactly those names. - For a non-forwardable name, always warn, whatever the
secretsnode says. Use the managed branch's advice: rename it to one of the four, or run the poller in your own job. - Update
TestConverge_GitHubJiraPoll_WarnsAboutListVariableItCannotForwardso that inherit +MY_WRITE_GROUPSexpects a warning.
There was a problem hiding this comment.
Fixed in f8a5e6e, following your four steps.
- The "add it to that job's secrets" warning now covers only the four standard names.
secrets: inheritcounts as passing them. - Any other name gets the rename advice, with a mapping or with
inherit. - The test covers both names with both forms of
secrets:.
One addition: the rename warning shows only when the caller has a job that calls reusable-poll-jira.yml. A caller that runs the poller itself gets no warning.
I also ran it on a fork. Passing MY_WRITE_GROUPS in the mapping makes GitHub reject the workflow at startup (run): "Invalid secret, MY_WRITE_GROUPS is not defined in the referenced workflow."
e49176a to
f8a5e6e
Compare
waynesun09
left a comment
There was a problem hiding this comment.
Two review findings below, both MEDIUM.
| return fmt.Errorf("%s/%s: config.yaml reads %s with groups_from/accounts_from, and %s %q cannot be checked for support without an upstream GitHub client", | ||
| resolved.Owner, resolved.Repo, names, source, ref) | ||
| } | ||
| content, err := refResolver.client.GetFileContentAtRef(ctx, shimOwner, shimRepo, reusableJiraPollWorkflowPath, ref) |
There was a problem hiding this comment.
MEDIUM: the Jira list support check ignores vendor: true, unlike its sibling checks
checkJiraAuthorizationEnvSupport reads reusable-poll-jira.yml from upstream at the pinned fullsend_ref. If that file lacks FULLSEND_JIRA_WRITE_GROUPS, it rejects the repo. It never looks at resolved.Vendor.
The sibling checks do handle vendored installs:
checkPinnedServiceAccountSupport(gitlab_existing_wif.go:166) returns nil whenresolved.Vendoris set.checkOpenAIWIFContract(openai_wif.go:897-899) reads the vendored workflows throughcfg.ReadVendoredWorkflow.converge.go:1736-1739skips the remote scaffold fetch for vendored installs, because what gets committed comes from the running binary's embedded templates and the vendored binary.
Failure case: a GitHub repo with vendor: true, a fullsend_ref pinned before #9132, and groups_from or accounts_from in config. Run it with a newer binary (the running one, or one passed with --fullsend-binary). Install and status refuse it with does not support; set fullsend_ref..., even though the vendored binary and workflows support the keys.
Suggestion: handle vendored installs the way the siblings do. Either check the vendored reusable-poll-jira.yml through cfg.ReadVendoredWorkflow when resolved.Vendor && cfg.ReadVendoredWorkflow != nil, or skip the check for vendored installs. Add a test for a vendored install with an old pin.
There was a problem hiding this comment.
Fixed in f7888a5, but not with either option. Both would let a broken caller through.
- The managed poll caller always calls upstream
reusable-poll-jira.ymlat the pinned ref, even withvendor: true. The vendored copy is never called. - So with a pin at v0.55.0 and
groups_from: FULLSEND_JIRA_WRITE_GROUPS, the caller passes a secret that workflow does not declare. GitHub then rejects the caller at startup (run).
The check now skips a vendored install, except in that one case: GitHub, polling on, and the config reads one of the four FULLSEND_JIRA_* names.
Tests cover a vendored install with an old pin: polling off, another name, and a standard name.
| GitLab gives the variable to every job in pipelines on protected branches or | ||
| tags, not only the Jira poll job: agent jobs and the project's own jobs get it | ||
| too. The poller never prints the value, and if another job does, the log | ||
| shows `[MASKED]`. Some older self-managed GitLab versions refuse to mask a |
There was a problem hiding this comment.
MEDIUM: the guide misstates what happens when an older GitLab can't mask a comma-separated list
This says: "Some older self-managed GitLab versions refuse to mask a value that contains a comma. There, the value stays visible to any job that prints it."
GitLab checks the masking rules when the variable is saved. A value that fails them can't be saved as Masked at all, so it is not stored unmasked without the reader knowing. It ends up visible only if the reader then chooses to save it unmasked, and the text reads as if that is fine.
The sentence names no GitLab version. Neither does the rule "GitLab masks a value that contains a comma only when expansion is off" (line 1095), nor the Masked and hidden option (line 1093). The PR's Testing section also says the GitLab variable steps were not run on a GitLab instance.
Suggestion: rewrite the last sentence along these lines: "If GitLab refuses to save the value as Masked (versions that allow only a fixed character set), save one group ID per variable, or upgrade to a version that allows any character when expansion is off. Do not save the list unmasked." Name the GitLab version, or link the GitLab docs section, for the comma-masking rule and for Masked and hidden. Then either test the steps on a GitLab instance or mark them as not tested.
There was a problem hiding this comment.
Fixed in f7888a5.
- The guide now says GitLab refuses to save a value it cannot mask, and not to save the list unmasked.
- It gives the versions: 15.9 for a comma with expansion off, 17.4 for Masked and hidden. It links GitLab's masking docs.
- I left out "one group ID per variable". Each
groups_fromreads one variable, so the guide says only a one-entry list can be masked before 15.9.
I did not run the steps on a GitLab instance. The PR description says so.
196aa41 to
f7888a5
Compare
|
I rebased and fixed merge conflicts. |
| jq -e 'type == "array"' dispatches.json > /dev/null | ||
| # JSON escapes characters such as quotes, and event_payload is JSON | ||
| # inside a string, so search the decoded strings, not the file. | ||
| jq -r '.., (.[].event_payload | fromjson | ..) | strings' dispatches.json > dispatch-strings.txt |
There was a problem hiding this comment.
Done in 6c944a0. I rebased on main and dropped fromjson.
fe9cf17 to
6c944a0
Compare
waynesun09
left a comment
There was a problem hiding this comment.
Two review findings below, both MEDIUM.
| accounts: ["712020:00000000-0000-0000-0000-000000000000"] # Jira account IDs | ||
| triage: # Fullsend role triage | ||
| groups: [example-team] | ||
| groups_from: FULLSEND_JIRA_TRIAGE_GROUPS # Or read a list from an environment variable |
There was a problem hiding this comment.
MEDIUM: the config reference example uses a FULLSEND_ list name, which the Jira guide tells GitLab users to avoid
The main config example uses groups_from: FULLSEND_JIRA_TRIAGE_GROUPS. The GitLab section of the Jira guide (docs/guides/user/jira-integration.md, near lines 1370-1378, added in e49176a) says GitLab users should not use the FULLSEND_ prefix. repos status reports unmanaged FULLSEND_ variables as orphan drift and exits with an error. This page gives no forge caveat, so a GitLab reader who copies the example hits that error. The earlier thread fixed the guide but not this page.
Suggestion: add a short comment next to the example:
- On GitHub, the managed workflow forwards only the four
FULLSEND_JIRA_*names. - On GitLab, use a name without the
FULLSEND_prefix, for exampleJIRA_TRIAGE_GROUPS. - Link the guide's GitLab section.
There was a problem hiding this comment.
Fixed in ba11620. The example comment now says GitLab needs a name without the FULLSEND_ prefix. The "Lists from the environment" paragraph says the same, gives JIRA_TRIAGE_GROUPS as an example and links the guide's GitLab section. That paragraph already had the GitHub rule.
| repository. | ||
|
|
||
| List groups by group ID, not by name, and use groups rather than `accounts`. | ||
| A group ID does not resolve to a name or to members for someone who is not |
There was a problem hiding this comment.
MEDIUM: the claim that a group ID reveals nothing to signed-out users has no source, and the security advice depends on it
This line says: "A group ID does not resolve to a name or to members for someone who is not signed in to your site." The guide uses that claim to recommend inline group IDs in a public config.yaml. Other outside claims in this section link a source or a run, such as GitHub masking and the GitLab masking versions. This one has no Atlassian reference and no test in the PR or in #9132. Whether a signed-out caller can resolve a group depends on the Jira Cloud "Browse users and groups" permission and the site's anonymous access settings.
Suggestion: do one of these:
- Cite the Atlassian REST doc for
/rest/api/3/group/member?groupId=and the permission it needs. - Test a signed-out request against a site.
- Or soften the sentence ("on a site without anonymous access") and present
groups_fromas the way to keep IDs private.
There was a problem hiding this comment.
Fixed in ba11620. I softened the sentence and added sources:
- It now says Jira returns a group's name or members only to a caller with the Browse users and groups permission, and links the REST doc for
group/member. - It says a site does not grant that permission to signed-out people unless an admin chose to, and links Atlassian's "Prevent or remove public access" page.
- It presents
groups_fromas the way to keep the IDs private whatever the site's settings.
I also sent signed-out requests to ecosystem.atlassian.net, a public Jira Cloud site: group/member, group/bulk, group and user/groups returned 401, and groups/picker returned an empty list. I could not test a site that grants the permission to Anyone.
27195c5 to
ba11620
Compare
|
I rebased and fixed merge conflicts. |
waynesun09
left a comment
There was a problem hiding this comment.
Four review findings below, all MEDIUM.
| - **Visibility:** Masked and hidden (GitLab 17.4 or later), or Masked. | ||
| - **Flags:** select **Protect variable** and clear **Expand variable | ||
| reference**. GitLab masks a value that contains a comma only when | ||
| expansion is off, and only in GitLab 15.9 or later. See |
There was a problem hiding this comment.
MEDIUM: wrong GitLab version for masking a comma list. The guide says 15.9, GitLab's docs say 16.6
Lines 1433-1436 say GitLab masks a value with a comma "only when expansion is off, and only in GitLab 15.9 or later". Lines 1446-1449 say "Before GitLab 15.9 a masked value can't contain a comma ... upgrade GitLab".
I checked GitLab's versioned doc/ci/variables/index.md, section "Mask a CI/CD variable":
- At v15.9.0-ee and v16.5.0-ee, a masked value must be "8 characters or longer, consisting only of: Characters from the Base64 alphabet (RFC4648). The
@,:,., or~characters". So no comma is allowed. - The looser rule first appears at v16.6.0-ee: "Be 8 characters or longer". The character limit applies only "if variable expansion is enabled".
A user on GitLab 15.9 to 16.5 who follows the guide can't save the masked list, and the upgrade advice names the wrong version. The 15.9 figure came in with f7888a5, in reply to the earlier thread that asked for a version. That thread didn't check the number itself.
Suggestion: change both mentions from 15.9 to 16.6, and change the "Before GitLab 15.9" paragraph to match. Optionally, also say that Masked and hidden is GA in 17.6 and sits behind the ci_hidden_variables feature flag in 17.4 and 17.5.
There was a problem hiding this comment.
I kept 15.9, and tested it. I ran GitLab CE 15.8.6, 15.9.8 and 16.5.10 locally and saved a masked variable holding two group IDs separated by a comma, with expansion off, through the API: 15.8.6 refuses it (400), 15.9.8 and 16.5.10 save it (201). The change shipped in 15.9 (!109008 and !110773). The 16.6 docs wording comes from a docs-only change (!136405). Masked and hidden is on by default from 17.4 (docs), so I kept that too.
| --output dispatches.json \ | ||
| --fullsend-dir .fullsend | ||
|
|
||
| # The matrix job has no secrets, so GitHub no longer blocks a Jira |
There was a problem hiding this comment.
MEDIUM: Check dispatches no longer covers FULLSEND_JIRA_EMAIL or FULLSEND_JIRA_CLIENT_ID
The matrix used to be an output of the poll job, which held all four Jira credentials, and GitHub dropped that output if it held any secret value. Now the matrix is built in a job with no secrets. The replacement "Check dispatches" step (lines 137-160) checks only FULLSEND_JIRA_TOKEN and FULLSEND_JIRA_CLIENT_SECRET. FULLSEND_JIRA_EMAIL and FULLSEND_JIRA_CLIENT_ID are declared as secrets and passed to the Poll Jira step, but the check skips them.
Example: a dispatch record contains the poller account's email because someone quoted it in a Jira comment. That value now goes into the uploaded artifact, the downstream matrix and event_payload without masking. Before this change, GitHub would have dropped the output.
Suggestion: add FULLSEND_JIRA_EMAIL and FULLSEND_JIRA_CLIENT_ID to the step's env and to the for name in ... loop. Extend TestJiraPollWorkflowCheckDispatches to cover them.
There was a problem hiding this comment.
Fixed in 804e2da. The check step now also covers FULLSEND_JIRA_EMAIL and FULLSEND_JIRA_CLIENT_ID. The test has one case per secret, and TestJiraPollWorkflowSecretThreading checks that the step receives all four.
| @@ -354,7 +423,7 @@ var jiraProviderKeys = map[string]bool{"provider": true, "write": true, "triage" | |||
|
|
|||
| // jiraActorListKeys are the keys allowed in a jira provider write:/triage: | |||
| // mapping. | |||
There was a problem hiding this comment.
MEDIUM: groups_from/accounts_from change the config shape, but managed-config-schema stays at 2
This PR adds groups_from and accounts_from to jiraActorListKeys. Older releases check these keys strictly in AuthorizationProvider.UnmarshalYAML (checkMappingKeys), so v0.55.0 rejects a config that uses them.
internal/config/managed-config-schema (from #9292) says: "Increment it, and config.ManagedConfigSchemaVersion with a renderer for the previous version, whenever a per-repo configuration change is not readable by older releases." This PR leaves the declaration and ManagedConfigSchemaVersion at 2. ManagedConfigSchemaDependent and CheckManagedConfigSchemaCompat also don't know the new keys.
So a release that reads *_from and one that doesn't both declare schema 2, and the schema-compat path calls such a config compatible. Only the separate checkJiraAuthorizationEnvSupport check, which looks for a marker in reusable-poll-jira.yml, catches it. Install is still guarded, so this breaks the documented convention rather than causing silent breakage.
Suggestion: pick one.
- Bump the schema to 3, with a version-2 renderer or compat check that rejects
*_fromand names the setting. KeepcheckJiraAuthorizationEnvSupportonly for cases the schema mechanism can't cover. - Or say in the PR, and in a code comment next to the declaration, why this change deliberately doesn't bump the schema.
There was a problem hiding this comment.
I kept the schema at 2 and said why in the PR description and in a comment in managed-config-schema. I tried the bump to 3 first:
- v0.56.0-rc.1 then refuses every pinned repository whose config sets
tracker("declares schema version 3 … upgrade fullsend"), though the tracker shape did not change. - The schema path refuses a vendored install pinned to a schema-2 ref, which is the case fixed earlier in this PR.
- It can't replace
checkJiraAuthorizationEnvSupport: it runs only for a pinned ref, so both would stay, with two different errors for one problem.
You were right that status could call such a config compatible: it did for a repository that is not installed yet. Fixed in 117223a: status now runs the check there too.
Happy to bump if you still prefer it.
| // load the config. The ref checked is the pinned fullsend_ref, or the ref the | ||
| // installed scaffold is stamped with when install will not refresh it (see | ||
| // establishedScaffoldRef). Any other repository runs the current release. | ||
| func checkJiraAuthorizationEnvSupport(ctx context.Context, d convergeDiscovery, cfg ConvergeConfig, refResolver *RefResolver) error { |
There was a problem hiding this comment.
MEDIUM: the support check skips a user-owned caller that pins an older reusable-poll-jira.yml
Anchored here because the related lines in internal/repos/github_jira_poll.go (52-56) are outside the diff.
For a user-owned caller with token (non-OAuth) credentials, checkGitHubJiraPollWorkflow returns nil at github_jira_poll.go:52-56 and never reads the caller's uses refs. This function reads reusable-poll-jira.yml only at the pinned fullsend_ref or the stamped scaffold ref. Its comment assumes "Every job runs the CLI at the scaffold's ref".
A user-owned caller that pins reusable-poll-jira.yml@v0.55.0 breaks that assumption. The reusable workflow installs the CLI at its own workflow_sha. That old CLI rejects groups_from in config.yaml, or GitHub rejects the caller at startup if it forwards FULLSEND_JIRA_WRITE_GROUPS. Install and status still pass, and every scheduled poll fails.
The OAuth path already handles this case by checking each pinned ref (requireUserJiraCallerWorkflowsOAuth). The earlier user-owned caller thread (fixed in f8a5e6e) changed which names the warning covers, not which ref the caller pins.
Suggestion: when d.jira.authEnv is not empty and the caller is user-owned, collect the caller's reusable-poll-jira.yml uses refs, as userJiraCallerOAuthUses does. Read each ref for jiraAuthorizationEnvMarker, and fail or warn when the marker is missing. Add a test with a user-owned caller pinned to an old ref.
There was a problem hiding this comment.
Fixed in a989d8c. When the config uses the new keys and the poll caller is user-owned, install and status now read each reusable-poll-jira.yml the caller pins and fail if it predates them. A vendored install is skipped: the old workflow runs the vendored binary there. The test table has cases for both.
ba11620 to
804e2da
Compare
804e2da to
117223a
Compare
117223a to
a989d8c
Compare
a989d8c to
22e1681
Compare
|
I rebased and fixed conflicts. @waynesun09 |
waynesun09
left a comment
There was a problem hiding this comment.
Two MEDIUM findings from a review-only pass, posted inline.
| job, and set the output from a second job that reads it. | ||
| `reusable-poll-jira.yml` does it this way. | ||
|
|
||
| #### GitLab: CI/CD variables |
There was a problem hiding this comment.
MEDIUM: GitLab: a pipeline or schedule variable can override the authorization list, and the guide does not say so
On GitLab, groups_from/accounts_from read an ordinary CI/CD variable from the poll job's environment. Pipeline and schedule variables take precedence over project CI/CD variables. Someone who can run a pipeline or set a schedule variable on the protected ref the poll job runs on can define JIRA_WRITE_GROUPS and give their own Jira group write access, with no review of .fullsend/config.yaml.
The scaffold already treats this variable class as attacker-reachable: run-poll-job.sh:145 says "A pipeline/schedule variable of either name could ..." and pins those names. ci_pipeline_variables_minimum_override_role = no_one_allowed is only required for the trigger fast path. Per docs/cli/repos.md, a polling-only install that fails that check is deferred while polling continues. This section (lines 1539-1567) covers only the Protect, Mask and Expand settings and says nothing about this precedence.
I did not reproduce the exploit: this is a threat-model gap in the docs and a missing guard.
Suggestion: In this section, say that pipeline and schedule variables outrank project variables, and recommend ci_pipeline_variables_minimum_override_role: no_one_allowed for any repo that uses *_from. Better: have repos install/repos status warn when a GitLab repo uses *_from and the live override role is weaker than no_one_allowed, or have the GitLab poll script refuse a list name that is also set as a pipeline or schedule variable.
There was a problem hiding this comment.
Added a note to the GitLab section. Install already requires no_one_allowed: it fails under a weaker role, creates the Jira poll schedule only under that role (gitlab_jira_poll.go:280), and replaces a schedule that has variables. Tested on GitLab 19.5.6 and 18.11.14: under no_one_allowed adding a schedule variable is refused, but one added earlier still applies until install replaces the schedule. I did not add a guard in the poll script: a Developer token cannot read the role or another user's schedule variables. I did not add a repos status check in this PR.
| resolved := d.resolved | ||
| // A vendored install runs its own binary and workflows. Only the managed | ||
| // GitHub poll caller still calls upstream at that ref, and the workflow | ||
| // there must declare each list secret the caller passes. |
There was a problem hiding this comment.
MEDIUM: Vendored exemption still runs the upstream pinned-ref check for a user-owned poll caller
A vendored install returns early here only when it is not GitHub, polling is off, or no standard FULLSEND_JIRA_* name is forwarded. Otherwise it falls through to the upstream reusable-poll-jira.yml check at the pinned fullsend_ref, without checking whether the poll caller is managed. The stated reason ("Only the managed GitHub poll caller still calls upstream at that ref", and the reply on f7888a5) holds only for the managed caller.
checkUserJiraCallerAuthorizationEnv skips vendored installs on purpose ("A vendored install runs its own binary there, so it is not checked"). So for a vendored GitHub repo with a user-owned poll caller (for example one using secrets: inherit, or one calling a local vendored copy) and an older fullsend_ref, install and status still reject the config, even though the vendored binary supports the keys. The two checks give opposite answers for the same case.
Suggestion: Apply the vendored fall-through only when the existing poll caller is managed (scaffold.IsManagedJiraPollCaller). For a user-owned caller, return nil as checkUserJiraCallerAuthorizationEnv does. Add a test-table case: vendored, user-owned caller, old pin, standard name.
There was a problem hiding this comment.
Fixed as suggested: a vendored install with a user-owned poll caller is no longer checked against fullsend_ref. Added your table case, one for a vendored install whose managed caller is already committed (still rejected), and one for a caller that cannot be read.
…nment The jira authorization entry's write and triage lists can now name an environment variable with groups_from and accounts_from, so group and account IDs stay out of a public repository's config.yaml. Config and poller: - The poller reads the variable on every poll. The value is a list separated by commas or newlines. An unset or empty variable grants no one, and the poller logs a warning that names the variable. - Config loading rejects a role that sets both forms of one field, and an empty or invalid variable name. - The poller never logs the values. - The docs and the config test use a placeholder account ID. Managed GitHub poll workflow: - The managed caller forwards FULLSEND_JIRA_WRITE_GROUPS, FULLSEND_JIRA_WRITE_ACCOUNTS, FULLSEND_JIRA_TRIAGE_GROUPS and FULLSEND_JIRA_TRIAGE_ACCOUNTS to the poll step when config.yaml reads them. reusable-poll-jira.yml declares them as optional. - A new job with no secrets sets the dispatch matrix output. GitHub drops a job output that contains a value of a secret the job has, and the matrix holds the acting account's ID, which can equal a list secret. The poll job saves the dispatch file as an artifact, after checking it for Jira credentials, including ones that JSON escaped. Each call names its artifact with a random suffix, so two calls in one run do not share it. repos install: - It fails before any write when config.yaml uses groups_from or accounts_from and the repository's jobs run a release that predates them, on any forge. Every job runs the CLI at the scaffold's ref, and an older CLI cannot load the config. repos status reports the same error. Without an upstream GitHub client, a stamped scaffold's ref is not checked. A vendored install runs its own binary, so it is checked only when the managed GitHub poll caller passes a list secret: that caller calls the upstream workflow at the pinned ref. A user-owned GitHub poll caller that pins a reusable-poll-jira.yml older than the keys fails too, unless the install is vendored: that workflow installs the CLI at its own ref. - It warns about a variable name other than the four above, for the managed caller and for a user-owned caller of reusable-poll-jira.yml, because that workflow accepts only those four. It also warns about a user-owned caller that does not pass one of the four that the config names. It never writes or deletes these secrets. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Gwenneg Lepage <10584698+gwenneg@users.noreply.github.com>
22e1681 to
8639cdd
Compare
Summary
The
jiraauthorization lists in.fullsend/config.yamlcan now come from an environment variable, so account and group IDs stay out of a public repository:Related Issue
Closes #9132
Changes
Config and poller
write:andtriage:acceptgroups_fromandaccounts_from. The value is a list separated by commas or newlines.Managed GitHub poll workflow
FULLSEND_JIRA_WRITE_GROUPS,FULLSEND_JIRA_WRITE_ACCOUNTS,FULLSEND_JIRA_TRIAGE_GROUPSandFULLSEND_JIRA_TRIAGE_ACCOUNTSto the poll step. It passes only the ones the config names, so existing callers don't change.reusable-poll-jira.ymlnow sets the dispatch matrix from a second job that has no secrets.repos installDocs
FULLSEND_prefix, becauserepos statusreports an unmanagedFULLSEND_variable as an orphan.Why the matrix is set by a second job
GitHub drops a job output that contains the value of a secret the job has. The matrix contains the ID of the account that acted. So if
FULLSEND_JIRA_WRITE_ACCOUNTSholds one account ID, the matrix is dropped every time that person triggers an agent. The poller has already advanced its Jira checkpoints by then, so those dispatches are lost and the run still shows green.Fix: the poll job saves
dispatches.jsonas an artifact (kept 1 day) and outputs only a count and a random artifact suffix. A newmatrixjob, which has no secrets, reads the file and sets the output. The caller and the workflow'smatrixoutput are unchanged.Each call names its artifact with its own suffix, so two calls in one run don't share it.
Trade-offs
dispatches.jsoncontainsFULLSEND_JIRA_TOKEN,FULLSEND_JIRA_EMAIL,FULLSEND_JIRA_CLIENT_IDorFULLSEND_JIRA_CLIENT_SECRET. It trims the values first, as the CLI does. It searches the decoded strings of each record and itsevent_payload, so it also finds a credential that JSON escaped.Alternatives I ruled out
Install checks
Error: the release must support the new keys. Every job runs the CLI at the repository's
fullsend_ref, andfullsend_refdoesn't follow CLI upgrades. v0.54.0 rejectsgroups_fromas an unknown field, so without this check install would commit a config that no job can load.reusable-poll-jira.ymlat the pinned ref and looks forFULLSEND_JIRA_WRITE_GROUPS, which lands in the same commit as the CLI support.fullsend_refwhen install runs from a build with no release ref. Install then leaves the scaffold at its stamped ref, so the check reads that ref.reusable-poll-jira.ymlat the pinned ref, and GitHub rejects it when the workflow there doesn't declare the secret (run against v0.55.0).reusable-poll-jira.ymlthat a poll caller you maintain pins, and fails if one predates the keys: that workflow installs the CLI at its own ref. A vendored install is skipped, because the old workflow runs the vendored binary there.repos statusreports the same errors, for an installed repository and for one that is not installed yet.internal/config/managed-config-schema, 3 onmainsince feat(#8143)!: let agents entries carry a harness: block (ADR 0162) #9422), although older releases reject the new keys. This check refuses them for an older ref instead. A comment in that file says so.Warning: a list variable won't reach the poller. On GitHub, with polling enabled:
reusable-poll-jira.yml. That workflow accepts only those four, and GitHub rejects a caller that passes it another secret (run);reusable-poll-jira.ymlwithout passing one of the four that the config names.It's a warning, not an error, because a self-hosted runner can still set the variable. Without it the list grants no one, which fails closed.
Not in this PR
FULLSEND_JIRA_*variables as orphans, andrepos statusthen exits with an error. This already happens onmainfor the Jira credentials that install writes since repos install: manage Jira polling for GitLab #9108. It will also happen for list variables with aFULLSEND_name. One fix covers both.Testing
make lintpasses (stage changes first, then run)Details:
uses:lines reuse pins the repo already has, andpinactpasses.TestJiraPollCallerPollAlignmentchecks that the job holding the secrets outputs only a count and a random suffix, and that thematrixjob references no secrets.TestJiraPollWorkflowCheckDispatchesruns the check step once per Jira secret, including a token that contains"and<.TestJiraPollWorkflowSecretThreadingchecks that the step receives all four and no list secret.reusable-poll-jira.ymlate49176a8e(an earlier head of this PR) throughworkflow_call, with the real CLI and a mock Jira:matrixjob is skipped, the caller gets{"include":[]}, anddispatchis skipped.secrets:mapping, and all 4 dispatches reach thedispatchjob.fromjson, since fix(jirapoll)!: unmarshal EventPayload as structured JSON in DispatchRecord #7518 madeevent_payloadan object, and two more secrets checked), and tests. The changed check step is covered byTestJiraPollWorkflowCheckDispatches, not by a runner.uses:points to the commit on the fork, the trigger is a push,dispatchcalls a stub that prints the matrix, ashowjob is added, and the CLI is a vendored build of the same commit behind a wrapper that starts the mock.join_tr__*). No ID is printed.matrixjob were copied unchanged.accounts_fromandgroups_fromfrom secrets. The listed account and the listed group's member were dispatched, and a stranger was not.matrixjob downloaded the artifact withpermissions: {}.Skip output 'matrix' since it may contain secret);Checklist
!for breaking changes)🤖 Generated with Claude Code