Skip to content

fix(deps): Mitigate brace recursion and shared-cache disclosure - #912

Merged
BYK merged 4 commits into
masterfrom
codex/fix-dependabot-alerts
Oct 19, 2026
Merged

BYK merged 4 commits into
masterfrom
codex/fix-dependabot-alerts

Conversation

@MathurAditya724

@MathurAditya724 MathurAditya724 commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Mitigate the two open Dependabot alerts with pnpm dependency patches. Neither advisory currently identifies a fixed upstream release, and http-cache-semantics@4.3.0 still reproduces the reported cache-reuse flaw.

  • Alert #258 / GHSA-vfj7-8cjw-p6xm: bound braces@3.0.3 AST nesting to 100 levels, counting both parentheses and braces. This protects both the runtime Vercel/micromatch dependency and the Sentry build plugin's watcher. Escaped, quoted, and character-class literals retain their behavior.
  • Alert #252 / GHSA-ch52-4w7c-c8xp: update the docs dependency to 4.3.0 and share a reuse guard across request evaluation, expiry, TTL (used directly by Astro), and stale fallback APIs. Neither client max-stale, stale-while-revalidate, nor stale-if-error can override non-storable, no-cache, shared-cookie, shared proxy-revalidate, or wildcard Vary restrictions. must-revalidate retains its fresh lifetime without stale extensions. Error fallback also checks URL, host, method, and Vary identity before reusing a response. Ordinary expiry and explicitly public/private-cache cookie behavior remain supported.

Add six root regressions and thirty-three docs regressions, including Astro's actual remote-image loader against the actual transitive packages. The docs build runs its regressions, and Docker copies the root patch before its frozen install. Patch provenance and removal criteria are documented in patches/README.md.

Authenticate Changelog Preview release discovery with the workflow token through gh api, avoiding the unauthenticated 403 that blocked CI. Add three installer regressions covering latest, missing-tag fallback, and explicit tags; asset downloads do not receive authorization headers.

Validation: reproduced the unsafe behavior before patching; all 39 security regressions pass afterward. Root and docs frozen installs pass with CI's pnpm 10.27.0. Type checking, lint, formatting, CLI build/--help, and the 29-page docs build pass. Docs audit reports zero vulnerabilities.

Local root-suite baseline (TZ=UTC pnpm test): 1,561 passed, 3 skipped, 3 failed. The same failures reproduced on unmodified master on macOS: Action test uses the full workspace path in publish request titles, and dry-run E2E tests produces consistent output format (temporary-path snapshot) and executes pre-release command and shows diff of changes (GNU/BSD sed). Docker could not be built locally because no daemon is running; hosted checks cover it.

The root audit still reports the locally patched braces@3.0.3 by version. Dependabot may keep #258 open until an upstream fixed release exists; this PR does not suppress or dismiss the alert. These are local mitigations, not a claim that upstream packages or every version-based scan are fixed.

Bound brace and parenthesis AST nesting and prevent max-stale from bypassing cache reuse restrictions. Cover both advisories with behavior regressions and include dependency patches in Docker builds.
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-19 08:15 UTC

@MathurAditya724
MathurAditya724 marked this pull request as ready for review October 18, 2026 04:07
Use the workflow token through gh api for latest-release discovery and missing-tag fallback. Keep asset downloads free of authorization headers and exercise all installer branches in regression tests.
Protect the TTL path used by Astro and stale error fallback as well as direct request evaluation. Share the guard with maxAge, handle wildcard Vary values, and preserve public/private freshness behavior with regressions through the actual image loader.
Reject stale-if-error reuse across different URLs, hosts, methods, or Vary variants. Preserve matching variants and HEAD requests, with regressions for each request boundary.
@BYK
BYK merged commit ddd9ad0 into master Oct 19, 2026
29 checks passed
@BYK
BYK deleted the codex/fix-dependabot-alerts branch October 19, 2026 08:14
BYK added a commit that referenced this pull request Oct 23, 2026
…dvisories (#925)

Fixes the open npm advisories that `pnpm audit` reports for the root and
`docs/` lockfiles.

The repo has no published security advisories. I couldn't read the
Dependabot alerts list because the GitHub App returned 403 (it lacks
`vulnerability_alerts: read`), so `pnpm audit` was the source.

### Root (`pnpm-lock.yaml`)
| Package | From → To | How | Advisories |
|---|---|---|---|
| `follow-redirects` | 1.16.0 → 1.16.1 | new override
(`http-proxy@1.18.1` is the latest release and still pins the vulnerable
range) | GHSA-q3jh-wrc6-jgq8, GHSA-8r9p-f939-6h3c |
| `vite` | 7.3.5 → 7.3.7 | devDep + existing override |
GHSA-587h-7wmj-h5pm, GHSA-698v-4r3x-3vcv, GHSA-r825-w8mm-5pxw,
GHSA-rq7h-c2jc-7f22, GHSA-9jrq-w75r-8gcw |
| `vitest` / `@vitest/mocker` | 4.1.11 → 4.1.12 | devDep |
GHSA-qxg6-89mg-rqv8, GHSA-xp26-3454-mjgp |

`follow-redirects` comes in through `@vercel/client`, which is a runtime
dependency. The others are dev-only.

### Docs (`docs/pnpm-lock.yaml`)
| Package | From → To | How | Advisories |
|---|---|---|---|
| `astro` | 7.2.8 → 7.4.2 | `^7.3.3` range | GHSA-98hj-9722-w3j8,
GHSA-mpr7-6m5w-76rw |
| `zod` (4.x) | 4.3.6 / 4.6.1 → 4.6.7 | new override |
GHSA-mrhx-c7xc-m3w5 |

### CI
astro 7.4.2 requires Node `>=22.23.4`. `docs-preview.yml` pinned a bare
`'22'`, which resolved to 22.23.3 on the runner and failed the preview
build. It now uses `node-version-file: package.json` (Volta, 24.22.1),
the same as the `Build Docs` job in `build.yml`.

### Not fixed here
- **Root `zod` (GHSA-mrhx-c7xc-m3w5):** only 4.6.6+ has the fix. Craft
uses `zod@^3` in `src/schemas`, and `@vercel/python-analysis` pins
`zod@3.22.4` exactly. Fixing it means migrating to zod 4, which belongs
in its own PR. The issue is memory exhaustion when validating huge
collections. Craft only validates its own config files, so exposure is
low.
- **`braces@3.0.3` (GHSA-vfj7-8cjw-p6xm):** there's no upstream fix.
#912 already patches it via `patches/braces@3.0.3.patch`. Dropping the
patch would need `@sentry/esbuild-plugin` 2.x → 11.x, which removes the
`unplugin@1`/`chokidar@3` chain. That's also a separate PR.

### Verification
- `pnpm install --frozen-lockfile` (root and docs) ✅
- `pnpm audit`: root shows only the root zod advisory above; docs shows
no known vulnerabilities ✅
- `pnpm lint`, `pnpm typecheck`, `pnpm build`, `./dist/craft --help` ✅
- `cd docs && pnpm build` (includes `node --test`) ✅
- CI: Node 22 and Node 24 test jobs, Build Docs, and Docs Preview all
pass ✅

<!-- junior-request-attribution:start -->
via **BYK**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3A98a0eb4fa5564185070025f9 -->

--

[View Junior Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A98a0eb4fa5564185070025f9/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <burak.kaya@sentry.io>

This branch was successfully deployed

1 active deployment
false — d3f33a05 Deployed Oct 18, 2026 by MathurAditya724 via Build #3120
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