Skip to content

ci: harden nightly integration workflow — drop artifact upload#3

Open
vrogojin wants to merge 1 commit into
mainfrom
fix/nightly-artifact-hygiene
Open

ci: harden nightly integration workflow — drop artifact upload#3
vrogojin wants to merge 1 commit into
mainfrom
fix/nightly-artifact-hygiene

Conversation

@vrogojin
Copy link
Copy Markdown
Contributor

Summary

Post-merge steelman finding: nightly workflow's on-failure artifact upload harvests secp256k1 testnet wallet material into 7-day GitHub storage. The integration helpers already shred those dirs on exit for the same hygiene reason — uploading them defeats that.

Changes

  • Drop artifact upload entirely — vitest stderr in the job log is enough for nightly triage; re-run locally via `npm run test:integration` for deeper investigation
  • `permissions: contents: read` — least-privilege default
  • `concurrency: group: integration-nightly` — prevent cron + workflow_dispatch from double-hammering public testnet infra
  • sphere-sdk SHA pin — aligned with `ci.yml` (was branch-pinned; branch pointers can be force-pushed)

Test plan

  • YAML valid (workflow file parses, GitHub Actions shows no errors)
  • No impact on main CI (`ci.yml` unchanged)
  • Nightly run fires at 03:07 UTC with the hardened config
  • Manual `workflow_dispatch` produces a clean run

Steelman warning from post-merge review: the on-failure upload-artifact
step harvested /tmp/sphere-cli-it-*/ into 7-day GitHub Actions storage.
Those dirs hold secp256k1 testnet wallet material (mnemonic + private
key) that the integration helpers explicitly shred on exit for hygiene
reasons — uploading the same material as an artifact defeats that.

Even though the keys are throwaway and hold no funds, harvesting them
fails principle-of-least-privilege and could leak into CI logs, Slack
paste-backs, or tickets.

Also while here:
  * permissions: contents: read — least-privilege default
  * concurrency: group:integration-nightly — prevent cron+dispatch
    double-hammering public testnet infra
  * sphere-sdk SHA pin — aligned with ci.yml (was branch-pinned)
vrogojin pushed a commit that referenced this pull request May 15, 2026
Add cli-multiaddress.integration.test.ts pinning the four multi-address
commands (addresses / switch / hide / unhide) plus, critically, the
TOKEN ISOLATION INVARIANT across HD-derived addresses.

The CLI extraction left two distinct things uncovered:

  A) CLI plumbing for the multi-address commands (namespace bridge,
     arg parsing, help text).

  B) The security-critical guarantee that tokens belonging to address
     #N never leak to address #M after a switch. A regression here
     would mean a user who switched to a fresh address could
     accidentally spend tokens that belong to a different HD branch.

The architectural mechanism is per-address token storage: Node.js
FileTokenStorageProvider keeps a separate `tokens/<addressId>/`
subdirectory per tracked address. `sphere.payments.getTokens()` reads
from the storage bound to the currently-active address — so as long
as the directory split is honoured, isolation holds.

Four layers of pins:

1. Help-shape pins (offline, 4 tests) — `payments help <cmd>` for
   each of addresses/switch/hide/unhide. HELP_TEXT keys ~707-735.

2. Arg-validation pins (offline, 4 tests) — switch/hide/unhide with
   no <index>, plus `switch abc` (non-numeric guard at ~line 2545).
   All exit non-zero with "Usage: ..." or "Invalid index" before
   getSphere().

3. Stateful local lifecycle (network-light, 7 tests) — fresh wallet
   shows only #0 → switch 1 creates+activates #1 with a DIFFERENT
   directAddress (HD-derivation isolation pin #1) → on-disk
   tokens/ has exactly 2 distinct DIRECT_<...> subdirs (storage
   isolation pin #2) → hide/unhide round-trip → switch back to #0
   restores the original directAddress exactly (state-preservation
   pin #3, no cross-pollination of identity material).

4. Token isolation invariant (opt-in, E2E_RUN_FAUCET=1, 3 tests) —
   the gold-standard funded leak proof:
     a. faucet 1 UCT at #0; beforeAll polls until UCT lands locally
     b. payments tokens at #0 → UCT visible
     c. switch to #1 → payments tokens shows "No tokens found"
        (THE LEAK TEST — would flip red on cross-address visibility)
     d. switch back to #0 → UCT still there, untouched
   Gated because on-chain nametag mint (~20s) plus faucet (~5s)
   plus the polling loop add ~60-90s on top of the default suite.

Verified with E2E_RUN_FAUCET=1: all 18 tests green in ~111s. The
funded leak proof confirms the isolation invariant holds in practice,
not just in the directory-layout pin.

Implementation note: faucet delivery is async — the faucet API
returns success when the gift-wrap is queued on the relay, not when
the wallet has finalized it into local storage. beforeAll polls
`payments tokens` (with sync) up to 3 times until UCT appears at #0,
then tests use --no-sync for fast per-address reads.
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.

1 participant