Skip to content

refactor: drop axios for fetch (audit bucket 3 — H3) - #3

Merged
CR0CKER merged 1 commit into
mainfrom
refactor/drop-axios
Jul 20, 2026
Merged

CR0CKER merged 1 commit into
mainfrom
refactor/drop-axios

Conversation

@CR0CKER

@CR0CKER CR0CKER commented Jul 20, 2026

Copy link
Copy Markdown
Owner

What changed

Audit bucket 3, finding H3. Removes the axios dependency and replaces the calendar download with the built-in fetch.

  • index.ts: axios.get(url)fetch(url); parse via node-ical parseICS on the response text.
  • Removed axios from package.json + lockfile.
  • Error handling fixed: fetch doesn't reject on HTTP errors, so status is checked explicitly. The old code string-matched a 404 message fetch never emits and swallowed other failures silently; non-404 failures now surface to the user.

Why

axios 0.25 carried 20+ advisories (SSRF, prototype-pollution response tampering, credential leak on redirect). The plugin only did an authless GET — fetch covers it with zero dependency surface.

Scope note (honest)

node-ical still pulls axios@0.24 transitively, but it's off the plugin's code path — only node-ical's URL-fetch helpers use axios, and the plugin calls only the synchronous parseICS(string). So the SSRF/response-tampering surface is gone, but npm audit stays partly red until node-ical is bumped (a breaking major — deferred to after the bucket-4 test suite; Dependabot will surface it).

Testing / verification

  • npm run typecheck: unchanged at 65 errors (fetch/Response are DOM-typed; no regression).
  • CI build gate verifies the bundle compiles.
  • ⚠️ Runtime not verifiable off-device: whether fetch behaves identically to axios for cross-origin iCal URLs (CORS/redirects) in the Logseq renderer needs a manual smoke-test in Logseq before the next release. Both use the renderer's same web-security policy, so this is expected to work, but it should be confirmed live.

Reviewer note

No automated PR reviewer configured; self-reviewed (fetch semantics, error paths, no secrets, no behavior change beyond the documented error-handling fix).

🤖 Generated with Claude Code

https://claude.ai/code/session_019cVCdCtNzUJmy1yen3JyBk

Removes the axios dependency and the axios.get on the calendar-fetch path —
the surface behind axios' SSRF and prototype-pollution advisories. Calendar
data is now fetched with the built-in fetch and parsed from a string via
node-ical's synchronous parseICS, so no HTTP client touches the response body.

Also fixes error handling: fetch does not reject on HTTP error statuses, so the
status is checked explicitly. The old code string-matched a 404 error message
that fetch never produces and silently swallowed other failures; non-404
failures now surface a message.

node-ical still pulls axios@0.24 transitively but it is off the plugin's code
path (only its URL-fetch helpers use it, which we don't call). Removing it needs
a node-ical major bump, deferred until the parser test suite lands (H2).

Typecheck error count unchanged (65). Runtime network behavior (CORS/redirects
in the Logseq renderer) not verifiable off-device — needs a manual smoke-test
in Logseq before the next release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019cVCdCtNzUJmy1yen3JyBk
@CR0CKER
CR0CKER merged commit a620fd8 into main Jul 20, 2026
1 of 3 checks passed
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