Skip to content

Require authentication on src/routes/diagnostics.ts to avoid an internal info leak #158

Description

@Jagadeeshftw

📌 Description

If src/routes/diagnostics.ts is reachable without authentication, it can leak internal operational details (dependency status, versions, timing) to unauthenticated callers, which is useful reconnaissance for an attacker.

🧩 Requirements and context

  • Gate the diagnostics route behind the existing auth middleware in src/auth/middleware.ts.
  • Return a generic 401/403 for unauthenticated requests, no partial diagnostic data.
  • Document the auth requirement in the route's usage/README if documented elsewhere.

🛠️ Suggested execution

  1. Apply the auth middleware to the diagnostics router in src/routes/diagnostics.ts.
  2. Update src/routes/diagnostics.test.ts to assert unauthenticated access is rejected and authenticated access still works.

✅ Acceptance criteria

  • Unauthenticated requests to diagnostics receive 401/403 with no diagnostic payload.
  • Authenticated requests receive the full diagnostic payload as before.

🔒 Security notes

This closes an unauthenticated information-disclosure path; verify no other route mounts the same handler without the middleware.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issueStellar WaveIssues in the Stellar wave programbackendBackend / API worksecuritySecurity hardening / audit

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions