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

Add username to Apache request object #376

Closed
jesusbagpuss opened this issue Feb 27, 2024 · 3 comments
Closed

Add username to Apache request object #376

jesusbagpuss opened this issue Feb 27, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jesusbagpuss
Copy link
Contributor

This comes from a question asked on the mailing list (2024-02-27).

Requests that hit the EPrints::Apache::Auth::auth_basic function will log the username to the Apache access.log file (if %u is in the log format definition). This is caused by this link:

$r->user( $username );

There are various places that a similar line could be added - but I'm not quite sure where the right place is - possibly somewhere in EPrints::Apache::Rewrite before the URL_REWRITE triggers are called.

A config option may also be a sensible option to control whether the usernames are logged.
$c->{log_usernames_in_apache_logfile} = 0;

I'm not sure if all authentication routes result in a sensible value from $repo->current_user->value( "username" );?
If not, an archive-level config method to allow something sensible to be added to $r->user( ... ); would be good.

@drn05r drn05r self-assigned this Feb 27, 2024
@drn05r drn05r added the enhancement New feature or request label Feb 27, 2024
@drn05r drn05r added this to the 3.4.6 milestone Feb 27, 2024
@drn05r
Copy link
Contributor

drn05r commented Feb 27, 2024

I think by default I would want to have this switched off, as I cannot ascertain why this was not already being set in the EPrints::Apache::Auth::auth_cookie function. It concerns me that there may previously have been a decision was taken to not set this for data privacy reasons.

@jesusbagpuss
Copy link
Contributor Author

I'd say that's the right decision.

I guess is should be consistent between basic_auth and cookie_auth (and other auths).

@drn05r
Copy link
Contributor

drn05r commented Feb 28, 2024

I thought it better to call this $c->{cookie_auth_set_user} as this is already an option called $c->{cookie_auth} so it is easier to appreciate this are related. I will add the option, disabled by default in lib/cfg.d/misc.pl. The code to set the user needs to be in perl_lib/EPrints/Apache/Rewrite.pm.

@drn05r drn05r closed this as completed in bd4dd59 Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants