Skip to content

Security hardening: stop /server.js exposure & move Replicate token to env#4

Merged
ruofeidu merged 1 commit into
google:mainfrom
thesmartshadow:fix/security-hardening-no-client-secrets
Oct 22, 2025
Merged

Security hardening: stop /server.js exposure & move Replicate token to env#4
ruofeidu merged 1 commit into
google:mainfrom
thesmartshadow:fix/security-hardening-no-client-secrets

Conversation

@thesmartshadow

Copy link
Copy Markdown
Contributor

What

  • Prevent server.js from being served as static content (404 guard + no index).
  • Replace hard-coded Replicate token with environment variable (REPLICATE_TOKEN).

Why

README guides users to place real API keys and to expose the app via ngrok. With express.static(__dirname) the entire webapp/ folder (including server.js) becomes Internet-reachable. This hardening reduces exposure without changing public behavior.

Testing

  • Local run: /server.js is no longer publicly served (404).
  • App continues to start; token is read from env when needed.

Tracking

If acceptable, please treat as security hardening/documentation.
Request: after merge, consider opening a GHSA and, if appropriate, requesting a CVE via Google CNA/GitHub CNA.

Credit: Ali Firas (The Smart Shadow)

@thesmartshadow

Copy link
Copy Markdown
Contributor Author

Request After merge, please open a GHSA (security hardening) and, if appropriate, request a CVE via Google CNA/GitHub CNA.

@ruofeidu

Copy link
Copy Markdown
Collaborator

Thank you Ali for your contribution! This is a research & intern project and I'm happy to take your contribution!

@ruofeidu
ruofeidu merged commit 2dc6520 into google:main Oct 22, 2025
1 check passed
@thesmartshadow
thesmartshadow deleted the fix/security-hardening-no-client-secrets branch October 22, 2025 17:52
@thesmartshadow

Copy link
Copy Markdown
Contributor Author

Thank you, @ruofeidu!

Update: The hardening change has been merged: #4

Request
• Please label this as security hardening / documentation.
• If possible, open a GitHub Security Advisory (GHSA) referencing this change and, if appropriate, request a CVE via Google CNA / GitHub CNA.

Artifacts
• Before: /server.js publicly downloadable; API key present in client/server.
• After: /server.js returns 404; Replicate token moved to env vars (no client-side secrets).

Credit: Ali Firas (@thesmartshadow)

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.

2 participants