Skip to content

fix: zip-slip hardening in updater + security dependency bumps - #2106

Merged
ThomasRooney merged 3 commits into
mainfrom
fix/aikido-security
Aug 4, 2026
Merged

fix: zip-slip hardening in updater + security dependency bumps#2106
ThomasRooney merged 3 commits into
mainfrom
fix/aikido-security

Conversation

@ThomasRooney

@ThomasRooney ThomasRooney commented Aug 3, 2026

Copy link
Copy Markdown
Member

Fixes SEC-39

Summary

Fixes the remaining Aikido Critical/High findings in this repo:

  • Zip-slip (internal/updates/updates.go, 3 findings): archive entries are now validated to stay inside the extraction directory in both extractZip and extractTarGZ via a shared securePath helper. Tar file entries also get parent directories created before write.
  • Predictable temp file (internal/ci/git/releases.go): goreleaser config now written via os.CreateTemp instead of fixed /tmp/.goreleaser.yml.
  • Go deps: x/crypto → v0.52.0, x/net → v0.55.0, grpc → v1.79.3 (AIKIDO-2026-11022 family, -11039, CVE-2026-33186).
  • JS deps (internal/defaultcodesamples): npm overrides constrain jsonpath-plus to ^10.3.0 (resolves to 10.4.0 in the lockfile; CVE-2024-21534 fixed in 10.2.0, CVE-2025-1302 in 10.3.0) and lodash ^4.18.1 (CVE-2026-4800).

Verification

  • go build ./... clean
  • defaultcodesamples: npm run build + vitest pass (8 passed, 1 skipped, 3 todo)

Summary by cubic

Hardened archive extraction to block zip‑slip and removed a predictable temp file in the release flow. Also bumps Go and JS dependencies to address Aikido Critical/High findings (SEC‑34).

  • Bug Fixes

    • Updater: validate archive entry paths via securePath, create parent dirs for tar entries, and use errors.Is for io.EOF in extractTarGZ.
    • Release CI: write the goreleaser config to a unique os.CreateTemp file and use WriteString instead of a fixed /tmp/.goreleaser.yml.
  • Dependencies

    • Go: golang.org/x/cryptov0.52.0, golang.org/x/netv0.55.0, google.golang.org/grpcv1.79.3; also bumped golang.org/x/{oauth2,term,text,mod,sys,tools}.
    • JS (in internal/defaultcodesamples): add overrides for jsonpath-plus ^10.3.0 and lodash ^4.18.1.

Written for commit c1cf8b9. Summary will update on new commits.

Review in cubic

Follow-up (2026-08-04): the grpc 1.79.3 bump here was insufficient for GHSA-hrxh-6v49-42gf (first patched in 1.82.1); that bump, removal of the vulnerable github.com/docker/docker dependency (CVE-2026-34040), and studio server hardening landed in #2107.

… bumps

Security fixes from the Aikido remediation pass:

- internal/updates: validate archive entry paths stay inside the extraction
  directory in extractZip and extractTarGZ (zip-slip); also create parent
  directories for tar file entries before writing
- internal/ci/git: write the goreleaser config to a unique os.CreateTemp
  file instead of the predictable /tmp/.goreleaser.yml
- go.mod: bump golang.org/x/crypto to v0.52.0 (AIKIDO-2026-11022 family),
  golang.org/x/net to v0.55.0 (AIKIDO-2026-11039), google.golang.org/grpc
  to v1.79.3 (CVE-2026-33186)
- internal/defaultcodesamples: npm overrides for jsonpath-plus ^10.3.0
  (CVE-2024-21534, CVE-2025-1302) and lodash ^4.18.1 (CVE-2026-4800)

go build ./... clean; defaultcodesamples build + vitest pass.
@linear-code

linear-code Bot commented Aug 3, 2026

Copy link
Copy Markdown

SEC-34

SEC-39

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

@ThomasRooney

Copy link
Copy Markdown
Member Author

Pushed errorlint fix (errors.Is(err, io.EOF)). Note: the Build & Test (windows-latest) failure is pre-existing — the same job failed on #2105 (merged earlier today); TestQuickstart/{csharp,go,mcp-typescript,python} hang until the 20m suite timeout, unrelated to this diff.

@AshGodfrey

Copy link
Copy Markdown
Contributor

Your PR description lists a different version (The overrides entry says ^10.3.0 while the PR description seems to imply^10.4.0 - can you double check that?)

@ThomasRooney

Copy link
Copy Markdown
Member Author

Good catch — that was a wording slip in the description, not a version mismatch in the code. The override is a range, not a pin:

  • internal/defaultcodesamples/package.json overrides: jsonpath-plus: ^10.3.0
  • package-lock.json resolves that to 10.4.0

Both CVEs are covered by ^10.3.0 (CVE-2024-21534 fixed in 10.2.0, CVE-2025-1302 in 10.3.0); the lockfile just picked up the latest 10.x patch. I've corrected the description to say ^10.3.0 → resolves to 10.4.0 so it matches the diff.

@ThomasRooney
ThomasRooney merged commit 8015f58 into main Aug 4, 2026
5 of 6 checks passed
@ThomasRooney
ThomasRooney deleted the fix/aikido-security branch August 4, 2026 10:56
ThomasRooney added a commit that referenced this pull request Aug 4, 2026
…r hardening (#2107)

Follow-up to #2106 (merged) for
[SEC-39](https://linear.app/speakeasy/issue/SEC-39).

## Summary

- **CVE-2026-34040** (docker AuthZ plugin bypass, Aikido 456150475): no
fixed version exists on the `github.com/docker/docker` module path (fix
is only on `github.com/moby/moby/v2`). Resolved by bumping
`testcontainers-go` v0.40.0 → v0.43.0, which migrated to
`github.com/moby/moby/{api,client}` — `docker/docker` is now removed
from the module graph entirely (gone from go.mod and go.sum).
- **GHSA-hrxh-6v49-42gf** (grpc xDS RBAC / HTTP/2, Aikido 456150548):
first patched version is **1.82.1**, so the 1.79.3 bump in #2106 was
insufficient. grpc → v1.82.1.
- **Studio server hardening** (Aikido 456152166 + codex review): bind
`127.0.0.1` instead of all interfaces (the unauthenticated `/` redirect
leaks the studio secret in the `Location` header, so LAN exposure was a
real risk), add `ReadHeaderTimeout`/`IdleTimeout` (no Read/WriteTimeout
— /run and /health use SSE).
- **defaultcodesamples**: replace fixed world-readable
`/tmp/defaultcodesamples.js` (executed by node; pre-creatable/swappable
by another local user) with a unique owner-only `os.CreateTemp` file,
removed after use.

## Verification

- `go build ./...` clean
- `go vet ./internal/studio/... ./internal/defaultcodesamples/...` clean
- `go test ./internal/studio/... ./internal/defaultcodesamples/...
./internal/updates/...` pass

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Removes vulnerable `github.com/docker/docker`, upgrades
`google.golang.org/grpc` to v1.82.1, and hardens Studio server and temp
file handling. Follow-up for SEC-39 to close outstanding security
alerts.

- **Dependencies**
- Replaced `github.com/docker/docker` by bumping
`github.com/testcontainers/testcontainers-go` v0.40.0 → v0.43.0
(migrates to `github.com/moby/moby/{api,client}`).
  - Upgraded `google.golang.org/grpc` v1.79.3 → v1.82.1.

- **Bug Fixes**
- Studio server now binds to `127.0.0.1` and sets `ReadHeaderTimeout`
and `IdleTimeout` (SSE-safe).
- `defaultcodesamples`: use `os.CreateTemp` for a unique, owner-only
file and remove it after use.

<sup>Written for commit b5b316f.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/speakeasy-api/speakeasy/pull/2107?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->
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