Skip to content

fix(actions): support fork checkouts and PAT pushes in assign-rfc-number - #23

Merged
jtmcdole merged 2 commits into
flutter:mainfrom
jtmcdole:security
Sep 17, 2026
Merged

jtmcdole merged 2 commits into
flutter:mainfrom
jtmcdole:security

Conversation

@jtmcdole

Copy link
Copy Markdown
Member
  • Set allow-unsafe-pr-checkout: true on the isolated target/ sparse checkout step to opt into actions/checkout v7's fork safety check.
  • Authenticate git operations via gh auth setup-git using FLUTTERACTIONSBOT_RFC_TOKEN (with fallback to GITHUB_TOKEN) so commits can be pushed to fork PR branches where maintainer edits are enabled.
  • Update PR labels (rfc-assigned) atomically before pushing changes so rfc-lint passes on the triggered synchronize event.
  • Add top-level permissions: {} to enforce least-privilege defaults.
  • Improve failure fallback comments with direct workflow run log links and local dart run bin/assign_rfc_number.dart instructions when pushing to a fork fails.

Pre-launch Checklist

  • I read [RFC 000.0001: Taxonomy] and followed the file and path naming and metadata standards.
  • I read [RFC 000.0002: Process] and confirmed this proposal meets the threshold for a full RFC.
  • I read and agree to the [Code of Conduct].
  • I signed the [CLA].
  • I have linked an issue from flutter/flutter with the label design doc.
  • All existing and new tests are passing.
  • I have enabled "Allow edits from maintainers" on this PR so the bot can automatically assign an RFC number (or I will run dart run bin/assign_rfc_number.dart locally when instructed).

- Set `allow-unsafe-pr-checkout: true` on the **isolated** `target/` sparse checkout step to opt into `actions/checkout` v7's fork safety check.
- Authenticate git operations via `gh auth setup-git` using `FLUTTERACTIONSBOT_RFC_TOKEN` (with fallback to `GITHUB_TOKEN`) so commits can be pushed to fork PR branches where maintainer edits are enabled.
- Update PR labels (`rfc-assigned`) atomically before pushing changes so `rfc-lint` passes on the triggered `synchronize` event.
- Add top-level `permissions: {}` to enforce least-privilege defaults.
- Improve failure fallback comments with direct workflow run log links and local `dart run bin/assign_rfc_number.dart` instructions when pushing to a fork fails.
@jtmcdole
jtmcdole marked this pull request as ready for review September 16, 2026 17:02
@jtmcdole

Copy link
Copy Markdown
Member Author

To follow up on this: https://github.com/flutter/rfc/actions/runs/35031510826/job/104590851145?pr=21

  1. The workflow runs from flutter/rfc's main branch
  2. The tools are checked out correctly (Checkout Trusted Tooling (main))
  3. Dart is setup correctly
  4. Its only when we checkout the RFC folder that this tripped up.

Some more changes I think I'll make:

  1. Ensure the tool's workfing folder is tool - we should pass in the target folder... basically ensuring we always run this tool from the secure folder.
  2. running the assigner right after checking out.

1. only execute tools from tools folder (working folder considered safe)
2. update assigner to take target directory
3. reduce global permissions in each file
4. read files in as bash array and use possix `-- <rest>`
5. percent encode messages to github

@eyebrowsoffire eyebrowsoffire left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jtmcdole
jtmcdole added this pull request to the merge queue Sep 17, 2026
Merged via the queue into flutter:main with commit aec157c Sep 17, 2026
10 checks passed
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