Skip to content

feat: add export-token mode that exchanges the token natively in the action - #4

Merged
rio828 merged 2 commits into
mainfrom
feat/export-token
Jul 30, 2026
Merged

rio828 merged 2 commits into
mainfrom
feat/export-token

Conversation

@rio828

@rio828 rio828 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Context

The cicd-sensor keyless-onboarding design (shisho-security monorepo, backend/services/teibo/cmd/runner/docs/architecture/cicd-sensor-integration/) specifies this action as the auth shim for customer CI jobs that need a short-lived Shisho Cloud access token but do not have shishoctl installed: export-token: true performs the STS bot-token exchange natively in the action and exposes the token as a masked step output. Today the action only signs in via a pre-installed shishoctl, which is unnecessary friction for consumers that just need the raw token (the cicd-sensor agent, curl, other tools).

Design decisions:

  • With export-token: true the action performs the exchange itself — POST /bots/exchange with {bot_id, id_token, expires_in} — via @actions/http-client (proxy-aware, honors HTTPS_PROXY on enterprise self-hosted runners; already a transitive dependency). shishoctl is neither required nor configured in this mode.
  • Outputs: token (the bare access token, masked via core.setSecret before being set) and expires-at (RFC 3339 UTC). The token is bare by design — consumers that need a product-specific prefix (e.g. sk_cs_ for the cicd-sensor manager) prepend it themselves.
  • Without the input, behavior is byte-identical to today: the shishoctl sign-in block is untouched; the new path is an early-return branch above it.
  • Runtime bump node16 → node20: node16 is EOL and GitHub runners already force node16 actions onto node20, so this changes nothing in practice and stays v1-compatible.
  • CI refresh: node 20, checkout/setup-node v4, upload-artifact@v4 (v3 has been disabled by GitHub since Jan 2025), plus a new clean-machine job that runs export-token mode without shishoctl installed.

Expected outcome

A workflow with permissions: id-token: write can run:

- id: auth
  uses: flatt-security/shisho-cloud-action@v1
  with:
    bot-id: <bot ID>
    export-token: true
    expires-in-minutes: 360

and use ${{ steps.auth.outputs.token }} in later steps, with the token masked in run logs, on a runner that has never installed shishoctl. Existing workflows without export-token behave exactly as before.

Summary

  • src/sts.ts (new): the STS exchange — request/response wire shapes, 400 {message} surfacing, non-200 and malformed-response handling
  • src/main.ts: export-token branch (validate expires-in-minutes, exchange, mask, set outputs); shishoctl path unchanged
  • action.yml: new input + declared outputs, node20 runtime
  • 8 unit tests against a real local stub HTTP server; CI workflows refreshed + clean-machine export-token job; README usage for both modes

Test plan

  • npm run all green (tsc, prettier, eslint, ncc package with dist/ rebuilt and committed, jest — 8 new tests)
  • End-to-end smoke of the compiled dist/index.js exactly as the runner invokes it (stub OIDC endpoint + stub STS, INPUT_* env, GITHUB_OUTPUT file): verified the exchange body {bot_id, id_token, expires_in: 21600}, the ::add-mask::, and both outputs
  • Default-path smoke: without export-token, the action still reaches the unchanged shishoctl invocation (ENOENT message with install instructions when shishoctl is absent)
  • CI on this PR: build-test (incl. the new no-shishoctl job) and check-dist pass
  • After merge + release: staging E2E via shisho-security/shisho-cloud-action-test-runner test-sts.yml

Release note

After merge: tag v1.1.0 and move the v1 tag — the documented onboarding pins @v1.

🤖 Generated with Claude Code

rio828 and others added 2 commits July 29, 2026 23:55
…action

With `export-token: true`, the action performs the STS bot token exchange
itself (via the proxy-aware @actions/http-client) and exposes the access
token as the masked `token` step output plus an `expires-at` output, so
jobs without shishoctl installed can authenticate to Shisho Cloud. Without
the input, the shishoctl sign-in behavior is unchanged.

Also bumps the runtime node16 -> node20 (node16 is EOL and runners already
force node20, so this changes nothing in practice) and refreshes the CI
workflows (node 20, checkout/setup-node v4, upload-artifact v4 — v3 has
been disabled by GitHub), adding a clean-machine job that runs
export-token mode without shishoctl present.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…docs site

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rio828
rio828 merged commit 9b68d33 into main Jul 30, 2026
4 checks passed
@rio828
rio828 deleted the feat/export-token branch July 30, 2026 05:47
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