code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
def edit_timecard Log.add_info(request, params.inspect) date_s = params[:date] if date_s.nil? or date_s.empty? @date = Date.today date_s = @date.strftime(Schedule::SYS_DATE_FORM) else @date = Date.parse(date_s) end @timecard = Timecard.get_for(@login_user.id, date_s) ...
CWE-89
0
def process # We don't want any tracking back in the fs. Unlikely, but there # you go. client = self.host.gsub("..",".") dir = File.join(Puppet[:reportdir], client) if ! FileTest.exists?(dir) FileUtils.mkdir_p(dir) FileUtils.chmod_R(0750, dir) end # Now store the report. ...
CWE-22
2
def self.dump(object) MultiJson.dump object, mode: :compat, escape_mode: :xss_safe, time_format: :ruby end
CWE-79
1
it "sanitizes Pathname param key" do cl = subject.build_command_line("true", Pathname.new("/usr/bin/ruby") => nil) expect(cl).to eq "true /usr/bin/ruby" end
CWE-78
6
def verify_signature(string, signature) if signature.nil? fail InvalidSignature, "missing \"signature\" param" elsif signature != generate_signature(string) fail InvalidSignature, "provided signature does not match the calculated signature" end end
CWE-208
91
def calculated_content_type @calculated_content_type ||= type_from_file_command.chomp end
CWE-79
1
def self.get_for(user, mail_account_id, xtype) return nil if user.nil? or mail_account_id.blank? if user.kind_of?(User) user_id = user.id else user_id = user.to_s end SqlHelper.validate_token([user_id, mail_account_id, xtype]) con = [] con << "(user_id=#{user_id})" con ...
CWE-89
0
def self.extract_events(post) cooked = PrettyText.cook(post.raw, topic_id: post.topic_id, user_id: post.user_id) valid_options = VALID_OPTIONS.map { |o| "data-#{o}" } valid_custom_fields = [] SiteSetting.discourse_post_event_allowed_custom_fields.split('|').each do |setting| valid_c...
CWE-79
1
def show filename = Rails.root.join("attachments", @attachment.filename) unless File.exist?(filename) COURSE_LOGGER.log("Cannot find the file '#{@attachment.filename}' for"\ " attachment #{@attachment.name}") flash[:error] = "Error loading #{@attachment.name} from #{@attac...
CWE-79
1
def self.get_next_revision(user_id, source_id) copied_items = Item.where("user_id=#{user_id} and source_id=#{source_id}").order('created_at DESC').to_a rev = 0 copied_items.each do |item| rev_ary = item.title.scan(/[#](\d\d\d)$/) next if rev_ary.nil? rev = rev_ary.first.to_a.first.to_i...
CWE-89
0
def update_folders_order Log.add_info(request, params.inspect) order_ary = params[:folders_order] folders = MailFolder.get_childs(params[:id], false, false) # folders must be ordered by xorder ASC. folders.sort! { |id_a, id_b| idx_a = order_ary.index(id_a) idx_b = order_ary.index(i...
CWE-89
0
def self.trim_by_capacity(user_id, mail_account_id, capacity_mb) # FEATURE_MAIL_STRICT_CAPACITY >>> =begin # max_size = capacity_mb * 1024 * 1024 # cur_size = MailAccount.get_using_size(mail_account_id) # # if cur_size > max_size # over_size = cur_size - max_size # emails = [] # # # First, em...
CWE-89
0
def column_content(column, item) value = column.value_object(item) if value.is_a?(Array) value.collect {|v| column_value(column, item, v)}.compact.join(', ').html_safe else column_value(column, item, value) end end
CWE-79
1
def set_auth_users Log.add_info(request, params.inspect) @folder = Folder.find(params[:id]) if Folder.check_user_auth(@folder.id, @login_user, 'w', true) read_users = [] write_users = [] users_auth = params[:users_auth] unless users_auth.nil? users_auth.each do |auth_par...
CWE-89
0
def login_success if params[:ref].blank? redirect_to default_logged_in_path elsif params[:ref] =~ /^\// redirect_to params[:ref] else render "sns/login/redirect" end end
CWE-601
11
def self.validate_token(tokens, extra_chars=nil) extra_chars = Regexp.escape((extra_chars || []).join()) regexp = Regexp.new("^[ ]*[a-zA-Z0-9_.#{extra_chars}]+[ ]*$") [tokens].flatten.each do |token| next if token.blank? if token.to_s.match(regexp).nil? raise("[ERROR] SqlHelper.vali...
CWE-89
0
it "passes the initial directory" do expect(File.cleanpath('C/../../D')).to eq "../D" end
CWE-22
2
def self.get_for(user_id, category=nil) SqlHelper.validate_token([user_id, category]) con = [] con << "(user_id=#{user_id})" con << "(category='#{category}')" unless category.nil? settings = Setting.where(con.join(' and ')).to_a return nil if settings.nil? or settings.empty? hash = Ha...
CWE-89
0
def self.search_by_params(key, operator, value) key_name = key.sub(/^.*\./,'') opts = {:conditions => "name = '#{key_name}' and value #{operator} '#{value_to_sql(operator, value)}'", :order => :priority} p = Parameter.all(opts) return {:conditions => '1 = 0'} i...
CWE-89
0
def original_filename filename = filename_from_header || filename_from_uri mime_type = MiniMime.lookup_by_content_type(file.content_type) unless File.extname(filename).present? || mime_type.blank? filename = "#{filename}.#{mime_type.extension}" end filename ...
CWE-918
16
def timeline unless params[:type].empty? model = params[:type].camelize.constantize item = model.find(params[:id]) item.update_attribute(:state, params[:state]) else comments, emails = params[:id].split("+") Comment.update_all("state = '#{params[:state]}'", "id IN (#{comments})")...
CWE-89
0
def self.destroy(host) client = host.gsub("..",".") dir = File.join(Puppet[:reportdir], client) if File.exists?(dir) Dir.entries(dir).each do |file| next if ['.','..'].include?(file) file = File.join(dir, file) File.unlink(file) if File.file?(file) end Dir.rmdir(...
CWE-22
2
def set_attachment Log.add_info(request, params.inspect) created = false if params[:id].nil? or params[:id].empty? @item = Item.new_info(0) @item.attributes = params[:item] @item.user_id = @login_user.id @item.title = t('paren.no_title') [:attachment0, :attachment1].each d...
CWE-89
0
def self.get_sql_like(attr_names, keyword) key = ActiveRecord::Base.connection.quote("%#{SqlHelper.escape_for_like(keyword)}%") con = [] attr_names.each do |attr_name| con << "(#{attr_name} like #{key})" end sql = con.join(' or ') sql = '(' + sql + ')' if con.length > 1 return sql ...
CWE-89
0
def self.add_statistics_group(group_id) yaml = Research.get_config_yaml yaml = Hash.new if yaml.nil? if yaml[:statistics].nil? yaml[:statistics] = Hash.new end groups = yaml[:statistics][:groups] if groups.nil? yaml[:statistics][:groups] = group_id ary = [group_id.to_s]...
CWE-89
0
def delete_statistics_group Log.add_info(request, params.inspect) group_id = params[:group_id] if group_id.nil? or group_id.empty? @group_ids = Research.get_statistics_groups render(:partial => 'ajax_statistics_groups', :layout => false) return end @group_ids = Research.delet...
CWE-89
0
def initialize(file) @file = file.is_a?(String) ? StringIO.new(file) : file end
CWE-918
16
def ajax_move_mails Log.add_info(request, params.inspect) folder_id = params[:thetisBoxSelKeeper].split(':').last mail_folder = MailFolder.find_by_id(folder_id) if folder_id == '0' \ or mail_folder.nil? \ or mail_folder.user_id != @login_user.id flash[:notice] = 'ERROR:' + t('m...
CWE-89
0
def spree_current_user @spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id) if doorkeeper_token end
CWE-613
7
def self.up add_column :items, :source_id, :integer add_column :addresses, :groups, :text add_column :addresses, :teams, :text add_column :workflows, :groups, :text add_column :users, :figure, :string add_column :groups, :xtype, :string add_column :teams, :req_to_del_at, :datetime ...
CWE-89
0
def rename Log.add_info(request, params.inspect) @mail_folder = MailFolder.find(params[:id]) unless params[:thetisBoxEdit].nil? or params[:thetisBoxEdit].empty? @mail_folder.name = params[:thetisBoxEdit] @mail_folder.save end render(:partial => 'ajax_folder_name', :layout => false) ...
CWE-89
0
it "does not remove multiple '../' at the beginning" do expect(File.cleanpath('../../A/B')).to eq '../../A/B' end
CWE-22
2
def edit Log.add_info(request, params.inspect) date_s = params[:date] if date_s.nil? or date_s.empty? @date = Date.today date_s = @date.strftime(Schedule::SYS_DATE_FORM) else @date = Date.parse(date_s) end if params[:user_id].nil? @selected_user = @login_user els...
CWE-89
0
def edit Log.add_info(request, params.inspect) @group_id = params[:group_id] official_title_id = params[:id] unless official_title_id.nil? or official_title_id.empty? @official_title = OfficialTitle.find(official_title_id) end render(:partial => 'ajax_official_title_form', :layout => ...
CWE-89
0
def reset_users Log.add_info(request, params.inspect) count = 0 unless params[:check_user].nil? params[:check_user].each do |user_id, value| if value == '1' begin Research.destroy_all('user_id=' + user_id.to_s) count += 1 rescue => evar ...
CWE-89
0
def get_folders_order Log.add_info(request, params.inspect) @folder_id = params[:id] if @folder_id == '0' @folders = MailFolder.get_account_roots_for(@login_user) else mail_folder = MailFolder.find(@folder_id) if mail_folder.user_id == @login_user.id @folders = MailFolder.g...
CWE-89
0
def self.validate_token(tokens, extra_chars=nil) if extra_chars.nil? extra_chars = '' else extra_chars = Regexp.escape(extra_chars.join()) end regexp = Regexp.new("^[ ]*[a-zA-Z0-9_.@\\-#{extra_chars}]+[ ]*$") [tokens].flatten.each do |token| next if token.blank? if token...
CWE-89
0
def new @item = Item.new if params[:folder_id].nil? or params[:folder_id].empty? my_folder = @login_user.get_my_folder if my_folder.nil? @item.folder_id = 0 else @item.folder_id = my_folder.id end else @item.folder_id = params[:folder_id].to_i end @it...
CWE-89
0
def bbs Log.add_info(request, params.inspect) if !params[:select_sorting].nil? sort_a = params[:select_sorting].split(' ') params[:sort_col] = sort_a.first params[:sort_type] = sort_a.last end list render(:action => 'bbs') end
CWE-89
0
def update_config Log.add_info(request, params.inspect) @yaml = ApplicationHelper.get_config_yaml unless params[:desktop].nil? or params[:desktop].empty? @yaml[:desktop] = Hash.new if @yaml[:desktop].nil? params[:desktop].each do |key, val| @yaml[:desktop][key] = val end ...
CWE-89
0
def test_should_not_fall_for_xss_image_hack_with_uppercase_tags assert_sanitized %(<IMG """><SCRIPT>alert("XSS")</SCRIPT>">), "<img>\"&gt;" end
CWE-79
1
def Schema string_or_io Schema.new(string_or_io) end
CWE-611
13
def self.get_from_name(user_name) SqlHelper.validate_token([user_name]) begin user = User.where("name='#{user_name}'").first rescue => evar Log.add_error(nil, evar) end return user end
CWE-89
0
def self.from_yaml(input) Gem.load_yaml input = normalize_yaml_input input spec = YAML.load input if spec && spec.class == FalseClass then raise Gem::EndOfYAMLException end unless Gem::Specification === spec then raise Gem::Exception, "YAML data doesn't evaluate to gem specifica...
CWE-502
15
def get_order Log.add_info(request, params.inspect) mail_account_id = params[:mail_account_id] @mail_account = MailAccount.find_by_id(mail_account_id) if @mail_account.user_id != @login_user.id flash[:notice] = t('msg.need_to_be_owner') redirect_to(:controller => 'desktop', :action => '...
CWE-89
0
def download(url, remote_headers = {}) headers = remote_headers. reverse_merge('User-Agent' => "CarrierWave/#{CarrierWave::VERSION}") begin file = OpenURI.open_uri(process_uri(url.to_s), headers) rescue StandardError => e raise CarrierWave::DownloadError, "cou...
CWE-918
16
def _unmarshal(val, options) unmarshal?(val, options) ? Marshal.load(val) : val end
CWE-502
15
def test_parse_memory_nil assert_raises(ArgumentError) do @parser.parse_memory(nil) end end
CWE-241
68
it "with Pathname command and params" do cl = subject.build_command_line(Pathname.new("/usr/bin/ruby"), "-v" => nil) expect(cl).to eq "/usr/bin/ruby -v" end
CWE-78
6
def ajax_delete_items Log.add_info(request, params.inspect) folder_id = params[:id] unless params[:check_item].blank? is_admin = @login_user.admin?(User::AUTH_ITEM) count = 0 params[:check_item].each do |item_id, value| if value == '1' begin item = Item....
CWE-89
0
def self.load_yaml return if @yaml_loaded return unless defined?(gem) test_syck = ENV['TEST_SYCK'] # Only Ruby 1.8 and 1.9 have syck test_syck = false unless /^1\./ =~ RUBY_VERSION unless test_syck begin gem 'psych', '>= 1.2.1' rescue Gem::LoadError # It's OK if ...
CWE-502
15
def sanitize_value(value) case value when Array then value.collect { |i| i.to_s.shellescape } when NilClass then value else value.to_s.shellescape end
CWE-78
6
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 ...
CWE-89
0
def query Log.add_info(request, '') # Not to show passwords. unless @login_user.admin?(User::AUTH_ZEPTAIR) render(:text => 'ERROR:' + t('msg.need_to_be_admin')) return end target_user = nil SqlHelper.validate_token([params[:user_id], params[:zeptair_id], params[:group_id]]) u...
CWE-89
0
def name FIELD_NAME_MAP[@name.to_s.downcase] || @name end
CWE-93
33
detectMimeType(filename) { if (!filename) { return defaultMimeType; } let parsed = path.parse(filename); let extension = (parsed.ext.substr(1) || parsed.name || '') .split('?') .shift() .trim() .toLowerCase(); let v...
CWE-88
3
it "handles Symbol keys with tailing '='" do cl = subject.build_command_line("true", :abc= => "def") expect(cl).to eq "true --abc=def" end
CWE-78
6
def update_config Log.add_info(request, params.inspect) yaml = ApplicationHelper.get_config_yaml unless params[:timecard].nil? or params[:timecard].empty? yaml[:timecard] = Hash.new if yaml[:timecard].nil? params[:timecard].each do |key, val| yaml[:timecard][key] = val e...
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", ...
CWE-79
1
it "should find a user by first name or last name" do @cur_user.stub(:pref).and_return(:activity_user => 'Billy') controller.instance_variable_set(:@current_user, @cur_user) User.should_receive(:where).with("upper(first_name) LIKE upper('%Billy%') OR upper(last_name) LIKE upper('%Billy%')").and_re...
CWE-89
0
it :test_render_parse_nil_param do assert_raises(ArgumentError) { parser.parse_memory(nil) } end
CWE-241
68
def process_cors(env) resource, error = match_resource(env) if resource Result.hit(env) cors = resource.to_headers(env) cors else Result.miss(env, error) nil end end
CWE-22
2
def test_attr_wrapper assert_equal("<p strange=*attrs*></p>\n", render("%p{ :strange => 'attrs'}", :attr_wrapper => '*')) assert_equal("<p escaped='quo\"te'></p>\n", render("%p{ :escaped => 'quo\"te'}", :attr_wrapper => '"')) assert_equal("<p escaped=\"quo'te\"></p>\n", render("%p{ :escaped => 'quo\\'te'}...
CWE-79
1
def url_valid?(url) url = begin URI.parse(url) rescue StandardError false end url.is_a?(URI::HTTP) || url.is_a?(URI::HTTPS) end
CWE-79
1
def show_tree if params[:action] == 'show_tree' Log.add_info(request, params.inspect) end con = [] con << "(user_id=#{@login_user.id})" account_xtype = params[:mail_account_xtype] unless account_xtype.blank? SqlHelper.validate_token([account_xtype]) con << "(xtype='#{accou...
CWE-89
0
def test_full_sanitize_allows_turning_off_encoding_special_chars assert_equal '&amp;', full_sanitize('&') assert_equal '&', full_sanitize('&', encode_special_chars: false) end
CWE-79
1
def read_config(self, config, **kwargs): self.recaptcha_private_key = config.get("recaptcha_private_key") self.recaptcha_public_key = config.get("recaptcha_public_key") self.enable_registration_captcha = config.get( "enable_registration_captcha", False ) self.reca...
CWE-79
1
def generate(type, str) case type when :md5 attribute_value = '{MD5}' + Base64.encode64(Digest::MD5.digest(str)).chomp! when :sha attribute_value = '{SHA}' + Base64.encode64(Digest::SHA1.digest(str)).chomp! when :ssha srand; salt = (rand * 1000).to_i.to_s ...
CWE-916
34
it 'returns correct link' do data = { cutoff: false, user: 'Julia Nguyen', comment: 'Hello', typename: 'typename', type: 'type_comment_moment', typeid: 1, commentable_id: 1 } expect(comment_link(uniqueid, data)).to eq('<a id="uniqueid" href="...
CWE-79
1
def sanitize(params) return [] if params.nil? || params.empty? params.collect do |k, v| [sanitize_key(k), sanitize_value(v)] end end
CWE-78
6
def self.applied_paid_hlds(user_id, start_date, end_date) SqlHelper.validate_token([user_id, start_date, end_date]) sql = "SELECT COUNT(*) FROM timecards WHERE user_id = #{user_id} AND date >= '#{start_date}' AND date <= '#{end_date}'" sum = 0.0 self.workcodes.each do |key, params| paidhld_ra...
CWE-89
0
def test_extract_symlink_parent skip 'symlink not supported' if Gem.win_platform? package = Gem::Package.new @gem tgz_io = util_tar_gz do |tar| tar.mkdir 'lib', 0755 tar.add_symlink 'lib/link', '../..', 0644 tar.add_file 'lib/link/outside.txt', 0644 do |io| io.write 'h...
CWE-22
2
def check_image_content_type!(new_file) if image?(new_file) magic_type = mime_magic_content_type(new_file) if magic_type != new_file.content_type raise CarrierWave::IntegrityError, "has MIME type mismatch" end end end
CWE-79
1
it "with dofollowify enabled, links should be nofollowed" do @blog.dofollowify = true @blog.save expect(nofollowify_links('<a href="http://myblog.net">my blog</a>')). to eq('<a href="http://myblog.net">my blog</a>') end
CWE-79
1
def self.get_my_folder(user_id) return Folder.where("(owner_id=#{user_id}) and (xtype='#{Folder::XTYPE_USER}')").first end
CWE-89
0
def destroy current_user.invalidate_all_sessions! super end
CWE-613
7
def self.generate_key_pair(key_base_name, recipient, real_name) public_key_file_name = "#{key_base_name}.pub" private_key_file_name = "#{key_base_name}.sec" script = generate_key_script(public_key_file_name, private_key_file_name, recipient, real_name) script_file = Tempfile.new('gpg-script'...
CWE-94
14
it "returns the right category group permissions for an anon user" do json = described_class.new(category, scope: Guardian.new, root: false).as_json expect(json[:group_permissions]).to eq([ { permission_type: CategoryGroup.permission_types[:full], group_name: Group[:everyone]&.name } ...
CWE-276
45
it "returns the right category group permission for a staff user ordered by ascending group name" do json = described_class.new(category, scope: Guardian.new(admin), root: false).as_json expect(json[:group_permissions]).to eq([ { permission_type: CategoryGroup.permission_types[:readonly...
CWE-276
45
def stub_bad_jwks stub_request(:get, 'https://samples.auth0.com/.well-known/jwks-bad.json') .to_return( status: 404 ) end
CWE-347
25
func validateWebhook(actor *db.User, l macaron.Locale, w *db.Webhook) (field, msg string, ok bool) { if !actor.IsAdmin { // 🚨 SECURITY: Local addresses must not be allowed by non-admins to prevent SSRF, // see https://github.com/gogs/gogs/issues/5366 for details. payloadURL, err := url.Parse(w.URL) if err != ...
CWE-918
16
func (v *validator) ValidateSignature(auth kolide.Auth) (kolide.Auth, error) { info := auth.(*resp) status, err := info.status() if err != nil { return nil, errors.New("missing or malformed response") } if status != Success { return nil, errors.Errorf("response status %s", info.statusDescription()) } decoded...
CWE-290
85
func fixLength(isResponse bool, status int, requestMethod string, header Header, te []string) (int64, error) { // Logic based on response type or status if noBodyExpected(requestMethod) { return 0, nil } if status/100 == 1 { return 0, nil } switch status { case 204, 304: return 0, nil } // Logic based ...
CWE-444
41
func (*UpdateAccountRequest) Descriptor() ([]byte, []int) { return file_console_proto_rawDescGZIP(), []int{36} }
CWE-613
7
func (x *DeleteStorageObjectRequest) ProtoReflect() protoreflect.Message { mi := &file_console_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) }
CWE-613
7
func (*ListPurchasesRequest) Descriptor() ([]byte, []int) { return file_console_proto_rawDescGZIP(), []int{28} }
CWE-613
7
func (mbox *Mailbox) newClient() (*client.Client, error) { var imapClient *client.Client var err error if mbox.TLS { config := new(tls.Config) config.InsecureSkipVerify = mbox.IgnoreCertErrors imapClient, err = client.DialTLS(mbox.Host, config) } else { imapClient, err = client.Dial(mbox.Host) } if err !=...
CWE-918
16
func (x *UpdateAccountRequest) ProtoReflect() protoreflect.Message { mi := &file_console_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) }
CWE-613
7
func (*LeaderboardRequest) Descriptor() ([]byte, []int) { return file_console_proto_rawDescGZIP(), []int{25} }
CWE-613
7
func (p *BinaryProtocol) readStringBody(size int32) (value string, err error) { if size < 0 { return "", nil } if uint64(size) > p.trans.RemainingBytes() { return "", invalidDataLength } var buf []byte if int(size) <= len(p.buffer) { buf = p.buffer[0:size] } else { buf = make([]byte, size) } _, e := io...
CWE-770
37
func isRepositoryGitPath(path string) bool { return strings.HasSuffix(path, ".git") || strings.Contains(path, ".git"+string(os.PathSeparator)) || // Windows treats ".git." the same as ".git" strings.HasSuffix(path, ".git.") || strings.Contains(path, ".git."+string(os.PathSeparator)) }
CWE-78
6
func (p *HTTPClient) closeResponse() error { var err error if p.response != nil && p.response.Body != nil { // The docs specify that if keepalive is enabled and the response body is not // read to completion the connection will never be returned to the pool and // reused. Errors are being ignored here because i...
CWE-770
37
func (x *UnlinkDeviceRequest) ProtoReflect() protoreflect.Message { mi := &file_console_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) }
CWE-613
7
func (c *linuxContainer) makeCriuRestoreMountpoints(m *configs.Mount) error { switch m.Device { case "cgroup": // No mount point(s) need to be created: // // * for v1, mount points are saved by CRIU because // /sys/fs/cgroup is a tmpfs mount // // * for v2, /sys/fs/cgroup is a real mount, but // the...
CWE-190
19
func (x *RuntimeInfo) Reset() { *x = RuntimeInfo{} if protoimpl.UnsafeEnabled { mi := &file_console_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } }
CWE-613
7
func TestResourceServer_ValidateAccessToken(t *testing.T) { r := newMockResourceServer(t) _, err := r.ValidateAccessToken(context.Background(), "myserver", sampleIDToken) assert.Error(t, err) }
CWE-613
7
func TestEscapeJSONString(t *testing.T) { for _, str := range []string{"", "foobar", `foo"bar`, `foo\bar`, "foo\n\tbar"} { escaped := EscapeJSONString(str) var unmarshaled string err := json.Unmarshal([]byte(`"` + escaped + `"`), &unmarshaled) require.NoError(t, err, str) assert.Equal(t, str, unmarshaled, st...
CWE-178
40
func TestCORSFilter_AllowedDomains(t *testing.T) { for _, each := range allowedDomainInput { tearDown() ws := new(WebService) ws.Route(ws.PUT("/cors").To(dummy)) Add(ws) cors := CrossOriginResourceSharing{ AllowedDomains: each.domains, CookiesAllowed: true, Container: DefaultContainer} Filte...
CWE-639
9
func (x *UserList) ProtoReflect() protoreflect.Message { mi := &file_console_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) }
CWE-613
7
func (x *CallApiEndpointRequest) ProtoReflect() protoreflect.Message { mi := &file_console_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) }
CWE-613
7