Repository navigation
Dispatch PR previews to paired Web Simulator - #440
schnuartz-ai wants to merge 9 commits into
Conversation
✅ Deploy Preview for specter-diy-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
To Do: |
al-munazzim
left a comment
There was a problem hiding this comment.
Thanks for splitting the preview build out of this repository and keeping the pull_request_target side small. The trust boundary is generally much better than building PR-controlled code directly here, and the paired simulator PR does a lot of validation/provenance checking.
I would still keep this draft until a couple of pull_request_target concerns are addressed:
-
editedcan trigger expensive privileged preview runs. The workflow listens toedited, maps every non-closedevent toACTION=build, dispatches the paired simulator viaWEB_SIMULATOR_DISPATCH_TOKEN, then polls for up to 330 minutes inside a 360-minute job. A fork PR author can edit metadata such as title/body without changing code and repeatedly cause a privileged dispatcher run plus a paired simulator build. Ifeditedis only meant to catch base-branch retargeting, please restrict it to that case in the dispatcher before dispatching, or removeeditedand use a maintainer/manual revalidation path. -
The
pull_request_targettoken has an unused write scope. The workflow grantspull-requests: write, but the dispatcher only reads PR metadata and writes/patches/deletes issue comments. The write path uses issue-comment endpoints, which are covered byissues: write; I do not see a PR write endpoint being used. Please droppull-requests: write(or reduce it to read only if GitHub requires it for the PR GET) to keep this new privileged workflow minimal.
Separately, this PR should probably stay blocked on the paired specter-diy-web-simulator workflow being merged/configured and one live end-to-end dispatch proving: dispatch → remote build → Pages status JSON → PR comment update. The current unit/actionlint coverage is good, but the PR body says the hosted path has not been exercised yet.
|
One architectural concern I should make explicit: this currently makes the Specter-side A cleaner pattern would be async: the Specter workflow dispatches the remote build and posts a short |
@al-munazzim Which architecture would you prefer here?
My main concern with 2 and 3 is introducing a credential in the Web Simulator that can write back to specter-diy. Because of that, I currently lean towards 1, despite the less clean polling architecture. Do you think the async architecture is worth introducing that additional trust boundary? |
|
CI update for Forked browser E2E: I ran the simulator workflow in my forks using helper PR #4 in This verifies the build and preview path in the forks. It does not verify the automatic dispatcher credentials or result-comment update on upstream PR #440. |
Promote the final browser-preview dispatcher workflow from PR cryptoadvance#440 to the test fork default branch so a separate test PR can exercise the updated pull_request_target workflow.
Fork E2E test resultsThe automatic browser preview flow passed end to end in the
These checks were run in the Least-privilege permission proofI removed The dispatcher successfully updated the existing PR comment, and the paired simulator completed the build and preview verification: PR #440 currently has the same reduced permissions at head |
|
Thanks for the fork E2E follow-up. My preference remains:
The latest changes address the two concrete blockers I raised:
I do not see a reason to introduce option 2/3 write-back credentials for this PR unless the long polling becomes a practical problem after deployment. |
Paired preview E2E resultThe simulator E2E run passed for Specter The fork did not have the GitHub App credentials required for the workflow-managed PR-comment reporter, so that reporter step was skipped and is not covered by this run. |
0c7e08d to
9d7e60d
Compare
Introduce the PR event dispatcher, workflow, and paired-fork documentation. Preserves the initial architecture from 519a367, before subsequent security hardening.
Dispatch short-lived validated requests and let the paired Web Simulator own building, browser previews, firmware artifacts, Pages publication and PR status comments. Closing a PR dispatches remote cleanup only. Preserves the focused architecture of original 2c2d8a6.
Clarify that the existing Specter DIY firmware build is untouched and that all preview-specific firmware artifacts, cleanup, and Pages retention live only in the Web Simulator. Excludes original firmware-build naming/cleanup commits 5fef3bb and 0c7e08d while incorporating the final preview retention clarification from 47e6588.
9d7e60d to
eb15cbc
Compare
…p write permission
|
Update: Fork implementation and E2E tests completed successfully. We replaced the GitHub App with a dedicated machine user ( The simulator footer also shows the firmware version and exact linked source commit ( Successful tests:
What needs to be done by a organisation admin now like @k9ert:
The upstream production E2E remains pending. The fork tests passed, and neither PR has been merged. |
Summary
Move browser-preview execution and hosting into the paired [Specter DIY Web Simulator PR #8](cryptoadvance/specter-diy-web-simulator#8).
This PR introduces a small, trusted GitHub Actions dispatcher in Specter DIY. It validates the live pull request, dispatches its exact metadata to the Web Simulator, and exits immediately.
There is no polling, long-running privileged workflow, or PR-comment write access on the Specter DIY side.
Architecture
pull_request_targetworkflow.workflow_dispatchand a unique request ID.The Web Simulator maintains a single persistent PR comment. Existing comments are updated in place instead of deleted and recreated.
The comment includes build status, collapsible provenance, simulator URL, matching firmware artifact, build logs and the experimental-build warning.
Closing a PR dispatches a cleanup request for previews, firmware artifacts and the machine user's own marked comment.
Security
contents: readandpull-requests: read.WEB_SIMULATOR_DISPATCH_TOKENrequires only Actions: Read and write access to the paired Web Simulator repository.The dedicated account
specter-preview-botmust have no repository write permissions.GitHub enforces comment ownership for this account. It may update/delete its own comments but cannot modify third-party comments or PR metadata without additional repository permissions.
The classic PAT uses
public_repo, which is not a comment-only permission scope. The account must therefore remain dedicated to this service and without elevated repository roles.Configuration
Before production activation:
WEB_SIMULATOR_DISPATCH_TOKENincryptoadvance/specter-diy, scoped exclusively to the paired Web Simulator repository with Actions read/write permission.pull_request_targetpolicy.mainbranch.SPECTER_PREVIEW_BOT_TOKENand variableSPECTER_PREVIEW_BOT_LOGIN.The default paired repository is
<owner>/specter-diy-web-simulator. The optionalWEB_SIMULATOR_REPOSITORYvariable can override the repository name while preserving the paired-owner restriction.Validation
Passed:
Relevant runs:
Still pending: Production bot-token configuration and a controlled end-to-end test against the upstream repositories.
Merge dependency
Merge and configure Web Simulator PR #8 first. Verify the production machine-user reporter and then merge this dispatcher PR.
See [the browser preview documentation](docs/browser-simulator.md) for additional details.