Skip to content

fix: add variables:read permission for per-repo guard check - #995

Merged
waynesun09 merged 2 commits into
mainfrom
debug-per-repo-guard
May 15, 2026
Merged

waynesun09 merged 2 commits into
mainfrom
debug-per-repo-guard

Conversation

@waynesun09

Copy link
Copy Markdown
Member

Summary

Changes

  1. internal/forge/github/types.go — Add Variables field to AppPermissions struct; add Variables: "read" to fullsend App manifest
  2. internal/mint/main.go — Add "variables": "read" to fullsend role in rolePermissions
  3. internal/layers/enrollment.go — Fix error message: actions:read → variables:read
  4. internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh — Include API error message in warning output for easier debugging

Deployment note

After merging, existing fullsend-fullsend GitHub Apps need the new variables: read permission approved. fullsend admin install --analyze will flag this automatically. After updating App permissions in GitHub settings and re-approving, re-deploy the mint Cloud Function so the new rolePermissions take effect.

Test plan

  • go test ./internal/layers/... — pass
  • go test ./internal/forge/github/... — pass
  • go test ./internal/mint/... — pass (separate module)
  • Manual: re-run reconcile workflow after deploying mint + updating App permissions

The FULLSEND_PER_REPO_INSTALL guard (PR #967) fails in reconcile
workflows because the fullsend role token lacks the variables:read
fine-grained permission. The GET /repos/{owner}/{repo}/actions/variables
endpoint returns 403, causing all repos to be skipped.

- Add Variables field to AppPermissions struct and fullsend App manifest
- Add variables:read to fullsend role in mint rolePermissions
- Fix misleading "actions:read" error message in enrollment analyzer
- Include API error message in reconcile-repos.sh warning output

Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions

Copy link
Copy Markdown

fullsend review is working on this — view logs

@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://c76eb73d-site.fullsend-ai.workers.dev

Commit: b139d9df2a1056224b482dc9ca17000ea7514bfe

@fullsend-ai-review

fullsend-ai-review Bot commented May 15, 2026 •

Copy link
Copy Markdown

Review: #995

Head SHA: b139d9d
Timestamp: 2026-05-15T00:00:00Z
Outcome: approve

Summary

Clean, well-scoped bug fix that adds the missing variables:read permission required by the per-repo guard check (GET /repos/{owner}/{repo}/actions/variables/{name}). The permission is added consistently across all three surfaces — App manifest struct (types.go), mint role token downscoping (main.go), and error messages (admin.go, enrollment.go). The shell script improvement in reconcile-repos.sh correctly extracts and sanitizes the API error message for better debugging output. Test coverage is added for the manifest change.

Findings

Critical

(none)

High

(none)

Medium

(none)

Low

  • [correctness] internal/mint/main.go:749 — The rolePermissions map has no unit test coverage, so the new "variables": "read" entry for the fullsend role is not verified by automated tests. This is a pre-existing gap (other entries are also untested), but worth noting since the App manifest equivalent does have test coverage via types_test.go.
    Remediation: Consider adding a test that asserts expected permissions per role in the mint package.

Info

  • [style] internal/scaffold/fullsend-repo/scripts/reconcile-repos.sh:94 — The api_msg extraction uses tr -d '\n\r' for sanitization, which is sufficient for log injection prevention in GitHub Actions ::warning:: annotations. Good defensive practice.

Footer

Outcome: approve
This review applies to SHA b139d9df2a1056224b482dc9ca17000ea7514bfe. Any push to the PR head clears this review and requires a new evaluation.

Previous run

Review: #995

Head SHA: 21832c8
Timestamp: 2026-05-15T00:00:00Z
Outcome: comment-only

Summary

Clean, well-scoped fix that adds variables:read permission in all three required locations — the AppPermissions struct and fullsend App manifest (types.go), and the mint's token-downscoping map (main.go). The error message correction and improved debug output in the reconcile script are appropriate. One test coverage gap worth noting: the existing TestAgentAppConfig_Fullsend asserts every other permission field on the fullsend role but does not assert the new Variables field.

Findings

Medium

  • [correctness] internal/forge/github/types_test.go:17 — TestAgentAppConfig_Fullsend asserts every permission field for the fullsend role (Contents, Workflows, Issues, PullRequests, Checks, Administration, Members, OrganizationProjects) but does not assert cfg.Permissions.Variables == "read". If the Variables field is later removed or changed, no test will catch the regression.
    Remediation: Add assert.Equal(t, "read", cfg.Permissions.Variables) to TestAgentAppConfig_Fullsend.

Footer

Outcome: comment-only
This review applies to SHA 21832c8456d1dffa096029b688172030e6c661fd. Any push to the PR head clears this review and requires a new evaluation.

Fix stale 'actions:read' error message in admin.go to correctly say
'variables:read', matching the fix in enrollment.go. Add missing test
assertion for Variables permission in TestAgentAppConfig_Fullsend.

Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions

Copy link
Copy Markdown

fullsend review is working on this — view logs

This branch was successfully deployed

1 active deployment
site-preview — b139d9df Deployed May 15, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants