Skip to content

fix: prevent auth tokens from being logged in cleartext#223

Merged
ksinder merged 2 commits intomainfrom
ksinder-fix-logging
Mar 4, 2026
Merged

fix: prevent auth tokens from being logged in cleartext#223
ksinder merged 2 commits intomainfrom
ksinder-fix-logging

Conversation

@ksinder
Copy link
Copy Markdown
Contributor

@ksinder ksinder commented Mar 4, 2026

Summary

Addresses a report of sensitive authorization bearer tokens being logged in cleartext across several files.

Changes

  • scripts/start-server.ts: Auto-generated HTTP auth tokens are now written to a temp file with restricted permissions (chmod 600) instead of being logged to stdout. On startup, if NOTION_TOKEN is set, the server calls /v1/users/me to resolve the bot ID and logs a direct link to the integration settings page (https://www.notion.so/profile/integrations/internal/{bot_id}) where users can view/manage their Notion API token.
  • src/openapi-mcp-server/client/http-client.ts: Removed data field from error logs to prevent potential sensitive data exposure in API error responses.
  • src/openapi-mcp-server/mcp/proxy.ts: Changed error logging to log only error messages and status codes instead of full error objects, which could contain request headers with authorization tokens via axios config.

Test plan

  • All 66 existing unit tests pass
  • Build compiles successfully
  • Manual test: start with --transport http (no --auth-token) and verify token is written to file, not stdout
  • Manual test: verify the temp file has 0600 permissions
  • Manual test: verify --disable-auth still works
  • Manual test: verify NOTION_TOKEN resolves bot ID and prints integration link
  • Verify no auth tokens appear in stderr/stdout logs during error scenarios

🤖 Generated with Claude Code

ksinder and others added 2 commits March 4, 2026 14:29
- start-server.ts: Remove auto-generation of auth tokens that were
  logged in cleartext. Now requires explicit --auth-token or AUTH_TOKEN
  env var (or --disable-auth) for HTTP transport.
- http-client.ts: Remove response data from error logs to prevent
  potential sensitive data exposure.
- proxy.ts: Log only error messages and status codes instead of full
  error objects, which could contain request headers with auth tokens.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…link

Instead of logging the auto-generated HTTP auth token in cleartext,
write it to a temp file with restricted permissions (0600). Also
resolve the bot ID via /v1/users/me and log a direct link to the
Notion integration settings page where users can manage their token.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ksinder ksinder marked this pull request as ready for review March 4, 2026 22:40
@ksinder ksinder requested review from hallie, mquan and vshen-notion March 4, 2026 22:41
@ksinder ksinder merged commit fcb19b8 into main Mar 4, 2026
8 checks passed
@ksinder ksinder deleted the ksinder-fix-logging branch March 4, 2026 22:42
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