feat(ci): point extension PR preview at author's freighter-config sandbox - #2917
Open
piyalbasu wants to merge 3 commits into
Open
feat(ci): point extension PR preview at author's freighter-config sandbox#2917piyalbasu wants to merge 3 commits into
piyalbasu wants to merge 3 commits into
Conversation
…dbox Fetch the PR author's per-engineer sandbox URLs from the private stellar/freighter-config repo (via a read-only deploy key) and bake them into the extension preview build as INDEXER_URL / INDEXER_V2_URL, replacing the hardcoded staging secrets. Mirrors the mobile integration (freighter-mobile#947). - "Fetch freighter-config" step runs right after checkout, before any PR-controlled code, and tears the deploy key down in-step. - "Resolve backend URLs" maps github login -> sandbox v1/v2 and writes INDEXER_URL/INDEXER_V2_URL to $GITHUB_ENV; the two keys are removed from job env to avoid $GITHUB_ENV precedence ambiguity, and empty-URL validation folds in (replacing the standalone "Validate required secrets" step). - Fallbacks: no config entry -> staging; freighter-config unreachable -> staging + `preview-degraded` label. Release notes + sticky comment state the resolved backend. Adds issues:write for create-if-missing of the label. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-15f6a3a2dff6b001284f |
Contributor
There was a problem hiding this comment.
Pull request overview
Routes extension PR previews to each author’s sandbox backend, with fallback status surfaced in GitHub.
Changes:
- Fetches sandbox mappings from
freighter-config. - Resolves and injects backend URLs with staging fallback.
- Updates labels, release notes, and sticky comments with backend status.
Comments suppressed due to low confidence (3)
.github/workflows/prPreview.yml:150
- A successful clone marks any existing file as available, but these
jqassignments run underset -e: invalid JSON exits the job instead of taking the promised staging fallback, while non-string/multiline values can later corrupt$GITHUB_ENV. Validate the config's JSON/schema and single-line URL fields before settingconfig_available=true; treat validation failure as unavailable.
if [ "${CONFIG_AVAILABLE}" = "true" ]; then
V1_URL=$(jq -r --arg u "$PR_AUTHOR" '.engineers[$u].v1 // empty' "$CONFIG_OUT")
V2_URL=$(jq -r --arg u "$PR_AUTHOR" '.engineers[$u].v2 // empty' "$CONFIG_OUT")
.github/workflows/prPreview.yml:146
- The cached file contains the entire map from a private repository and survives this step, so the later PR-controlled
yarn/build scripts can read and exfiltrate it even though the deploy key was deleted. Remove the cached config on exit from this resolve step, before any PR code executes.
CONFIG_OUT="${RUNNER_TEMP}/freighter-config.json"
V1_URL=""; V2_URL=""; TARGET=""; DESC=""; DEGRADED="false"
.github/workflows/prPreview.yml:158
- These descriptions call the fallback “staging,” but the fallback values are unchanged:
secrets.INDEXER_URLwas documented immediately above this diff as V1 production because V1 staging has no public DNS, while V2 uses beta. The release and sticky comment will therefore mislabel the actual backend. Either provide a public V1 staging URL or describe the mixed V1-production/V2-beta fallback accurately.
TARGET="staging"; DESC="staging — no sandbox configured for @${PR_AUTHOR}"
fi
else
TARGET="staging-degraded"; DEGRADED="true"
DESC="staging — freighter-config unreachable (preview degraded)"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review: replace StrictHostKeyChecking=accept-new (TOFU, no MITM protection on an ephemeral runner) with GitHub's published host keys fetched over TLS-authenticated HTTPS (api.github.com/meta) written to a temp known_hosts + StrictHostKeyChecking=yes. If host keys can't be obtained, degrade to staging rather than trust an unverified host. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
piyalbasu
added a commit
to stellar/freighter-mobile
that referenced
this pull request
Jul 27, 2026
…tch) - Revert the temporary --branch feat/seed-config-schema-and-piyalbasu pin; the fetch now clones freighter-config's default branch (production behavior). - Replace StrictHostKeyChecking=accept-new (TOFU, no MITM protection on an ephemeral runner) with GitHub's published host keys fetched over TLS-authenticated HTTPS (api.github.com/meta) + StrictHostKeyChecking=yes; degrade to staging if keys can't be obtained. Parity with stellar/freighter#2917. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Parity with the mobile review fixes: - Validate freighter-config/config.json parses (jq empty) before marking it available, and make the resolve-step jq tolerant, so a malformed config degrades to staging instead of aborting the build under set -e. - Correct the fallback backend labels: V1 production + V2 beta, not "staging" wholesale (matches the routing actually baked in). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Makes the browser-extension PR-preview build point at the PR author's own per-engineer sandbox backend instead of shared staging, by looking the author up in
freighter-configat build time. If the author has no sandbox entry (or the map can't be read), it falls back to public staging and says so — the preview is never broken, just clearly labeled. The extension counterpart to freighter-mobile#947.Part of the Fullstack PR Preview Flow, Phase 2 (extension).
Implementation details (for agents)
What changed — all in
.github/workflows/prPreview.yml:Fetch freighter-configstep, immediately after checkout and before any PR-controlled code (yarn, build). Clones the privatestellar/freighter-configover SSH using a read-only, extension-scoped deploy key (secrets.FREIGHTER_CONFIG_DEPLOY_KEY), writesconfig.jsonto$RUNNER_TEMP, and tears the key down in-step (mode-600 tempfile +trap … EXIT). Never fails the build.Resolve backend URLsstep mapspull_request.user.login→ sandboxv1/v2and writesINDEXER_URL/INDEXER_V2_URLto$GITHUB_ENV. Those two keys were removed from job-levelenv:to avoid a job-env:-vs-$GITHUB_ENVprecedence ambiguity; the webpack build (yarn build:extension:production) reads them from the process env. Empty-URL validation folds into this step, replacing the old standalone "Validate required secrets" step.preview-degradedlabel (gh label create … || truecreate-if-missing, then add/remove so a fixed re-run self-corrects). Addedissues: writesolely for creating the label definition.BACKEND_DESC(sandbox (login)/staging — no sandbox configured/staging — freighter-config unreachable).Resolve logic: https://github.com/stellar/freighter/blob/d498c9a8838cd3fdf5ddce5e18768d5a215577a8/.github/workflows/prPreview.yml
Security: unchanged posture —
pull_request-only + fork-guard, deploy key read-only + scoped tofreighter-config+ torn down before PR code runs. Only new outbound is the SSH clone of one private repo.Depends on (land first):
freighter-config.(The
FREIGHTER_CONFIG_DEPLOY_KEYsecret is already set on this repo;freighter-configschema + entries already exist.)Verification: YAML validated pre/post husky/prettier; the two INDEXER vars now appear only in the resolve step (fallback + $GITHUB_ENV writes), not job env. Full e2e (author
piyalbasu→ sandbox URLs baked) requires #6556 to land first.Note: URL shape parity — config
v1/v2carry the/api/v1suffix (shared with mobile). If the extension'sINDEXER_*secrets use a different shape, adjust; the e2e preview will surface any mismatch.