Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username not logged for logged in users in access log #16600

Closed
2 of 6 tasks
svh1985 opened this issue Aug 2, 2021 · 2 comments · Fixed by #16605
Closed
2 of 6 tasks

Username not logged for logged in users in access log #16600

svh1985 opened this issue Aug 2, 2021 · 2 comments · Fixed by #16605
Labels
Milestone

Comments

@svh1985
Copy link

svh1985 commented Aug 2, 2021

  • Gitea version (or commit ref): 1.15.0+rc2
  • Operating system: Host: Ubuntu 20.04.02 running Gitea docker container
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Access log entry of logged in user:
    192.168.1.154:0 - - [02/Aug/2021:13:15:29 +0000] "GET /api/v1/user/stopwatches HTTP/1.1" 200 3 "" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15"

Config:

[log]
MODE      = file
LEVEL     = info
ROUTER    = console
ROOT_PATH = /data/gitea/log
ENABLE_ACCESS_LOG = true
ENABLE_SSH_LOG = true
LOG_ROTATE = true
DAILY_ROTATE = true
MAX_DAYS = 90
@zeripath
Copy link
Contributor

zeripath commented Aug 2, 2021

oh yes I see... that's both interesting, annoying and I don't quite know what's happened there..

@zeripath zeripath added this to the 1.15.0 milestone Aug 2, 2021
@zeripath
Copy link
Contributor

zeripath commented Aug 2, 2021

Hmm... fixing this is a bit more involved that I would have hoped.

zeripath added a commit to zeripath/gitea that referenced this issue Aug 2, 2021
Unfortunately when the AccessLogger was moved back before the contexters the
SignedUserName reporting was lost. This is due to Request.WithContext leading to a
shallow copy of the Request and the modules/context/Context being within that request.

This PR adds a new context variable of a string pointer which is set and handled
in the contexters.

Fix go-gitea#16600

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this issue Aug 4, 2021
Backport go-gitea#16605

Unfortunately when the AccessLogger was moved back before the contexters the
SignedUserName reporting was lost. This is due to Request.WithContext leading to a
shallow copy of the Request and the modules/context/Context being within that request.

This PR adds a new context variable of a string pointer which is set and handled
in the contexters.

Fix go-gitea#16600

Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick pushed a commit that referenced this issue Aug 4, 2021
* Pass down SignedUserName down to AccessLogger context

Unfortunately when the AccessLogger was moved back before the contexters the
SignedUserName reporting was lost. This is due to Request.WithContext leading to a
shallow copy of the Request and the modules/context/Context being within that request.

This PR adds a new context variable of a string pointer which is set and handled
in the contexters.

Fix #16600

Signed-off-by: Andrew Thornton <art27@cantab.net>

* handle nil ptr issue

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
techknowlogick pushed a commit that referenced this issue Aug 4, 2021
Backport #16605

Unfortunately when the AccessLogger was moved back before the contexters the
SignedUserName reporting was lost. This is due to Request.WithContext leading to a
shallow copy of the Request and the modules/context/Context being within that request.

This PR adds a new context variable of a string pointer which is set and handled
in the contexters.

Fix #16600

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants