Skip to content

fix(deps): resolve postcss + tar audit findings via overrides#8612

Merged
JSONbored merged 4 commits into
mainfrom
fix/8588-npm-audit-postcss-tar
Jul 25, 2026
Merged

fix(deps): resolve postcss + tar audit findings via overrides#8612
JSONbored merged 4 commits into
mainfrom
fix/8588-npm-audit-postcss-tar

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Resolves the two non-breaking npm audit findings from Dependency audit cleanup: 7 pre-existing vulnerabilities + deprecation warnings #8588: postcss <=8.5.17 (path traversal in previous-sourcemap auto-loading, GHSA-r28c-9q8g-f849, high) and tar <=7.5.20 (uncontrolled recursion DoS, GHSA-r292-9mhp-454m, moderate) — both pinned via overrides in root package.json, matching the existing pattern for this file's other transitive-dep security pins.
  • Three incidental fixes found while running the full local gate for this change (each documented in its own commit): the local test:ci script was missing a build --workspace @loopover/ui-kit step that real CI already has (from feat(release): extend the release-due watcher + tarball pack-check to engine/miner/ui-kit #8592, but only in the workflow, not this script); the loopover-mcp CLI silently truncates any piped command output over ~64KB (a real, live bug in the published @loopover/mcp package — process.exit() was called before an async pipe write finished flushing); and a real-subprocess test (miner-package-skeleton.test.ts) needed the same evidence-based 60s timeout already used elsewhere in this suite for genuinely slow-under-load subprocess tests.

Advances #8588 (task 1 of 4) — does not close it. The other 3 tasks (eslint v10 bump, @esbuild-kit->tsx trace, recharts v3 migration) are unrelated, each need their own scoping, and are now tracked as sub-issues #8608, #8609, #8610.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused on dependency-audit remediation; the 3 incidental fixes were each discovered while validating this same change (running the full local gate) rather than pre-planned, and are each isolated to their own commit for reviewability.
  • This follows CONTRIBUTING.md and does not touch site/, CNAME, or **/lovable/**.
  • I linked a currently open issue this PR resolves — this is an owner/maintainer PR (not a contributor PR), so the one-shot gate's linked-issue requirement doesn't apply; see Notes.

Validation

  • git diff --check
  • npm run actionlint (part of npm run test:ci)
  • npm run typecheck
  • npm run test:coverage locally (unsharded, via npm run test:ci) — no src/** lines changed by this PR, so no Codecov patch-coverage obligation; ran anyway per the full local gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate — clean of postcss/tar; the remaining 5 findings are the unrelated eslint v10/brace-expansion chain, out of scope per Dependency audit cleanup: 7 pre-existing vulnerabilities + deprecation warnings #8588's own task breakdown, tracked as Bump eslint to v10 to resolve brace-expansion/minimatch DoS chain (GHSA-mh99-v99m-4gvg) #8608.
  • New/changed behavior has tests: the loopover-mcp truncation fix is directly exercised by the existing (previously-failing) mcp-cli-profiles.test.ts changelog test, which now passes and serves as its regression test.

Ran the full npm run test:ci gate three times end-to-end while fixing the incidental issues it surfaced; final run is fully green.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, tokens, trust scores, or private data are exposed.
  • Public GitHub text stays sanitized and low-noise.
  • N/A — no auth/cookie/CORS/GitHub App/Cloudflare/session changes.
  • N/A — no API/OpenAPI/MCP behavior change (the MCP fix is output-plumbing correctness, not a new surface).
  • N/A — no UI changes.
  • N/A — no visible UI change, no UI Evidence needed.
  • N/A — no docs/changelog changes needed.

Notes

npm audit flagged postcss <=8.5.17 (path traversal in previous-sourcemap
auto-loading, GHSA-r28c-9q8g-f849, high) and tar <=7.5.20 (uncontrolled
recursion DoS via crafted long-path tar, GHSA-r292-9mhp-454m, moderate),
both transitive. Pin both via overrides, matching this file's existing
pattern for other transitive-dep security fixes: bump the existing tar
override past its first-patched version (7.5.19 -> 7.5.21) and add a new
postcss override (8.5.18, first patched version).

Closes task 1 of #8588's checklist. The remaining findings in that issue
(eslint v10 bump for the brace-expansion/minimatch chain, the
@esbuild-kit->tsx trace, and the recharts v3 migration) are unrelated,
each need their own scoping, and are now tracked as sub-issues #8608,
#8609, #8610.
Discovered incidentally while running the full local gate for #8588:
test/unit/check-ui-kit-package.test.ts's own regression guard needs
packages/loopover-ui-kit/dist/ to exist, but the root test:ci script
never built that workspace before test:coverage -- unlike the real CI
validate-tests job, which already builds it via `npx turbo run build
--filter=@loopover/ui-kit` right before its own coverage step (added in
#8592 to close this exact gap, but only in the CI workflow, not the
local script this repo's own contributing guide points everyone at).
Anyone running `npm run test:ci` from a clean checkout hit a spurious
failure that real CI never showed.

Adds `npm run build --workspace @loopover/ui-kit` alongside the other
per-package builds already in the chain (engine, discovery-index, mcp,
miner), so the local script matches CI again.
Discovered incidentally while running the full local gate for #8588:
test/unit/mcp-cli-profiles.test.ts's changelog test started failing with
a JSON parse error once packages/loopover-mcp/CHANGELOG.md grew past the
OS pipe buffer size (verified: `loopover-mcp changelog --json | wc -c`
returned exactly 65536 bytes instead of the real 65603+ -- the classic
64KB pipe-buffer boundary).

Root cause: process.stdout/stderr writes to a POSIX pipe are
asynchronous, but the CLI entrypoint called process.exit() immediately
after the command's async work resolved, cutting off any pending write
larger than one pipe buffer's worth before it finished flushing. This
silently truncates any command's output over ~64KB for any real
consumer piping the CLI (not just this test) -- e.g. `loopover-mcp
changelog --json | jq` would get invalid JSON.

Fix: drain both streams (wait for their internal buffer to empty) right
before calling process.exit(), instead of changing when/whether
process.exit() itself is called -- keeps the existing fast-exit behavior
for everything else (no risk of hanging on a lingering fetch keep-alive
socket) while fixing the truncation at its actual source.
…uard

Discovered incidentally while running the full local gate for #8588:
this test spawns a real subprocess (node --check over every
dist/bin+dist/lib file in packages/loopover-miner) -- 5.5s in isolation,
but it exceeded the default 15s testTimeout once under the full suite's
parallel load. Genuinely necessary real subprocess work with no
redundancy to cut, matching this repo's established real-subprocess
timeout-flake pattern (agent-sdk-driver.test.ts, miner-attempt-worktree
.test.ts, miner-repo-clone.test.ts, #6869/#6871): raise to the same
evidence-based 60000ms ceiling already used for that class of test,
rather than reflexively widening without a reason.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 25, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui a573c8d Commit Preview URL

Branch Preview URL
Jul 25 2026, 07:55 AM

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@JSONbored
JSONbored merged commit bca96ff into main Jul 25, 2026
6 checks passed
@JSONbored
JSONbored deleted the fix/8588-npm-audit-postcss-tar branch July 25, 2026 08:00
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 25, 2026
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.55%. Comparing base (a972353) to head (a573c8d).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8612   +/-   ##
=======================================
  Coverage   92.55%   92.55%           
=======================================
  Files         798      798           
  Lines       79850    79850           
  Branches    24120    24120           
=======================================
  Hits        73908    73908           
  Misses       4803     4803           
  Partials     1139     1139           
Flag Coverage Δ
backend 93.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-mcp/bin/loopover-mcp.ts 19.22% <ø> (ø)

JSONbored added a commit that referenced this pull request Jul 25, 2026
…racking sink

Per the epic's revised strategy (#8286 correction, 2026-07-25): PostHog
replaces Sentry directly, not a parallel-run sink. This branch's earlier
commit added PostHog alongside the existing Sentry wiring; this commit
finishes the swap by removing Sentry entirely.

Deletes src/sentry.ts, scripts/validate-sentry-release.mjs, the
@sentry/node/@sentry/cli dependencies, and the live metagraphed Sentry
DSN previously baked into wrangler.jsonc's vars (a genuine cross-project
entanglement -- discovery-index reporting into a different product's
shared Sentry project, exactly the problem #8289 set out to fix).
Removes the corresponding SENTRY_* fields from env.d.ts/WorkerEnv/
Cloudflare.Env, regenerates worker-configuration.d.ts, and drops the
Sentry leg from upload-sourcemaps.ts (PostHog's inject/upload/validate
flow is now the only path, no more Math.max(sentryExitCode,
postHogExitCode) combining).

@posthog/cli is pinned to an exact version (0.9.1, no caret) rather
than a range -- its postinstall script downloads a platform binary over
HTTPS with no checksum verification.

Also rebases onto current main to pick up #8612's postcss/tar dependency
overrides, which an earlier `npm install --workspace` in this branch had
inadvertently regressed to their pre-fix versions.

Closes #8289
JSONbored added a commit that referenced this pull request Jul 25, 2026
… + sourcemap pipeline (#8614)

* feat(discovery-index): add PostHog error tracking + sourcemap pipeline as a parallel Sentry sink

Adds src/posthog.ts, mirroring src/sentry.ts's shape exactly (same
redaction rules, tag allowlist, capture entry points) using PostHog's
documented captureException(error, distinctId, properties) API, wired
into app.ts's onError handler, server.ts's unhandled-rejection/
uncaught-exception hooks and shutdown path, and worker.ts's Container
env forwarding.

Extends upload-sourcemaps.ts with a second, fully independent leg:
posthog-cli sourcemap inject/upload with an explicit --release-version
(the Docker build never copies .git, so the CLI's own git-metadata
auto-detection has nothing to inspect), running after the existing,
unmodified Sentry leg so an unverified interaction between the two
CLIs' inject steps can't put the proven flow at risk. Adds
scripts/validate-posthog-release.mjs, a narrower release-verification
counterpart to validate-sentry-release.mjs -- PostHog's release model
has no commits/deploys/finalize lifecycle to check, only symbol-set
presence via the error_tracking/symbol_sets API.

All PostHog config (POSTHOG_API_KEY/HOST/ENVIRONMENT/RELEASE for
capture, POSTHOG_CLI_API_KEY/PROJECT_ID/HOST for sourcemap upload) is
wired end-to-end but not yet a real wrangler.jsonc var/secret -- #7875
(a real loopover-owned PostHog project) isn't provisioned yet, so every
path stays a complete no-op until then, same as an unset SENTRY_DSN.

Runs fully parallel with the existing Sentry sink per the epic's gated
decommission plan (#8298); nothing about the Sentry leg changes here.

Closes #8289

* feat(discovery-index): remove Sentry, PostHog is now the sole error tracking sink

Per the epic's revised strategy (#8286 correction, 2026-07-25): PostHog
replaces Sentry directly, not a parallel-run sink. This branch's earlier
commit added PostHog alongside the existing Sentry wiring; this commit
finishes the swap by removing Sentry entirely.

Deletes src/sentry.ts, scripts/validate-sentry-release.mjs, the
@sentry/node/@sentry/cli dependencies, and the live metagraphed Sentry
DSN previously baked into wrangler.jsonc's vars (a genuine cross-project
entanglement -- discovery-index reporting into a different product's
shared Sentry project, exactly the problem #8289 set out to fix).
Removes the corresponding SENTRY_* fields from env.d.ts/WorkerEnv/
Cloudflare.Env, regenerates worker-configuration.d.ts, and drops the
Sentry leg from upload-sourcemaps.ts (PostHog's inject/upload/validate
flow is now the only path, no more Math.max(sentryExitCode,
postHogExitCode) combining).

@posthog/cli is pinned to an exact version (0.9.1, no caret) rather
than a range -- its postinstall script downloads a platform binary over
HTTPS with no checksum verification.

Also rebases onto current main to pick up #8612's postcss/tar dependency
overrides, which an earlier `npm install --workspace` in this branch had
inadvertently regressed to their pre-fix versions.

Closes #8289
@github-actions github-actions Bot mentioned this pull request Jul 25, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant