Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/http-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ export class HttpTransport {
next();
});

// Security: Standard security headers
this.app.use((req: Request, res: Response, next: NextFunction) => {
// Prevent clickjacking
res.setHeader('X-Frame-Options', 'DENY');
// Prevent MIME type sniffing
res.setHeader('X-Content-Type-Options', 'nosniff');
// Content Security Policy
res.setHeader('Content-Security-Policy', "default-src 'self'");

// Strict Transport Security (HSTS)
// Only set on non-localhost to avoid issues with local development
if (req.hostname !== 'localhost' && req.hostname !== '127.0.0.1') {
res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
}

next();
});

// DNS rebinding protection when binding to localhost
// Deny requests with mismatched Host headers to prevent DNS rebinding attacks
// Applies when server host is localhost/127.0.0.1, regardless of auth configuration
Expand Down
Loading