Skip to content

Add missing security specs for raw snippet access

What does this MR do?

It extends the project snippets access security specs to cover raw snippet paths as well.

When I was researching snippets for !7256 (merged), I noticed that specs existed for the HTML show view of project snippets but not the raw view. Seeing as this is a spec that is checking for access regressions on places where sensitive information might be kept, I thought it would be a good idea to cover the raw snippets access too.

To balance out the karma of adding in extra tests I also changed the tests to all use an empty_project spec.

Are there points in the code the reviewer needs to double check?

With the aim of making the specs easier to read, I restructured some of them to use context blocks for each type of snippet.

I've used the same access rights defined for the show snippet paths for the raw snippet access.

Why was this MR needed?

To catch security regressions on raw snippet access for projects.

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Merge request reports