Repository navigation
Security fixes: Next/Electron updates, download path and dev-server hardening - #4
Merged
Merged
Conversation
…ardening - next 15.5.28 (GHSA-2464-fhr4-w9xw, GHSA-p3m5-59mp-jv5r); override next's bundled postcss to ^8.5.30, since 15.5.28 still pins 8.4.31 - electron ^44.9.3 (GHSA-jr5w-w6x2-84p9), electronVersion to match - attachments: sender/file names made of dots map to "file", Windows device names get a "_" prefix, and targetOf refuses any path outside Downloads/MailClean (a sender named ".." saved into ~/Downloads) - npm run dev / npm start listen on 127.0.0.1; without MAILCLEAN_TOKEN the middleware refuses cross-site API requests (foreign Origin or Sec-Fetch-Site: cross-site); OAuth routes and demo unchanged - electron: block other origins on will-redirect and in subframes - tests for targetOf and the middleware
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Fixes the actionable findings from the 2026-10-25 security audit.
Changes
postcss@8.4.31, so the postcss advisories needed an extra step: anoverridesentry gives nextpostcss ^8.5.30(the same copy Tailwind and Vite use).npm audit --omit=devnow reports 0 vulnerabilities.eslint-config-nextis bumped to match.build.electronVersionis updated to match.electron/package.jsondoesn't pin a version.src/lib/attachments.ts):safe()turns names made only of dots intofileand puts_in front of Windows device names (CON, NUL, COM1, LPT1…, with or without an extension).targetOfnow resolves the path and throws if it would land outsideDownloads/MailClean...saved files into~/Downloads.npm run devandnpm startnow pass-H 127.0.0.1, so they're no longer reachable from the local network.MAILCLEAN_TOKENis unset, the middleware refuses API requests whoseOriginisn't the server's own host (orX-Forwarded-Host, for reverse proxies), whose Origin isnull, or whoseSec-Fetch-Siteiscross-site.will-redirecthandler (another origin → cancelled and opened in the system browser, likewill-navigate) andwill-frame-navigatehandler (subframes can't load another origin). Main-frame navigation is still handled bywill-navigate.src/lib/attachments.test.ts(..,., separators and device names stay under Downloads/MailClean) andsrc/middleware.test.ts(cross-site refusals, same origin, proxy host, OAuth routes, token mode and demo unchanged). PR Tests for attachments, clean-up actions, rules and middleware #3 adds broader tests in these same two files. Whichever lands second will need a simple add/add merge of the two files.Checks
npm run typecheck,npm run lint,npm test(48 tests) andnpm run buildall pass. I also ran a smoke test ofnext start -H 127.0.0.1with an empty temp DATA_DIR. It listens only on 127.0.0.1, a cross-sitetext/plainPOST to/api/cleangets 403, and same-origin requests pass the middleware.Not tested: the Electron handlers weren't run. npm's install-script policy blocked Electron's binary download in this checkout, so only
node --checkwas run onmain.cjs. Please try a desktop build before release.Left for later (low)
encryption.keywith ElectronsafeStorage(Keychain/DPAPI) instead of keeping it next to the database.isPublicHttpsfor one-click unsubscribe (DNS rebinding; already mostly blocked by TLS).downloads/downloaded_partsand revoke Google tokens, like DELETE /api/accounts/[id].npm auditalso flagsfast-uriin the dev tree.Content-Type: application/jsonon API POSTs.