code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
def schedule_all Log.add_info(request, params.inspect) date_s = params[:date] if date_s.nil? or date_s.empty? @date = Date.today else @date = Date.parse(date_s) end if @login_user.nil? or params[:display].nil? or params[:display] == 'all' params[:display] = 'all' con = EquipmentHelper.get_scope_condition_for(@login_user) else display_type = params[:display].split('_').first display_id = params[:display].split('_').last case display_type when 'group' if @login_user.get_groups_a(true).include?(display_id) con = ApplicationHelper.get_sql_like([:groups], "|#{display_id}|") end when 'team' if @login_user.get_teams_a.include?(display_id) con = ApplicationHelper.get_sql_like([:teams], "|#{display_id}|") end end end
CWE-89
0
def supplied_file_media_types @supplied_file_media_types ||= MIME::Types.type_for(@name).collect(&:media_type) end
CWE-79
1
def rs256_decode_key(kid) jwks_x5c = jwks_key(:x5c, kid) if jwks_x5c.nil? raise OmniAuth::Auth0::TokenValidationError.new("Could not find a public key for Key ID (kid) '#{kid}''") end jwks_public_cert(jwks_x5c.first) end
CWE-347
25
def opposite_direction direction.to_sym == :asc ? :desc : :asc end
CWE-89
0
it 'should return nil if there is not key' do expect(jwt_validator.jwks_key(:auth0, jwks_kid)).to eq(nil) end
CWE-347
25
def package_index valid_http_methods :get required_parameters :project, :repository, :arch, :package # read access permission check if params[:package] == "_repository" prj = DbProject.get_by_name params[:project], use_source=false else pkg = DbPackage.get_by_project_and_name params[:project], params[:package], use_source=false end pass_to_backend end
CWE-434
5
it 'is possible to specify a custom formatter' do get '/' expect(last_response.body).to eq('{:custom_formatter=>"rain!"}') end
CWE-79
1
def add_label options, f, attr label_size = options.delete(:label_size) || "col-md-2" required_mark = check_required(options, f, attr) label = options[:label] == :none ? '' : options.delete(:label) label ||= ((clazz = f.object.class).respond_to?(:gettext_translation_for_attribute_name) && s_(clazz.gettext_translation_for_attribute_name attr)) if f label = label.present? ? label_tag(attr, "#{label}#{required_mark}".html_safe, :class => label_size + " control-label") : '' label end
CWE-79
1
def mapped_content_type Paperclip.options[:content_type_mappings][filename_extension] end
CWE-79
1
def self.find_term(user_id, start_date, end_date) SqlHelper.validate_token([user_id]) start_s = start_date.strftime(Schedule::SYS_DATE_FORM) end_s = end_date.strftime(Schedule::SYS_DATE_FORM) con = "(user_id=#{user_id}) and (date >= '#{start_s}') and (date <= '#{end_s}')" ary = Timecard.where(con).order('date ASC').to_a timecards_h = Hash.new unless ary.nil? ary.each do |timecard| timecards_h[timecard.date.strftime(Schedule::SYS_DATE_FORM)] = timecard end end return timecards_h end
CWE-89
0
def gate_process HistoryHelper.keep_last(request) @login_user = User.find(session[:login_user_id]) begin if @login_user.nil? \ or @login_user.time_zone.nil? or @login_user.time_zone.empty? unless THETIS_USER_TIMEZONE_DEFAULT.nil? or THETIS_USER_TIMEZONE_DEFAULT.empty? Time.zone = THETIS_USER_TIMEZONE_DEFAULT end else Time.zone = @login_user.time_zone end rescue => evar logger.fatal(evar.to_s) end end
CWE-89
0
def self.get_default_for(user_id, xtype=nil) SqlHelper.validate_token([user_id, xtype]) con = [] con << "(user_id=#{user_id})" con << '(is_default=1)' con << "(xtype='#{xtype}')" unless xtype.blank? where = '' unless con.nil? or con.empty? where = 'where ' + con.join(' and ') end mail_accounts = MailAccount.find_by_sql('select * from mail_accounts ' + where + ' order by xorder ASC, title ASC') if mail_accounts.nil? or mail_accounts.empty? return nil else return mail_accounts.first end end
CWE-89
0
def self.on_desktop?(user, xtype, target_id) return false if user.nil? or xtype.nil? or target_id.nil? SqlHelper.validate_token([xtype, target_id]) con = "(user_id=#{user.id}) and (xtype='#{xtype}') and (target_id=#{target_id})" begin toy = Toy.where(con).first rescue => evar Log.add_error(nil, evar) end return (!toy.nil?) end
CWE-89
0
def self.get_carried_over(user_id, year) SqlHelper.validate_token([user_id, year]) yaml = ApplicationHelper.get_config_yaml unless yaml[:timecard].nil? paidhld_carry_over = yaml[:timecard]['paidhld_carry_over'] end return 0 if paidhld_carry_over.nil? or paidhld_carry_over.empty? or paidhld_carry_over == PaidHoliday::CARRY_OVER_NONE begin con = "(user_id=#{user_id}) and (year < #{year})" paidhlds = PaidHoliday.where(con).order('year ASC').to_a rescue end return 0 if paidhlds.nil? or paidhlds.empty? sum = 0 year_begins_from, month_begins_at = TimecardsHelper.get_fiscal_params if paidhld_carry_over == PaidHoliday::CARRY_OVER_1_YEAR last_carried_out = 0 for y in paidhlds.first.year .. year - 1 paidhld = paidhlds.find { |hld| hld.year == y } given_num = (paidhld.nil?)?0:paidhld.num start_date, end_date = TimecardsHelper.get_year_span(y, year_begins_from, month_begins_at) applied_paid_hlds = Timecard.applied_paid_hlds(user_id, start_date, end_date) if applied_paid_hlds >= last_carried_out last_carried_out = given_num - (applied_paid_hlds - last_carried_out) else last_carried_out = given_num end end return last_carried_out elsif paidhld_carry_over == PaidHoliday::CARRY_OVER_NO_EXPIRATION paidhlds.each do |paidhld| sum += paidhld.num end start_date, dummy = TimecardsHelper.get_year_span(paidhlds.first.year, year_begins_from, month_begins_at) dummy, end_date = TimecardsHelper.get_year_span(year - 1, year_begins_from, month_begins_at) applied_paid_hlds = Timecard.applied_paid_hlds(user_id, start_date, end_date) return (sum - applied_paid_hlds) else return 0 end end
CWE-89
0
def exclude_from_group Log.add_info(request, params.inspect) if params[:group_id].nil? or params[:group_id].empty? render(:partial => 'ajax_groups', :layout => false) return end group_id = params[:group_id] begin @user = User.find(params[:id]) unless @user.nil? if @user.exclude_from(group_id) @user.save if @user.id == @login_user.id @login_user = @user end end end rescue => evar Log.add_error(request, evar) end render(:partial => 'ajax_groups', :layout => false) end
CWE-89
0
def update_images_order Log.add_info(request, params.inspect) order_ary = params[:images_order] item = Item.find(params[:id]) item.images_without_content.each do |img| class << img def record_timestamps; false; end end img.update_attribute(:xorder, order_ary.index(img.id.to_s) + 1) class << img remove_method :record_timestamps end end render(:text => '') rescue => evar Log.add_error(request, evar) render(:text => evar.to_s) end
CWE-89
0
def test_html5_data_attributes_without_hyphenation assert_equal("<div data-author_id='123' data-biz='baz' data-foo='bar'></div>\n", render("%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}", :hyphenate_data_attrs => false)) assert_equal("<div data-one_plus_one='2'></div>\n", render("%div{:data => {:one_plus_one => 1+1}}", :hyphenate_data_attrs => false)) assert_equal("<div data-foo='Here&#x0027;s a \"quoteful\" string.'></div>\n", render(%{%div{:data => {:foo => %{Here's a "quoteful" string.}}}},
CWE-79
1
def self.update_for(user_id, fiscal_year, num) SqlHelper.validate_token([user_id, fiscal_year]) if num <= 0 con = [] con << "(user_id=#{user_id})" con << "(year=#{fiscal_year})" PaidHoliday.destroy_all(con.join(' and ')) return end paid_holiday = PaidHoliday.get_for(user_id, fiscal_year) if paid_holiday.nil? paid_holiday = PaidHoliday.new paid_holiday.user_id = user_id paid_holiday.year = fiscal_year paid_holiday.num = num paid_holiday.save! else paid_holiday.update_attribute(:num, num) end end
CWE-89
0
it "sanitizes crazy params" do cl = subject.build_command_line("true", modified_params) expect(cl).to eq "true --user bob --pass P@\\$sw0\\^\\&\\ \\|\\<\\>/-\\+\\*d\\% --db --desc=Some\\ Description --symkey --symkey-dash pkg1 some\\ pkg --pool 123 --pool 456" end
CWE-78
6
def set_auth_groups Log.add_info(request, params.inspect) @folder = Folder.find(params[:id]) if Folder.check_user_auth(@folder.id, @login_user, 'w', true) read_groups = [] write_groups = [] groups_auth = params[:groups_auth] unless groups_auth.nil? groups_auth.each do |auth_param| user_id = auth_param.split(':').first auths = auth_param.split(':').last.split('+') if auths.include?('r') read_groups << user_id end if auths.include?('w') write_groups << user_id end end end @folder.set_read_groups read_groups @folder.set_write_groups write_groups @folder.save flash[:notice] = t('msg.register_success') else flash[:notice] = 'ERROR:' + t('folder.need_auth_to_modify') end @groups = Group.where(nil).to_a render(:partial => 'ajax_auth_groups', :layout => false) rescue => evar Log.add_error(request, evar) render(:partial => 'ajax_auth_groups', :layout => false) end
CWE-89
0
def self.get_team_folder(team_id) SqlHelper.validate_token([team_id]) begin return Folder.where("(owner_id=#{team_id}) and (xtype='#{Folder::XTYPE_TEAM}')").first rescue => evar Log.add_error(nil, evar) return nil end end
CWE-89
0
def self.get_using_size(mail_account_id, add_con=nil) SqlHelper.validate_token([mail_account_id]) con = [] con << "(mail_account_id=#{mail_account_id})" con << "(#{add_con})" unless add_con.nil? or add_con.empty? return (Email.count_by_sql("select SUM(size) from emails where #{con.join(' and ')}") || 0) end
CWE-89
0
def gate_process HistoryHelper.keep_last(request) @login_user = User.find_by_id(session[:login_user_id]) begin if @login_user.nil? \ or @login_user.time_zone.nil? or @login_user.time_zone.empty? unless THETIS_USER_TIMEZONE_DEFAULT.nil? or THETIS_USER_TIMEZONE_DEFAULT.empty? Time.zone = THETIS_USER_TIMEZONE_DEFAULT end else Time.zone = @login_user.time_zone end rescue => evar logger.fatal(evar.to_s) end end
CWE-89
0
def html_escape(s) s = s.to_s if s.html_safe? s else s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.html_safe end end
CWE-79
1
def rename Log.add_info(request, params.inspect) @group = Group.find(params[:id]) unless params[:thetisBoxEdit].nil? or params[:thetisBoxEdit].empty? @group.rename params[:thetisBoxEdit] end render(:partial => 'ajax_group_name', :layout => false) rescue => evar Log.add_error(request, evar) render(:partial => 'ajax_group_name', :layout => false) end
CWE-89
0
def get_mail_content Log.add_info(request, params.inspect) mail_id = params[:id] begin @email = Email.find(mail_id) render(:partial => 'ajax_mail_content', :layout => false) rescue => evar Log.add_error(nil, evar) render(:text => '') end end
CWE-89
0
def test_new_attribute_interpolation assert_equal("<a href='12'>bar</a>\n", render('%a(href="1#{1 + 1}") bar')) assert_equal("<a href='2: 2, 3: 3'>bar</a>\n", render(%q{%a(href='2: #{1 + 1}, 3: #{foo}') bar}, :locals => {:foo => 3})) assert_equal(%Q{<a href='1\#{1 + 1}'>bar</a>\n}, render('%a(href="1\#{1 + 1}") bar')) end def test_truthy_new_attributes assert_equal("<a href='href'>bar</a>\n", render("%a(href) bar", :format => :xhtml)) assert_equal("<a bar='baz' href>bar</a>\n", render("%a(href bar='baz') bar", :format => :html5)) assert_equal("<a href>bar</a>\n", render("%a(href=true) bar")) assert_equal("<a>bar</a>\n", render("%a(href=false) bar")) end def test_new_attribute_parsing assert_equal("<a a2='b2'>bar</a>\n", render("%a(a2=b2) bar", :locals => {:b2 => 'b2'})) assert_equal(%Q{<a a='foo"bar'>bar</a>\n}, render(%q{%a(a="#{'foo"bar'}") bar})) #' assert_equal(%Q{<a a="foo'bar">bar</a>\n}, render(%q{%a(a="#{"foo'bar"}") bar})) #' assert_equal(%Q{<a a='foo"bar'>bar</a>\n}, render(%q{%a(a='foo"bar') bar})) assert_equal(%Q{<a a="foo'bar">bar</a>\n}, render(%q{%a(a="foo'bar") bar})) assert_equal("<a a:b='foo'>bar</a>\n", render("%a(a:b='foo') bar")) assert_equal("<a a='foo' b='bar'>bar</a>\n", render("%a(a = 'foo' b = 'bar') bar")) assert_equal("<a a='foo' b='bar'>bar</a>\n", render("%a(a = foo b = bar) bar", :locals => {:foo => 'foo', :bar => 'bar'})) assert_equal("<a a='foo'>(b='bar')</a>\n", render("%a(a='foo')(b='bar')")) assert_equal("<a a='foo)bar'>baz</a>\n", render("%a(a='foo)bar') baz")) assert_equal("<a a='foo'>baz</a>\n", render("%a( a = 'foo' ) baz")) end def test_new_attribute_escaping assert_equal(%Q{<a a='foo " bar'>bar</a>\n}, render(%q{%a(a="foo \" bar") bar})) assert_equal(%Q{<a a='foo \\" bar'>bar</a>\n}, render(%q{%a(a="foo \\\\\" bar") bar}))
CWE-79
1
def render_step(the_step, options = {}) if the_step.nil? || the_step.to_s == Wicked::FINISH_STEP redirect_to_finish_wizard options else render the_step, options end end
CWE-22
2
def order_by order_option = '' if self.order_column direction = self.order_direction || 'ASC' order_option = "#{self.order_column} #{direction}" end order_option.present? ? order_option : @@default_order end
CWE-89
0
def process_preflight(env) result = Result.preflight(env) resource, error = match_resource(env) unless resource result.miss(error) return {} end return resource.process_preflight(env, result) end
CWE-22
2
it "sanitizes Pathname param value" do cl = subject.build_command_line("true", nil => [Pathname.new("/usr/bin/ruby")]) expect(cl).to eq "true /usr/bin/ruby" end
CWE-78
6
def initialize(file, name) @file = file @name = name end
CWE-79
1
def match_resource(env) path = env[PATH_INFO] origin = env[HTTP_ORIGIN] origin_matched = false all_resources.each do |r| if r.allow_origin?(origin, env) origin_matched = true if found = r.match_resource(path, env) return [found, nil] end end end [nil, origin_matched ? Result::MISS_NO_PATH : Result::MISS_NO_ORIGIN] end
CWE-22
2
def index respond_to do |format| format.json do dir = params[:dir] dir = 'desc' unless SORT_DIRECTIONS.include?(dir.try(:upcase)) @occurrences = @bug.occurrences.order("occurred_at #{dir}").limit(50) last = params[:last].present? ? @bug.occurrences.find_by_number(params[:last]) : nil @occurrences = @occurrences.where(infinite_scroll_clause('occurred_at', dir, last, 'occurrences.number')) if last render json: decorate(@occurrences) end format.atom { @occurrences = @bug.occurrences.order('occurred_at DESC').limit(100) } # index.atom.builder end end
CWE-94
14
def self.search_by_puppetclass(key, operator, value) conditions = "puppetclasses.name #{operator} '#{value_to_sql(operator, value)}'" hosts = Host.my_hosts.all(:conditions => conditions, :joins => :puppetclasses, :select => 'DISTINCT hosts.id').map(&:id) host_groups = Hostgroup.all(:conditions => conditions, :joins => :puppetclasses, :select => 'DISTINCT hostgroups.id').map(&:id) opts = '' opts += "hosts.id IN(#{hosts.join(',')})" unless hosts.blank? opts += " OR " unless hosts.blank? || host_groups.blank? opts += "hostgroups.id IN(#{host_groups.join(',')})" unless host_groups.blank? opts = "hosts.id < 0" if hosts.blank? && host_groups.blank? return {:conditions => opts, :include => :hostgroup} end
CWE-89
0
def check_owner return if params[:id].nil? or params[:id].empty? or @login_user.nil? mail_account = MailAccount.find(params[:id]) if !@login_user.admin?(User::AUTH_MAIL) and mail_account.user_id != @login_user.id Log.add_check(request, '[check_owner]'+request.to_s) flash[:notice] = t('msg.need_to_be_owner') redirect_to(:controller => 'desktop', :action => 'show') end end
CWE-89
0
def self.get_group_folder(group_id) SqlHelper.validate_token([group_id]) begin return Folder.where("(owner_id=#{group_id}) and (xtype='#{Folder::XTYPE_GROUP}')").first rescue => evar Log.add_error(nil, evar) return nil end end
CWE-89
0
def update_q_ctrl Log.add_info(request, params.inspect) item_id = params[:item_id] q_code = params[:q_code] q_param = params[:q_param] cap = params[:caption] yaml = Research.get_config_yaml type = q_param.split(':').first vals = q_param[type.length+1 .. -1] yaml[q_code] = {:item_id => item_id, :type => type, :values => vals, :caption => cap.to_s } Research.save_config_yaml yaml render(:text => '') rescue => evar Log.add_error(request, evar) render(:text => evar.to_s) end
CWE-89
0
def self.prepare_rdoc root debug, verbose = false, false prepare_script = Pathname.new(Rails.root) + "script/rdoc_prepare_script.rb" if prepare_script.executable? dirs = Environment.puppetEnvs.values.join(":").split(":").uniq.sort.join(" ") puts "Running #{prepare_script} #{dirs}" if debug location = %x{#{prepare_script} #{dirs}} if $? == 0 root = location.chomp puts "Relocated modules to #{root}" if verbose end else puts "No executable #{prepare_script} found so using the uncopied module sources" if verbose end root end def as_json(options={}) super({:only => [:name, :id], :include => [:lookup_keys]}) end def self.search_by_host(key, operator, value) conditions = "hosts.name #{operator} '#{value_to_sql(operator, value)}'" direct = Puppetclass.all(:conditions => conditions, :joins => :hosts, :select => 'puppetclasses.id').map(&:id).uniq hostgroup = Hostgroup.joins(:hosts).where(conditions).first indirect = HostgroupClass.where(:hostgroup_id => hostgroup.path_ids).pluck(:puppetclass_id).uniq return { :conditions => "1=0" } if direct.blank? && indirect.blank? puppet_classes = (direct + indirect).uniq { :conditions => "puppetclasses.id IN(#{puppet_classes.join(',')})" } end def self.value_to_sql(operator, value) return value if operator !~ /LIKE/i return value.tr_s('%*', '%') if (value ~ /%|\*/) return "%#{value}%" end end
CWE-89
0
def update @campaign.update(campaign_params) end
CWE-79
1
def ffi_lib(*names) raise LoadError.new("library names list must not be empty") if names.empty? lib_flags = defined?(@ffi_lib_flags) ? @ffi_lib_flags : FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL ffi_libs = names.map do |name| if name == FFI::CURRENT_PROCESS FFI::DynamicLibrary.open(nil, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL) else libnames = (name.is_a?(::Array) ? name : [ name ]).map { |n| [ n, FFI.map_library_name(n) ].uniq }.flatten.compact lib = nil errors = {} libnames.each do |libname| begin orig = libname lib = FFI::DynamicLibrary.open(libname, lib_flags) break if lib rescue Exception => ex ldscript = false if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short|invalid file format)/ if File.read($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/ libname = $1 ldscript = true end end if ldscript retry else # TODO better library lookup logic libname = libname.to_s unless libname.start_with?("/") path = ['/usr/lib/','/usr/local/lib/'].find do |pth| File.exist?(pth + libname) end if path libname = path + libname retry end end libr = (orig == libname ? orig : "#{orig} #{libname}") errors[libr] = ex end end end if lib.nil? raise LoadError.new(errors.values.join(".\n")) end # return the found lib lib end end @ffi_libs = ffi_libs end
CWE-426
70
def email user_info['email'] || id_info['email'] end
CWE-290
85
def authorized?(request) origin_host = request.get_header("HTTP_HOST")&.slice(VALID_ORIGIN_HOST, 1) || "" forwarded_host = request.x_forwarded_host&.slice(VALID_FORWARDED_HOST, 1) || "" @permissions.allows?(origin_host) && (forwarded_host.blank? || @permissions.allows?(forwarded_host)) end
CWE-601
11
it 'should escape the content of removed `xmp` elements' do Sanitize.fragment('<xmp>hello! <script>alert(0)</script></xmp>') .must_equal 'hello! &lt;script&gt;alert(0)&lt;/script&gt;' end
CWE-79
1
def initialize(name, value = nil, charset = 'utf-8') case when name =~ /:/ # Field.new("field-name: field data") @charset = value.blank? ? charset : value @name, @value = split(name) when name !~ /:/ && value.blank? # Field.new("field-name") @name = name @value = nil @charset = charset else # Field.new("field-name", "value") @name = name @value = value @charset = charset end
CWE-93
33
def delete_attachment Log.add_info(request, '') # Not to show passwords. return unless request.post? target_user = nil user_id = params[:user_id] zeptair_id = params[:zeptair_id] attachment_id = params[:attachment_id] SqlHelper.validate_token([user_id, zeptair_id, attachment_id]) unless user_id.blank? if @login_user.admin?(User::AUTH_ZEPTAIR) or @login_user.id.to_s == user_id.to_s target_user = User.find(user_id) end end unless zeptair_id.blank? target_user = User.where("zeptair_id=#{zeptair_id}").first unless @login_user.admin?(User::AUTH_ZEPTAIR) or @login_user.id == target_user.id target_user = nil end end if target_user.nil? if attachment_id.blank? query unless @post_items.nil? @post_items.each do |post_item| post_item.attachments_without_content.each do |attach| attach.destroy end post_item.update_attribute(:updated_at, Time.now) end end else attach = Attachment.find(attachment_id) item = Item.find(attach.item_id) if !@login_user.admin?(User::AUTH_ZEPTAIR) and item.user_id != @login_user.id raise t('msg.need_to_be_owner') end if item.xtype != Item::XTYPE_ZEPTAIR_POST raise t('msg.system_error') end attach.destroy item.update_attribute(:updated_at, Time.now) end else post_item = ZeptairPostHelper.get_item_for(target_user) post_item.attachments_without_content.each do |attach| attach.destroy end post_item.update_attribute(:updated_at, Time.now) end render(:text => t('msg.delete_success')) rescue => evar Log.add_error(request, evar) render(:text => 'ERROR:' + t('msg.system_error')) end
CWE-89
0
def resolve_target_path(target, reader) return target if target_uri? target # Include file is resolved relative to dir of the current include, # or base_dir if within original docfile. path = reader.document.normalize_system_path(target, reader.dir, nil, target_name: 'include file') path if ::File.file?(path) end
CWE-78
6
def self.new string_or_io from_document Nokogiri::XML(string_or_io) end
CWE-611
13
def supplied_file_content_types @supplied_file_content_types ||= MIME::Types.type_for(@name).collect(&:content_type) end
CWE-79
1
def get_users if params[:action] == 'get_users' Log.add_info(request, params.inspect) end @group_id = params[:id] =begin # @users = Group.get_users(params[:id]) =end # FEATURE_PAGING_IN_TREE >>> con = ['User.id > 0'] unless @group_id.nil? if @group_id == '0' con << "((groups like '%|0|%') or (groups is null))" else con << ApplicationHelper.get_sql_like([:groups], "|#{@group_id}|") end end unless params[:keyword].blank? key_array = params[:keyword].split(nil) key_array.each do |key| con << SqlHelper.get_sql_like([:name, :email, :fullname, :address, :organization, :tel1, :tel2, :tel3, :fax, :url, :postalcode, :title], key) end end where = '' unless con.empty? where = ' where ' + con.join(' and ') end order_by = nil @sort_col = params[:sort_col] @sort_type = params[:sort_type] if @sort_col.blank? or @sort_type.blank? @sort_col = 'OfficialTitle.xorder' @sort_type = 'ASC' end SqlHelper.validate_token([@sort_col, @sort_type]) order_by = @sort_col + ' ' + @sort_type if @sort_col == 'OfficialTitle.xorder' order_by = '(OfficialTitle.xorder is null) ' + @sort_type + ', ' + order_by else order_by << ', (OfficialTitle.xorder is null) ASC, OfficialTitle.xorder ASC' end if @sort_col != 'name' order_by << ', name ASC' end sql = 'select distinct User.* from (users User left join user_titles UserTitle on User.id=UserTitle.user_id)' sql << ' left join official_titles OfficialTitle on UserTitle.official_title_id=OfficialTitle.id' sql << where + ' order by ' + order_by @user_pages, @users, @total_num = paginate_by_sql(User, sql, 50) # FEATURE_PAGING_IN_TREE <<< session[:group_id] = @group_id session[:group_option] = 'user' render(:partial => 'ajax_group_users', :layout => false) end
CWE-89
0
def format_text(text, wrap, indent=0) result = [] work = text.dup while work.length > wrap do if work =~ /^(.{0,#{wrap}})[ \n]/ then result << $1.rstrip work.slice!(0, $&.length) else result << work.slice!(0, wrap) end end result << work if work.length.nonzero? result.join("\n").gsub(/^/, " " * indent) end
CWE-94
14
def self.delete_statistics_group(group_id) yaml = Research.get_config_yaml if yaml.nil? or yaml[:statistics].nil? return [] end groups = yaml[:statistics][:groups] return [] if groups.nil? ary = groups.split('|') ary.delete group_id.to_s ary.compact! ary.delete '' yaml[:statistics][:groups] = ary.join('|') Research.save_config_yaml yaml return ary end
CWE-89
0
it 'is valid with valid attributes' do notification = build(:notification) expect(notification).to be_valid end
CWE-79
1
detectExtension(mimeType) { if (!mimeType) { return defaultExtension; } let parts = (mimeType || '') .toLowerCase() .trim() .split('/'); let rootType = parts.shift().trim(); let subType = parts.join('/').trim(); if (mimeTypes.has(rootType + '/' + subType)) { let value = mimeTypes.get(rootType + '/' + subType); if (Array.isArray(value)) { return value[0]; } return value; } switch (rootType) { case 'text': return 'txt'; default: return 'bin'; } }
CWE-88
3
def self.get_for(user_id, date) begin con = "(user_id=#{user_id}) and (date='#{date}')" return Timecard.where(con).first rescue end return nil end
CWE-89
0
it "returns the right category group permissions for a regular user ordered by ascending group name" do json = described_class.new(category, scope: Guardian.new(user), root: false).as_json expect(json[:group_permissions]).to eq([ { permission_type: CategoryGroup.permission_types[:readonly], group_name: group.name }, { permission_type: CategoryGroup.permission_types[:full], group_name: user_group.name }, ]) end
CWE-276
45
it "should raise an error if the image fails to be processed when downloaded" do stub_request(:get, "www.example.com/test.jpg").to_return(body: File.read(file_path("test.jpg"))) expect(running { @instance.remote_image_url = "http://www.example.com/test.jpg" }).to raise_error(CarrierWave::ProcessingError) end
CWE-918
16
def team Log.add_info(request, params.inspect) date_s = params[:date] if date_s.nil? or date_s.empty? @date = Date.today else @date = Date.parse(date_s) end begin team = Team.find(params[:id]) team_users = team.get_users_a rescue => evar Log.add_error(request, evar) end @user_schedule_hash = {} unless team_users.nil? @holidays = Schedule.get_holidays team_users.each do |user_id| @user_schedule_hash[user_id] = Schedule.get_somebody_week(@login_user, user_id, @date, @holidays) end end params[:display] = params[:action] + '_' + params[:id] end
CWE-89
0
def params super rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e raise BadRequest, "Invalid query parameters: #{e.message}" end
CWE-79
1
def self.get_account_roots_for(user) return nil if user.nil? if user.kind_of?(User) user_id = user.id else user_id = user.to_s end SqlHelper.validate_token([user_id]) con = [] con << "(user_id=#{user_id})" con << "(xtype='#{MailFolder::XTYPE_ACCOUNT_ROOT}')" order_by = 'xorder ASC, id ASC' return MailFolder.where(con.join(' and ')).order(order_by).to_a end
CWE-89
0
def self.normalize_key_names(options) options = options.dup if options.key?(:key_prefix) && !options.key?(:namespace) options[:namespace] = options.delete(:key_prefix) # RailsSessionStore end options[:raw] = !options[:marshalling] options end
CWE-502
15
def create Log.add_info(request, params.inspect) parent_id = params[:selectedFolderId] if params[:thetisBoxEdit].nil? or params[:thetisBoxEdit].empty? @mail_folder = nil else @mail_folder = MailFolder.new @mail_folder.name = params[:thetisBoxEdit] @mail_folder.parent_id = parent_id @mail_folder.user_id = @login_user.id @mail_folder.xtype = nil @mail_folder.save! end render(:partial => 'ajax_folder_entry', :layout => false) end
CWE-89
0
def update_attachments_order Log.add_info(request, params.inspect) order_ary = params[:attachments_order] item = Item.find(params[:id]) item.attachments_without_content.each do |attach| class << attach def record_timestamps; false; end end attach.update_attribute(:xorder, order_ary.index(attach.id.to_s) + 1) class << attach remove_method :record_timestamps end end render(:text => '') rescue => evar Log.add_error(request, evar) render(:text => evar.to_s) end
CWE-89
0
def remove_application(user_ids) return if user_ids.nil? or user_ids.empty? SqlHelper.validate_token([user_ids]) con = ["(xtype='#{Comment::XTYPE_APPLY}')"] con << "(item_id=#{self.item_id})" user_con_a = [] user_ids.each do |user_id| user_con_a << "(user_id=#{user_id})" end con << '(' + user_con_a.join(' or ') + ')' Comment.destroy_all(con.join(' and ')) end
CWE-89
0
def get_auth_users Log.add_info(request, params.inspect) begin @folder = Folder.find(params[:id]) rescue @folder = nil end @users = [] session[:folder_id] = params[:id] if !@login_user.nil? and (@login_user.admin?(User::AUTH_FOLDER) or (!@folder.nil? and @folder.in_my_folder_of?(@login_user.id))) render(:partial => 'ajax_auth_users', :layout => false) else render(:partial => 'ajax_auth_disp', :layout => false) end end
CWE-89
0
def self.find_by_sql_with_limit(sql, offset, limit) sql = sanitize_sql(sql) add_limit!(sql, {:limit => limit, :offset => offset}) find_by_sql(sql) end
CWE-89
0
it "with dofollowify disabled, links should be nofollowed" do @blog.dofollowify = false @blog.save expect(nofollowify_links('<a href="http://myblog.net">my blog</a>')). to eq('<a href="http://myblog.net" rel="nofollow">my blog</a>') end
CWE-79
1
def show_owners name response = rubygems_api_request :get, "api/v1/gems/#{name}/owners.yaml" do |request| request.add_field "Authorization", api_key end with_response response do |resp| owners = YAML.load resp.body say "Owners for gem: #{name}" owners.each do |owner| say "- #{owner['email'] || owner['handle'] || owner['id']}" end end end
CWE-502
15
def output_versions output, versions versions.each do |gem_name, matching_tuples| matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse platforms = Hash.new { |h,version| h[version] = [] } matching_tuples.each do |n, _| platforms[n.version] << n.platform if n.platform end seen = {} matching_tuples.delete_if do |n,_| if seen[n.version] then true else seen[n.version] = true false end end output << make_entry(matching_tuples, platforms) end end
CWE-94
14
def read_body(socket, block) return unless socket if tc = self['transfer-encoding'] case tc when /chunked/io then read_chunked(socket, block) else raise HTTPStatus::NotImplemented, "Transfer-Encoding: #{tc}." end elsif self['content-length'] || @remaining_size @remaining_size ||= self['content-length'].to_i while @remaining_size > 0 sz = [@buffer_size, @remaining_size].min break unless buf = read_data(socket, sz) @remaining_size -= buf.bytesize block.call(buf) end if @remaining_size > 0 && @socket.eof? raise HTTPStatus::BadRequest, "invalid body size." end elsif BODY_CONTAINABLE_METHODS.member?(@request_method) && !@socket.eof raise HTTPStatus::LengthRequired end
CWE-444
41
def get_attachment Log.add_info(request, params.inspect) attach = Attachment.find(params[:id]) if attach.nil? redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html') return end parent_item = attach.item || ((attach.comment.nil?) ? nil : attach.comment.item) if parent_item.nil? or !parent_item.check_user_auth(@login_user, 'r', true) Log.add_check(request, '[Item.check_user_auth]'+request.to_s) redirect_to(:controller => 'frames', :action => 'http_error', :id => '401') return end attach_name = attach.name agent = request.env['HTTP_USER_AGENT'] unless agent.nil? ie_ver = nil agent.scan(/\sMSIE\s?(\d+)[.](\d+)/){|m| ie_ver = m[0].to_i + (0.1 * m[1].to_i) } attach_name = CGI::escape(attach_name) unless ie_ver.nil? end begin attach_location = attach.location rescue attach_location = Attachment::LOCATION_DB # for lower versions end if attach_location == Attachment::LOCATION_DIR filepath = AttachmentsHelper.get_path(attach) send_file(filepath, :filename => attach_name, :stream => true, :disposition => 'attachment') else send_data(attach.content, :type => (attach.content_type || 'application/octet-stream')+';charset=UTF-8', :disposition => 'attachment;filename="'+attach_name+'"') end end
CWE-89
0
def spoofed? if has_name? && has_extension? && media_type_mismatch? && mapping_override_mismatch? Paperclip.log("Content Type Spoof: Filename #{File.basename(@name)} (#{supplied_file_content_types}), content type discovered from file command: #{calculated_content_type}. See documentation to allow this combination.") true end end
CWE-79
1
def save_page Log.add_info(request, params.inspect) # Next page pave_val = params[:page].to_i + 1 @page = sprintf('%02d', pave_val) page_num = Dir.glob(File.join(Research.page_dir, "_q[0-9][0-9].html.erb")).length unless params[:research].nil? params[:research].each do |key, value| if value.instance_of?(Array) value.compact! value.delete('') if value.empty? params[:research][key] = nil else params[:research][key] = value.join("\n") + "\n" end end end end if params[:research_id].nil? or params[:research_id].empty? @research = Research.new(params.require(:research).permit(Research::PERMIT_BASE)) @research.status = Research::U_STATUS_IN_ACTON @research.update_attribute(:user_id, @login_user.id) else @research = Research.find(params[:research_id]) @research.update_attributes(params.require(:research).permit(Research::PERMIT_BASE)) end if pave_val <= page_num render(:action => 'edit_page') else tmpl_folder, tmpl_q_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_RESEARCH) if tmpl_q_folder.nil? ary = TemplatesHelper.setup_tmpl_folder tmpl_q_folder = ary[4] end items = Folder.get_items_admin(tmpl_q_folder.id, 'xorder ASC') @q_caps_h = {} unless items.nil? items.each do |item| desc = item.description next if desc.nil? or desc.empty? hash = Research.select_q_caps(desc) hash.each do |key, val| @q_caps_h[key] = val end end end render(:action => 'confirm') end rescue => evar Log.add_error(request, evar) @page = '01' render(:action => 'edit_page') end
CWE-89
0
def get_data_center_from_api_key(api_key) # Return an empty string for invalid API keys so Gibbon hits the main endpoint data_center = "" if api_key && api_key["-"] # Add a period since the data_center is a subdomain and it keeps things dry data_center = "#{api_key.split('-').last}." end data_center end
CWE-918
16
def list Log.add_info(request, params.inspect) con = [] @group_id = nil if !params[:thetisBoxSelKeeper].nil? @group_id = params[:thetisBoxSelKeeper].split(':').last elsif !params[:group_id].blank? @group_id = params[:group_id] end unless @group_id.nil? if @group_id == '0' con << "((groups like '%|0|%') or (groups is null))" else con << ApplicationHelper.get_sql_like([:groups], "|#{@group_id}|") end end where = '' unless con.empty? where = ' where ' + con.join(' and ') end order_by = nil @sort_col = params[:sort_col] @sort_type = params[:sort_type] if @sort_col.blank? or @sort_type.blank? @sort_col = 'id' @sort_type = 'ASC' end SqlHelper.validate_token([@sort_col, @sort_type]) order_by = ' order by ' + @sort_col + ' ' + @sort_type sql = 'select distinct Equipment.* from equipment Equipment' sql << where + order_by @equipment_pages, @equipment, @total_num = paginate_by_sql(Equipment, sql, 20) end
CWE-89
0
def self.get_default_for(user_id, xtype=nil) SqlHelper.validate_token([user_id, xtype]) con = [] con << "(user_id=#{user_id})" con << '(is_default=1)' con << "(xtype='#{xtype}')" unless xtype.blank? where = '' unless con.nil? or con.empty? where = 'where ' + con.join(' and ') end account_ary = MailAccount.find_by_sql('select * from mail_accounts ' + where + ' order by xorder ASC, title ASC') if account_ary.nil? or account_ary.empty? return nil else return account_ary.first end end
CWE-89
0
def get_group_users Log.add_info(request, params.inspect) @group_id = nil if !params[:thetisBoxSelKeeper].nil? @group_id = params[:thetisBoxSelKeeper].split(':').last elsif !params[:group_id].nil? and !params[:group_id].empty? @group_id = params[:group_id] end submit_url = url_for(:controller => 'schedules', :action => 'get_group_users') render(:partial => 'common/select_users', :layout => false, :locals => {:target_attr => :id, :submit_url => submit_url}) end
CWE-89
0
def check_mail_owner return if params[:id].nil? or params[:id].empty? or @login_user.nil? begin owner_id = Email.find(params[:id]).user_id rescue owner_id = -1 end if !@login_user.admin?(User::AUTH_MAIL) and owner_id != @login_user.id Log.add_check(request, '[check_mail_owner]'+request.to_s) flash[:notice] = t('msg.need_to_be_owner') redirect_to(:controller => 'desktop', :action => 'show') end end
CWE-89
0
def delete_attachment Log.add_info(request, '') # Not to show passwords. target_user = nil unless params[:user_id].blank? if @login_user.admin?(User::AUTH_ZEPTAIR) or @login_user.id.to_s == params[:user_id].to_s target_user = User.find(params[:user_id]) end end unless params[:zeptair_id].blank? target_user = User.where("zeptair_id=#{params[:zeptair_id]}").first unless @login_user.admin?(User::AUTH_ZEPTAIR) or @login_user.id == target_user.id target_user = nil end end if target_user.nil? if params[:attachment_id].blank? query unless @post_items.nil? @post_items.each do |post_item| post_item.attachments_without_content.each do |attach| attach.destroy end post_item.update_attribute(:updated_at, Time.now) end end else attach = Attachment.find(params[:attachment_id]) item = Item.find(attach.item_id) if !@login_user.admin?(User::AUTH_ZEPTAIR) and item.user_id != @login_user.id raise t('msg.need_to_be_owner') end if item.xtype != Item::XTYPE_ZEPTAIR_POST raise t('msg.system_error') end attach.destroy item.update_attribute(:updated_at, Time.now) end else post_item = ZeptairPostHelper.get_item_for(target_user) post_item.attachments_without_content.each do |attach| attach.destroy end post_item.update_attribute(:updated_at, Time.now) end render(:text => t('msg.delete_success')) rescue => evar Log.add_error(request, evar) render(:text => 'ERROR:' + t('msg.system_error')) end
CWE-89
0
def nofollowify_links(string) if this_blog.dofollowify string else string.gsub(/<a(.*?)>/i, '<a\1 rel="nofollow">') end end
CWE-79
1
it "converts to Punycode URI" do expect(subject.process_uri(uri).to_s).to eq 'http://xn--eckwd4c7cu47r2wf.jp/test.jpg' end
CWE-918
16
def test_should_sanitize_with_trailing_space raw = "display:block; " expected = "display: block;" assert_equal expected, sanitize_css(raw) end
CWE-79
1
def self.get_my_folder(user_id) SqlHelper.validate_token([user_id]) return Folder.where("(owner_id=#{user_id}) and (xtype='#{Folder::XTYPE_USER}')").first end
CWE-89
0
def make_hs256_token(payload = nil) payload = { sub: 'abc123' } if payload.nil? JWT.encode payload, client_secret, 'HS256' end
CWE-347
25
def is_a_copy?(folder_obj_cache=nil) return false if self.source_id.nil? # Exclude those created from system templates. src_item = Item.find_by_id(self.source_id) if src_item.nil? return true else return !src_item.in_system_folder?(folder_obj_cache) end end
CWE-89
0
it "should get the script it asks for" do def @bus.is_admin_lookup proc { |_| true } end get "/message-bus/_diagnostics/assets/message-bus.js" last_response.status.must_equal 200 last_response.content_type.must_equal "application/javascript;charset=UTF-8" end
CWE-22
2
def self.count_completed_users(item_id) SqlHelper.validate_token([item_id]) ack_msg = ZeptairDistHelper.completed_ack_message(item_id) return Comment.where("(item_id=#{item_id}) and (xtype='#{Comment::XTYPE_DIST_ACK}') and (message='#{ack_msg}')").count end
CWE-89
0
def test_new_attribute_interpolation assert_equal("<a href='12'>bar</a>\n", render('%a(href="1#{1 + 1}") bar')) assert_equal("<a href='2: 2, 3: 3'>bar</a>\n", render(%q{%a(href='2: #{1 + 1}, 3: #{foo}') bar}, :locals => {:foo => 3})) assert_equal(%Q{<a href='1\#{1 + 1}'>bar</a>\n}, render('%a(href="1\#{1 + 1}") bar')) end def test_truthy_new_attributes assert_equal("<a href='href'>bar</a>\n", render("%a(href) bar", :format => :xhtml)) assert_equal("<a bar='baz' href>bar</a>\n", render("%a(href bar='baz') bar", :format => :html5)) assert_equal("<a href>bar</a>\n", render("%a(href=true) bar")) assert_equal("<a>bar</a>\n", render("%a(href=false) bar")) end def test_new_attribute_parsing assert_equal("<a a2='b2'>bar</a>\n", render("%a(a2=b2) bar", :locals => {:b2 => 'b2'})) assert_equal(%Q{<a a='foo"bar'>bar</a>\n}, render(%q{%a(a="#{'foo"bar'}") bar})) #' assert_equal(%Q{<a a="foo'bar">bar</a>\n}, render(%q{%a(a="#{"foo'bar"}") bar})) #' assert_equal(%Q{<a a='foo"bar'>bar</a>\n}, render(%q{%a(a='foo"bar') bar})) assert_equal(%Q{<a a="foo'bar">bar</a>\n}, render(%q{%a(a="foo'bar") bar})) assert_equal("<a a:b='foo'>bar</a>\n", render("%a(a:b='foo') bar")) assert_equal("<a a='foo' b='bar'>bar</a>\n", render("%a(a = 'foo' b = 'bar') bar")) assert_equal("<a a='foo' b='bar'>bar</a>\n", render("%a(a = foo b = bar) bar", :locals => {:foo => 'foo', :bar => 'bar'})) assert_equal("<a a='foo'>(b='bar')</a>\n", render("%a(a='foo')(b='bar')")) assert_equal("<a a='foo)bar'>baz</a>\n", render("%a(a='foo)bar') baz")) assert_equal("<a a='foo'>baz</a>\n", render("%a( a = 'foo' ) baz")) end def test_new_attribute_escaping assert_equal(%Q{<a a='foo " bar'>bar</a>\n}, render(%q{%a(a="foo \" bar") bar})) assert_equal(%Q{<a a='foo \\" bar'>bar</a>\n}, render(%q{%a(a="foo \\\\\" bar") bar}))
CWE-79
1
def get_disp_ctrl Log.add_info(request, params.inspect) if params[:id] != '0' begin @folder = Folder.find(params[:id]) rescue => evar @folder = nil end end session[:folder_id] = params[:id] render(:partial => 'ajax_disp_ctrl', :layout => false) end
CWE-89
0
def create_event(comment) Event.create! bug_id: comment.bug_id, kind: 'comment', data: {'comment_id' => comment.id}, user_id: comment.user_id end
CWE-94
14
def test_verify_security_policy_checksum_missing skip 'openssl is missing' unless defined?(OpenSSL::SSL) @spec.cert_chain = [PUBLIC_CERT.to_pem] @spec.signing_key = PRIVATE_KEY build = Gem::Package.new @gem build.spec = @spec build.setup_signer FileUtils.mkdir 'lib' FileUtils.touch 'lib/code.rb' File.open @gem, 'wb' do |gem_io| Gem::Package::TarWriter.new gem_io do |gem| build.add_metadata gem build.add_contents gem # write bogus data.tar.gz to foil signature bogus_data = Gem.gzip 'hello' gem.add_file_simple 'data.tar.gz', 0444, bogus_data.length do |io| io.write bogus_data end # pre rubygems 2.0 gems do not add checksums end end Gem::Security.trust_dir.trust_cert PUBLIC_CERT package = Gem::Package.new @gem package.security_policy = Gem::Security::HighSecurity e = assert_raises Gem::Security::Exception do package.verify end assert_equal 'invalid signature', e.message refute package.instance_variable_get(:@spec), '@spec must not be loaded' assert_empty package.instance_variable_get(:@files), '@files must empty' end
CWE-347
25
def mget(*keys) options = (keys.pop if keys.last.is_a? Hash) || {} if keys.any? # Marshalling gets extended before Namespace does, so we need to pass options further if singleton_class.ancestors.include? Marshalling super(*keys.map {|key| interpolate(key) }, options) else super(*keys.map {|key| interpolate(key) }) end end end
CWE-502
15
def skip_node?(node) node.text? || node.cdata? end
CWE-79
1
def self.find_q_codes(html) q_hash = {} # |q_code, q_param| return q_hash if html.nil? all = Research.get_q_codes q_codes = html.scan(/[$](q\d{2}_\d{2})/) unless q_codes.nil? yaml = Research.get_config_yaml q_codes.each do |q_code_a| q_code = q_code_a.first if all.include?(q_code) if yaml[q_code].nil? q_hash[q_code] = nil else q_hash[q_code] = Marshal.load(Marshal.dump(yaml[q_code])) end end end end return q_hash end
CWE-89
0
it 'should return a key' do expect(jwt_validator.jwks_key(:alg, jwks_kid)).to eq('RS256') end
CWE-347
25
def call(exception, locale, key, options) if exception.is_a?(MissingTranslation) options[:rescue_format] == :html ? exception.html_message : exception.message elsif exception.is_a?(Exception) raise exception else throw :exception, exception end end
CWE-79
1
def sanitize_key(key) case key when Symbol then "--#{key.to_s.tr("_", "-")}" else key end
CWE-78
6
def get_path Log.add_info(request, params.inspect) if params[:thetisBoxSelKeeper].nil? or params[:thetisBoxSelKeeper].empty? @folder_path = '/' + t('paren.unknown') render(:partial => 'ajax_folder_path', :layout => false) return end @selected_id = params[:thetisBoxSelKeeper].split(':').last @folder_path = Folder.get_path(@selected_id) render(:partial => 'ajax_folder_path', :layout => false) end
CWE-89
0
def self.get_childs(folder_id, conditions, recursive, admin, ret_obj) SqlHelper.validate_token([folder_id]) arr = [] if recursive folder_tree = Folder.get_tree(Hash.new, conditions, folder_id, admin) return [] if folder_tree.nil? folder_tree.each do |parent_id, childs| if ret_obj arr |= childs else childs.each do |folder| folder_id = folder.id.to_s arr << folder_id unless arr.include?(folder_id) end end end else con = Marshal.load(Marshal.dump(conditions)) if con.nil? con = '' else con << ' and ' end con << "parent_id=#{folder_id}" unless admin con << " and (xtype is null or not (xtype='#{Folder::XTYPE_SYSTEM}'))" end folders = Folder.where(con).order('xorder ASC').to_a if ret_obj arr = folders else folders.each do |folder| arr << folder.id.to_s end end end return arr end
CWE-89
0
def check_owner return if params[:id].nil? or params[:id].empty? or @login_user.nil? begin owner_id = Item.find(params[:id]).user_id rescue owner_id = -1 end if !@login_user.admin?(User::AUTH_ITEM) and owner_id != @login_user.id Log.add_check(request, '[check_owner]'+request.to_s) flash[:notice] = t('msg.need_to_be_owner') redirect_to(:controller => 'desktop', :action => 'show') end end
CWE-89
0