Skip to content

fix: SFI issue fix#197

Merged
Prajwal-Microsoft merged 2 commits intodevfrom
sfi-issue-fix
Aug 22, 2025
Merged

fix: SFI issue fix#197
Prajwal-Microsoft merged 2 commits intodevfrom
sfi-issue-fix

Conversation

@Ravikirana-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces important security enhancements to the FastAPI frontend server. The changes focus on preventing unauthorized access to sensitive files, mitigating directory traversal attacks, and adding security headers to HTTP responses.

Security improvements for static file serving:

  • Added path resolution and validation logic in the serve_app endpoint to prevent directory traversal and ensure only files within the build directory are served.
  • Implemented checks to block access to dotfiles, forbidden file extensions (e.g., .env, .py, .key), and forbidden filenames (e.g., Dockerfile, .secrets). Suspicious requests now return a 404 error. [1] [2]

HTTP response hardening:

  • Added middleware to inject basic security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy) into all responses for improved browser security.
  • Ensured security headers are also included in responses from the static file serving endpoint.

Dependency and import updates:

  • Updated imports to include Path, HTTPException, and Request for new security logic.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

@Prajwal-Microsoft Prajwal-Microsoft merged commit db791bc into dev Aug 22, 2025
6 checks passed
Ritesh-Microsoft pushed a commit that referenced this pull request Oct 10, 2025
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.5.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Priyanka-Microsoft Priyanka-Microsoft deleted the sfi-issue-fix branch December 25, 2025 08:59
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.

2 participants