feat: added user 'foo' as test user to allow for local debugging#3
feat: added user 'foo' as test user to allow for local debugging#3LightJack05 merged 2 commits intomainfrom
Conversation
LightJack05
commented
Jan 21, 2026
- sets the username to 'foo' when running in local debugging mode, to allow for debugging of apps requiring a username
- sets the username to 'foo' when running in local debugging mode, to allow for debugging of apps requiring a username
There was a problem hiding this comment.
Pull request overview
This PR adds debug bypass functionality for the authentication middleware to facilitate local debugging by setting a test user 'foo' when authentication is bypassed. The changes also update the service-config-lib dependency to version 0.2.0, which likely includes the new DebugBypassAuthMiddleware configuration field.
Changes:
- Added bypass logic that sets username to 'foo' and logs a warning when debug mode is enabled
- Updated service-config-lib dependency from v0.1.3 to v0.2.0
- Modified Authentication middleware to check for debug bypass flag before proceeding with normal authentication
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| middleware.go | Added bypassLogic function and debug bypass check in Authentication middleware with warning logging |
| go.mod | Updated service-config-lib dependency from v0.1.3 to v0.2.0 |
| go.sum | Added checksum entries for service-config-lib v0.2.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| func bypassLogic(c *gin.Context) { | ||
| log.Println("\033[1;31mWARNING: DEBUG_BYPASS_AUTH_MIDDLEWARE is enabled, bypassing authentication and setting user to 'foo'!\033[0m") | ||
| c.Set("username", "foo") |
There was a problem hiding this comment.
The bypassLogic function is missing a call to c.Next() at the end. Looking at the Authentication function at line 59, c.Next() is called after setting the username to continue the middleware chain. Without this call in bypassLogic, subsequent middleware and handlers in the chain will not be executed when the debug bypass is enabled, which will break the request flow.
| c.Set("username", "foo") | |
| c.Set("username", "foo") | |
| c.Next() |
| } | ||
|
|
||
| func bypassLogic(c *gin.Context) { | ||
| log.Println("\033[1;31mWARNING: DEBUG_BYPASS_AUTH_MIDDLEWARE is enabled, bypassing authentication and setting user to 'foo'!\033[0m") |
There was a problem hiding this comment.
The warning message is logged on every authenticated request when debug bypass is enabled. This could generate excessive log output and make debugging more difficult. Consider logging this warning only once at application startup or middleware initialization instead of on every request.