Skip to content

Return 404 when unauthorised to access resources#1494

Open
Callum027 wants to merge 1 commit intognocchixyz:masterfrom
Callum027:404-on-wrong-project
Open

Return 404 when unauthorised to access resources#1494
Callum027 wants to merge 1 commit intognocchixyz:masterfrom
Callum027:404-on-wrong-project

Conversation

@Callum027
Copy link
Copy Markdown
Contributor

@Callum027 Callum027 commented Mar 21, 2026

When a user is not authorised to access a specific resource (e.g. did not create the resource, or not part of the project that owns the resource, or the project that created the resource), they should not be able to enumerate the resource in any way.

To prevent such users from inferring the existence of resources they should not have access to, change the policy enforcement for get resource such that it returns 404 Not Found instead of 403 Forbidden in these cases.

@Callum027 Callum027 force-pushed the 404-on-wrong-project branch 3 times, most recently from dc91177 to 018fe3b Compare March 22, 2026 00:08
@Callum027 Callum027 changed the title Return 404 when projects do not match Return 404 when unauthorised to access resources Mar 22, 2026
@Callum027 Callum027 force-pushed the 404-on-wrong-project branch 6 times, most recently from 35183d8 to b40356f Compare March 22, 2026 22:02
When a user is not authorised to access a specific resource (e.g. did not create the resource, or not part of the project that owns the resource, or the project that created the resource), they should not be able to enumerate the resource in any way.

To prevent such users from inferring the existence of resources they should not have access to, change the policy enforcement for `get resource` such that it returns `404 Not Found` instead of `403 Forbidden` in these cases.
@Callum027 Callum027 force-pushed the 404-on-wrong-project branch from b40356f to 77b7fbf Compare March 22, 2026 22:38
}

@staticmethod
def enforce_resource_policy(request,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need some logging in this method. This would help us when troubleshooting issues. I mean, so operators can easily spot such situations. The logs can be in DEBUG level, in my opinion.

Copy link
Copy Markdown
Contributor

@tobias-urdin tobias-urdin left a comment

Choose a reason for hiding this comment

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

LGTM, let me know if it's good to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants