Skip to content

Fix: remove hardcoded API key from scan command#7

Open
rajaramr7 wants to merge 1 commit into
mainfrom
fix/remove-hardcoded-api-key
Open

Fix: remove hardcoded API key from scan command#7
rajaramr7 wants to merge 1 commit into
mainfrom
fix/remove-hardcoded-api-key

Conversation

@rajaramr7
Copy link
Copy Markdown
Collaborator

Summary

  • Removes hardcoded report backend API key from mcp_audit/commands/scan.py
  • API key now read from MCP_AUDIT_API_KEY environment variable
  • Backend URL configurable via MCP_AUDIT_BACKEND_URL (defaults to current Vercel endpoint)
  • Shows clear message when env var is not set instead of sending requests with empty key

Why

A security auditing tool should not have its own API key hardcoded in source code. The key was visible to anyone reading the repo.

Test plan

  • All 136 tests pass
  • Set MCP_AUDIT_API_KEY env var, run mcp-audit scan --email test@example.com — verify report sends
  • Run without env var — verify clear warning message, no failed request

Move the report backend API key from hardcoded string to environment
variable MCP_AUDIT_API_KEY. Also make the backend URL configurable
via MCP_AUDIT_BACKEND_URL. Show a clear message when the env var
is not set instead of sending requests with an empty key.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

🟢 MCP Security Audit Results

Risk Level Count
Critical 0
High 0
Medium 0
Low 0

Total MCPs found: 6


Generated by MCP Audit

rajaramr7 added a commit that referenced this pull request Apr 13, 2026
- Report API key moved from hardcoded string to window.MCP_AUDIT_REPORT_KEY
  (set at deployment time via index.html script block)
- Analytics URL moved from hardcoded Google Apps Script URL to
  window.MCP_AUDIT_ANALYTICS_URL (same pattern)
- Added graceful handling when keys are not configured
- index.html updated with deployment configuration block
- This completes the security fix started in PR #7 (scan.py)
  which only addressed the Python CLI, not the web frontend
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.

1 participant