refactor: drop axios for fetch (audit bucket 3 — H3) - #3
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Audit bucket 3, finding H3. Removes the
axiosdependency and replaces the calendar download with the built-infetch.index.ts:axios.get(url)→fetch(url); parse via node-icalparseICSon the response text.axiosfrompackage.json+ lockfile.fetchdoesn't reject on HTTP errors, so status is checked explicitly. The old code string-matched a 404 messagefetchnever 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 —
fetchcovers it with zero dependency surface.Scope note (honest)
node-icalstill pullsaxios@0.24transitively, but it's off the plugin's code path — only node-ical's URL-fetch helpers use axios, and the plugin calls only the synchronousparseICS(string). So the SSRF/response-tampering surface is gone, butnpm auditstays 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).buildgate verifies the bundle compiles.fetchbehaves 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