Skip to content

Conversation

@Ravikirana-Microsoft
Copy link
Contributor

Purpose

This pull request enhances the security and robustness of the static file serving logic in src/frontend/frontend_server.py. The main improvements include adding protections against directory traversal, blocking access to sensitive files, and introducing security headers for all responses.

Security enhancements for static file serving:

  • Implemented path resolution checks to prevent directory traversal attacks when serving files from the build directory.
  • Added checks to block serving dotfiles and files with sensitive extensions or names, such as .env, .py, .pem, and Dockerfile. [1] [2]

HTTP response security improvements:

  • Introduced middleware to add basic security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy) to all responses.
  • Ensured that suspicious or invalid file requests return a generic 404 error to prevent information leakage.

Codebase improvements:

  • Refactored imports to support new security logic and file path handling.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

@Prajwal-Microsoft Prajwal-Microsoft merged commit ffcfa86 into dev Aug 22, 2025
8 checks passed
@Ravikirana-Microsoft Ravikirana-Microsoft deleted the sfi-issue-fix branch September 10, 2025 07:24
@github-actions
Copy link

🎉 This PR is included in version 2.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants