Skip to content

feat: added user 'foo' as test user to allow for local debugging#3

Merged
LightJack05 merged 2 commits intomainfrom
fix-bypass-logic-to-test-user
Jan 21, 2026
Merged

feat: added user 'foo' as test user to allow for local debugging#3
LightJack05 merged 2 commits intomainfrom
fix-bypass-logic-to-test-user

Conversation

@LightJack05
Copy link
Member

  • 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
Copilot AI review requested due to automatic review settings January 21, 2026 09:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
c.Set("username", "foo")
c.Set("username", "foo")
c.Next()

Copilot uses AI. Check for mistakes.
}

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")
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@LightJack05 LightJack05 merged commit b7c7eb2 into main Jan 21, 2026
6 checks passed
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