fix security problem
This commit is contained in:
parent
3048e73cc9
commit
34b74ff308
|
@ -499,6 +499,10 @@ class AnnouncementsController < ApplicationController
|
||||||
@url = request.path
|
@url = request.path
|
||||||
begin
|
begin
|
||||||
file = BulletinFile.find(params[:id])
|
file = BulletinFile.find(params[:id])
|
||||||
|
if File.basename(file.file.path) != URI.decode(params[:f_name])
|
||||||
|
render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html'
|
||||||
|
return
|
||||||
|
end
|
||||||
@url = file.file.url
|
@url = file.file.url
|
||||||
if file.can_access?(OrbitHelper.current_user)
|
if file.can_access?(OrbitHelper.current_user)
|
||||||
@path = file.file.path rescue ""
|
@path = file.file.path rescue ""
|
||||||
|
|
|
@ -39,7 +39,7 @@ Rails.application.routes.draw do
|
||||||
get '/xhr/announcements/announcement.json', to: 'bulletins#get_bulletins'
|
get '/xhr/announcements/announcement.json', to: 'bulletins#get_bulletins'
|
||||||
get '/xhr/panel/announcement/widget/sync_data' => 'announcements#show_widget'
|
get '/xhr/panel/announcement/widget/sync_data' => 'announcements#show_widget'
|
||||||
get '/xhr/announcements/:slug_title-:uid/comment', to: 'announcements#comment'
|
get '/xhr/announcements/:slug_title-:uid/comment', to: 'announcements#comment'
|
||||||
get '/xhr/announcements/file/:id/*f_name' => 'announcements#get_file'
|
get '/xhr/announcements/file/:id/*f_name', to: 'announcements#get_file', format: false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue