Skip to content
Snippets Groups Projects
Commit 3ae5f790 authored by Felipe Artur's avatar Felipe Artur
Browse files

Render 404 when polling commit notes without having permissions

parent bfb5107a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -4,6 +4,7 @@ module NotesActions
 
included do
before_action :set_polling_interval_header, only: [:index]
before_action :noteable, only: :index
before_action :authorize_admin_note!, only: [:update, :destroy]
before_action :note_project, only: [:create]
end
Loading
Loading
@@ -188,7 +189,7 @@ module NotesActions
end
 
def noteable
@noteable ||= notes_finder.target
@noteable ||= notes_finder.target || render_404
end
 
def last_fetched_at
Loading
Loading
---
title: Render 404 when polling commit notes without having permissions
merge_request:
author:
type: fixed
Loading
Loading
@@ -105,6 +105,19 @@ describe Projects::NotesController do
expect(note_json[:discussion_html]).to be_nil
expect(note_json[:diff_discussion_html]).to be_nil
end
context 'when user cannot read commit' do
before do
allow(Ability).to receive(:allowed?).and_call_original
allow(Ability).to receive(:allowed?).with(user, :download_code, project).and_return(false)
end
it 'renders 404' do
get :index, params
expect(response).to have_gitlab_http_status(404)
end
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment