-
Notifications
You must be signed in to change notification settings - Fork 0
Tech Story: Remove debug artifacts and fix password reset token log exposure #99
Copy link
Copy link
Open
Labels
backendBackend services and logicBackend services and logicsecuritySecurity, auth, and permissionsSecurity, auth, and permissionstech-storyTechnical implementation storyTechnical implementation story
Milestone
Description
Tech Story
As a platform engineer, I want debug code and accidental secret exposure removed from the codebase so that production logs, API docs, and source code do not leak sensitive information or expose unnecessary attack surface.
Context
Three specific issues found in audit:
GET /auth/test— A debug endpoint that runs a bcrypt demo with a hardcoded password andconsole.logs the result. Publicly accessible, no auth required.- Password reset token in logs —
requestPasswordReset()logs the raw reset token and full reset URL to the application log. In any log aggregation system, this token is now accessible to anyone with log access — not just DB access. - Swagger UI in production —
/api/docsis unconditionally mounted withpersistAuthorization: true, publicly documenting all endpoints and persisting credentials in the browser.
Acceptance Criteria
-
GET /auth/testendpoint and itsbcryptimport removed fromAuthController - Password reset token and reset URL no longer written to any log; the TODO comment is preserved to indicate email sending is not yet implemented
- Swagger UI only mounted when
NODE_ENV !== 'production' -
persistAuthorization: trueremoved from Swagger options (credentials should not persist in the browser) - No
console.logcalls remain inAuthControllerorAuthService
Technical Elaboration
- In
auth.controller.ts: delete the@Get('test')method and thebcryptimport - In
auth.service.tsrequestPasswordReset(): replace the twothis.logger.log()calls that include the token/URL with a single neutral log:this.logger.log(Password reset requested for user ID: ${user.id}) - In
main.ts: wrap the entire SwaggerDocumentBuilder/SwaggerModule.setupblock withif (process.env.NODE_ENV !== 'production') { ... }
Notes
- The password reset email flow itself (
TODO: Send email) is out of scope for this issue — just remove the log exposure - After this change, developers testing password reset locally will need to query the DB directly for the token until the email service is implemented
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backendBackend services and logicBackend services and logicsecuritySecurity, auth, and permissionsSecurity, auth, and permissionstech-storyTechnical implementation storyTechnical implementation story