Skip to content

fix: prevent root directory exposure via express.static#967

Open
Vedhant26 wants to merge 1 commit into
Charushi06:mainfrom
Vedhant26:fix/issue-900-root-dir-exposed
Open

fix: prevent root directory exposure via express.static#967
Vedhant26 wants to merge 1 commit into
Charushi06:mainfrom
Vedhant26:fix/issue-900-root-dir-exposed

Conversation

@Vedhant26
Copy link
Copy Markdown

🔒 Fix: Prevent Root Directory Exposure

Closes #900

Security Issue

The application was exposing the entire root directory statically via app.use(express.static(__dirname));. This allowed anyone to access sensitive files directly from the browser, including:

  • .env (API keys, secrets)
  • studyplan.db (The entire SQLite database with user tasks/data)
  • database.js and server.js (Backend source code)

Solution

Removed the wildcard root static exposure and replaced it with specific routes for explicitly needed public files:

  • Mapped /support-page explicitly.
  • Added direct routes for /, /logo.png, and /favicon.ico.
  • Now, only intentionally public assets (/css, /js, /support-page, etc.) are served, protecting the root directory contents from unauthorized access.

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