Skip to content

Snippets can be accessed from another project

Summary

Snippets can be accessed using URLs which are not canonical, including from seemingly other, completely unrelated, projects.

Permission checks seems to be handled correctly, but I wasn't able to test all combinations. To be on the safe side, I marked this issue as confidential. Feel free to unmark it if it wasn't necessary.

Steps to reproduce

  1. Create a snippet in any project
  2. Visit <gitlab instance url>/path/to/any/other/project/-/snippets/<id of the snippet created in 1.>

Example Project

Setup used :

What is the current bug behavior?

Snippets are accessible from another project than their own

What is the expected correct behavior?

Snippets should be accessible from their canonical URL only. Non-canonical URLs should throw a 404. (Not sure what the intended behavior in this case is, feel free to correct if needed)

Relevant logs and/or screenshots

n/a

Output of checks

This bug happens on GitLab.com

Possible fixes