Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Security-hardening PR that tightens trust boundaries between GUI iframes/apps and backend services, and reduces common attack surfaces (SSRF, stored XSS, token/secret misuse, and session persistence).
Changes:
- Hardened backend security controls: SSRF-resistant fetch, CSP sandboxing for active-document file types, constant-time secret compares, stricter JWT verification, and placeholder-secret boot refusal.
- Strengthened auth/session behavior: password-reset now revokes interactive sessions; login/signup endpoints get stacked rate limits (fingerprint + IP).
- Reduced GUI/app attack surface: IPC now verifies the sending iframe owns the claimed
appInstanceID; apps can’t setindex_urlto Puter system hosts.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/gui/src/IPC.js | Verifies postMessage sender matches the iframe owning appInstanceID. |
| src/backend/util/secureHttp.ts | Moves SSRF DNS checks to connect-time via undici dispatcher lookup guard. |
| src/backend/util/secureHttp.test.ts | Adds regression tests for connect-time SSRF DNS blocking and proxy bypass. |
| src/backend/util/inlineContentSecurity.ts | New helper to sandbox active-document responses served inline. |
| src/backend/util/inlineContentSecurity.test.ts | Tests CSP/nosniff behavior for active vs inert content-types. |
| src/backend/util/fileSigning.ts | Uses constant-time comparison for URL signature verification. |
| src/backend/util/fileSigning.test.ts | Adds round-trip + rejection-path tests for URL signatures. |
| src/backend/services/selfhosted/DefaultUserService.ts | Increases bootstrap admin temp password entropy. |
| src/backend/services/auth/TokenService.ts | Refuses placeholder secrets outside dev; pins JWT algorithms to HS256. |
| src/backend/services/auth/TokenService.test.ts | Tests placeholder-secret boot refusal + algorithm pinning behavior. |
| src/backend/services/auth/AuthService.ts | Adds password-reset session revocation helper for interactive sessions. |
| src/backend/server.ts | Adds referrer policy; supports stacked per-route rate limits. |
| src/backend/package.json | Adds undici dependency for dispatcher-based SSRF protections. |
| src/backend/drivers/apps/AppDriver.test.ts | Tests rejection of index_url on system/builtin hosts. |
| src/backend/drivers/apps/AppDriver.js | Blocks apps from using system/builtin hosts in index_url (sandbox escape prevention). |
| src/backend/core/http/types.ts | Extends rateLimit option to accept an array of independent limits. |
| src/backend/core/http/middleware/rateLimit.test.js | Tests stacked rate-limit gate semantics. |
| src/backend/controllers/peer/PeerController.ts | Uses constant-time internal-auth comparison (hashed then timingSafeEqual). |
| src/backend/controllers/fs/LegacyFSController.ts | Sandboxes active-document types for inline file serving (legacy endpoint). |
| src/backend/controllers/fs/FSController.ts | Sandboxes active-document types for inline file serving (/fs/read). |
| src/backend/controllers/auth/AuthController.ts | Stacks rate limits on credential endpoints; revokes sessions on password reset/change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
28faa3b to
3c40782
Compare
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.
No description provided.