Skip to content

Anonymous user accessing non-existent or internal/private page SHOULD give 404 instead of redirecting to login page

Summary

Accessing some privileged or non-existent page as anonymous user will redirect to login page.

Steps to reproduce

Without logging in, access a non-existent or privileged page. For example, https://lily-is.land/xxx

Example Project

Not applicable.

What is the current bug behavior?

It redirects me to login page.

What is the expected correct behavior?

It should always give the 404 page, regardless of whether it is non-existent or just privileged. Note: this is the behaviour of github and gitea / forgejo, and is much better behaviour because the user is given the opportunity to check their spelling, instead of being confused on why they need to login. I never like the idea of a login wall.

Forgejo example error message: The page you are trying to reach either does not exist or you are not authorized to view it.

Relevant logs and/or screenshots

Not relevant.

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   3.0.6p216
Gem Version:    3.4.13
Bundler Version:2.4.13
Rake Version:   13.0.6
Redis Version:  6.2.11
Sidekiq Version:6.5.7
Go Version:     unknown

GitLab information
Version:        16.0.1
Revision:       34d6370bacd
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     13.8
URL:            https://lily-is.land
HTTP Clone URL: https://lily-is.land/some-group/some-project.git
SSH Clone URL:  git@lily-is.land:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        14.20.0
Repository storages:
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.20.0 ? ... OK (14.20.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Cable config exists? ... yes Resque config exists? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 2/1 ... yes 6/2 ... yes 7/3 ... yes 7/4 ... yes 10/6 ... yes 10/7 ... yes 10/8 ... yes 10/9 ... yes 5/10 ... yes 5/11 ... yes 5/12 ... yes 7/13 ... yes 5/16 ... yes 10/17 ... yes 13/18 ... yes 5/19 ... yes 5/20 ... yes 10/21 ... yes 17/22 ... yes 13/23 ... yes 13/24 ... yes 14/25 ... yes 13/26 ... yes 5/27 ... yes 20/28 ... yes 12/29 ... yes 13/30 ... yes 21/31 ... yes 24/32 ... yes 13/34 ... yes 13/35 ... yes 62/36 ... yes 62/37 ... yes 5/38 ... yes 14/39 ... yes 12/40 ... yes 68/41 ... yes 13/42 ... yes 72/43 ... yes 71/44 ... yes 12/45 ... yes 72/46 ... yes 72/47 ... yes 14/50 ... yes 13/51 ... yes 85/52 ... yes 13/53 ... yes 13/54 ... yes 13/56 ... yes 5/58 ... yes 104/59 ... yes 104/60 ... yes 10/1043 ... yes 10/1044 ... yes Redis version >= 6.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (3.0.6) Git user has default SSH configuration? ... yes Active users: ... 22 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Edited by No.