-
- Downloads
There was an error fetching the commit references. Please try again later.
Correctly check permissions when creating snippet notes
In the Snippets::NotesController the noteable was resolved and authorized through the :snippet_id, so by passing a :target_id for a different snippet it was possible to create a note on a snippet where the user would be unauthorized to do so otherwise. This fixes the problem by ignoring the :target_id and :target_type from the request, and using the same noteable for creation and authorization.
Showing
- app/controllers/concerns/notes_actions.rb 7 additions, 7 deletionsapp/controllers/concerns/notes_actions.rb
- app/controllers/snippets/notes_controller.rb 6 additions, 2 deletionsapp/controllers/snippets/notes_controller.rb
- changelogs/unreleased/security-notes-in-private-snippets.yml 5 additions, 0 deletionschangelogs/unreleased/security-notes-in-private-snippets.yml
- spec/controllers/projects/notes_controller_spec.rb 1 addition, 1 deletionspec/controllers/projects/notes_controller_spec.rb
- spec/controllers/snippets/notes_controller_spec.rb 113 additions, 0 deletionsspec/controllers/snippets/notes_controller_spec.rb
Please register or sign in to comment