Skip to content

fix(security): restrict express.static to specific public folders (#900)#955

Open
Nicks-19 wants to merge 1 commit into
Charushi06:mainfrom
Nicks-19:fix/issue-900-static-directory-exposure
Open

fix(security): restrict express.static to specific public folders (#900)#955
Nicks-19 wants to merge 1 commit into
Charushi06:mainfrom
Nicks-19:fix/issue-900-static-directory-exposure

Conversation

@Nicks-19
Copy link
Copy Markdown

Related Issue

Closes #900

Summary

This pull request resolves a security vulnerability where the entire root directory was served statically, exposing private backend files (e.g., .env and studyplan.db) to the public.

Changes Made

  • Removed app.use(express.static(__dirname)) in server.js.
  • Restricted express.static to specific public asset directories: public/, css/, js/, and support-page/.
  • Configured explicit endpoints for root-level frontend files (index.html and logo.png).

Testing

  • Statically verified that the insecure root directory serving statement is removed and all safe asset mappings are correctly mounted.
  • Verified syntax validity of server.js using Node.js syntax compiler.

Checklist

  • Code follows project style
  • Tested locally
  • No unrelated changes included
  • Documentation updated (if applicable)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Whole Root Directory Exposed Statically via express.static

1 participant