Skip to content

feat: add TypeScript SDK and secure npm publishing - #38

Open
fuller wants to merge 8 commits into
mainfrom
sdk/migrate-typescript-sdk
Open

feat: add TypeScript SDK and secure npm publishing#38
fuller wants to merge 8 commits into
mainfrom
sdk/migrate-typescript-sdk

Conversation

@fuller

@fuller fuller commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the @gemini-markets/sdk TypeScript SDK under packages/sdk-typescript.
  • Generate REST and WebSocket types from the published Gemini API specifications with allowlisted, hash-verified sources.
  • Provide browser and server entry points with explicit environment selection, HMAC authentication, OAuth PKCE, REST, and WebSocket support.
  • Add package verification, runtime checks, API-surface checks, and security documentation.
  • Add a signed, provenance-enabled npm publishing workflow with artifact identity checks and least-privilege permissions.

Security and release controls

  • Release tags must match typescript-sdk-v<package-version> and point to a commit on main.
  • Build and validation installs use npm ci --ignore-scripts; only required native tools are rebuilt explicitly.
  • Publish uses an isolated verified artifact and npm publish --provenance.
  • The publish job fails closed unless the protected npm environment has SDK_RELEASE_TAG_RULESET_READY=enabled.
  • .github/CODEOWNERS assigns SDK and release-control review to @fuller and @ximt.

Required administrator setup before merge/release

  1. Create an active tag ruleset for typescript-sdk-v* restricting creation, updates, and deletion to fuller and ximt.
  2. Create the protected GitHub npm environment with required reviewers.
  3. Configure the SDK_RELEASE_TAG_RULESET_READY=enabled environment variable only after the tag ruleset is active.
  4. Configure npm Trusted Publishing for gemini/developer-platform, workflow publish-typescript-sdk.yml, environment npm, and npm publish.
  5. Confirm ownership and security settings for the gemini-markets npm scope.

Validation

  • npm ci --ignore-scripts — passed with 0 vulnerabilities.
  • npm rebuild esbuild workerd --foreground-scripts — passed.
  • npm test — 615 passed, 0 failed.
  • npm run typecheck — passed.
  • npm audit --audit-level=high — 0 vulnerabilities.
  • Workflow YAML parsing and git diff --check — passed.
  • Signed commits verified.

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Recently published: npm @cloudflare/workerd-darwin-64 published 24 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alphanpm/@cloudflare/workerd-darwin-64@1.20260825.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@cloudflare/workerd-darwin-64@1.20260825.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm @cloudflare/workerd-darwin-arm64 published 24 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alphanpm/@cloudflare/workerd-darwin-arm64@1.20260825.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@cloudflare/workerd-darwin-arm64@1.20260825.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm @cloudflare/workerd-linux-64 published 23 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alphanpm/@cloudflare/workerd-linux-64@1.20260825.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@cloudflare/workerd-linux-64@1.20260825.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm @cloudflare/workerd-linux-arm64 published 24 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alphanpm/@cloudflare/workerd-linux-arm64@1.20260825.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@cloudflare/workerd-linux-arm64@1.20260825.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm @cloudflare/workerd-windows-64 published 24 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alphanpm/@cloudflare/workerd-windows-64@1.20260825.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@cloudflare/workerd-windows-64@1.20260825.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm miniflare published 5 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alpha

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/miniflare@5.20260825.0-alpha. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm workerd published 24 hours ago

Location: Package overview

From: packages/sdk-typescript/package-lock.jsonnpm/miniflare@5.20260825.0-alphanpm/workerd@1.20260825.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/workerd@1.20260825.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@nostradamus-bot

Copy link
Copy Markdown

Nostradamus Risk Rating — Critical

The PR introduces core cryptographic authentication primitives for the Gemini financial exchange API — specifically HMAC-SHA384 request signing with monotonic nonce management (packages/sdk-typescript/src/auth/hmac.ts) and a full OAuth 2.0 PKCE flow with token lifecycle management (src/auth/oauth.ts) — across a new SDK package that exposes privileged financial operations (trading, withdrawals, margin, staking). New crypto primitive implementations of this sensitivity, combined with a net-new npm supply chain publish pipeline, warrant a full STRIDE review before merge.

High/Critical — a full threat model follows.

@nostradamus-bot

nostradamus-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

Nostradamus Threat Model - Passed - APPSEC-1505

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