code
stringlengths
12
2.05k
label
int64
0
1
programming_language
stringclasses
9 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
103
description
stringlengths
36
1.23k
url
stringlengths
36
48
label_name
stringclasses
2 values
def self.publish_unread(post) return unless post.topic.regular? # TODO at high scale we are going to have to defer this, # perhaps cut down to users that are around in the last 7 days as well group_ids = if post.post_type == Post.types[:whisper] [Group::AUTO_GROUPS[:staff]] else post.topic.category && post.topic.category.secure_group_ids end tags = nil tag_ids = nil if include_tags_in_report? tag_ids, tags = post.topic.tags.pluck(:id, :name).transpose end TopicUser .tracking(post.topic_id) .includes(user: :user_stat) .select([:user_id, :last_read_post_number, :notification_level]) .each do |tu| payload = { last_read_post_number: tu.last_read_post_number, highest_post_number: post.post_number, updated_at: post.topic.updated_at, created_at: post.created_at, category_id: post.topic.category_id, notification_level: tu.notification_level, archetype: post.topic.archetype, first_unread_at: tu.user.user_stat.first_unread_at, unread_not_too_old: true } if tags payload[:tags] = tags payload[:topic_tag_ids] = tag_ids end message = { topic_id: post.topic_id, message_type: UNREAD_MESSAGE_TYPE, payload: payload } MessageBus.publish(self.unread_channel_key(tu.user_id), message.as_json, group_ids: group_ids) end end
0
Ruby
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
it "approves user if invited by staff" do SiteSetting.must_approve_users = true invite = Fabricate(:invite, email: '[email protected]', invited_by: Fabricate(:admin)) user = InviteRedeemer.create_user_from_invite(invite: invite, email: invite.email, username: 'test') expect(user.approved).to eq(true) end
0
Ruby
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
def legal?(str) !!str.match(/\A\h{24}\Z/i) end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
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 = SqlHelper.get_sql_like([:groups], "|#{display_id}|") end when 'team' if @login_user.get_teams_a.include?(display_id) con = SqlHelper.get_sql_like([:teams], "|#{display_id}|") end end end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
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
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def read reply = Protocol::Reply.allocate reply.length, reply.request_id, reply.response_to, reply.op_code, reply.flags, reply.cursor_id, reply.offset, reply.count = @sock.read(36).unpack('l5<q<l2<') if reply.count == 0 reply.documents = [] else buffer = StringIO.new(@sock.read(reply.length - 36)) reply.documents = reply.count.times.map do BSON::Document.deserialize(buffer) end end reply end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def self.save_group_value(group_id, category, key, value) SqlHelper.validate_token([group_id, category, key]) con = [] con << "(group_id=#{group_id})" con << "(category='#{category}')" con << "(xkey='#{key}')" setting = Setting.where(con.join(' and ')).first if value.nil? unless setting.nil? setting.destroy end else if setting.nil? setting = Setting.new setting.group_id = group_id setting.category = category setting.xkey = key setting.xvalue = value setting.save! else setting.update_attribute(:xvalue, value) end end end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
def get_response(reqline) validate_line reqline @socket.writeline reqline recv_response() end
1
Ruby
CWE-93
Improper Neutralization of CRLF Sequences ('CRLF Injection')
The software uses CRLF (carriage return line feeds) as a special element, e.g. to separate lines or records, but it does not neutralize or incorrectly neutralizes CRLF sequences from inputs.
https://cwe.mitre.org/data/definitions/93.html
safe
def send_password Log.add_info(request, params.inspect) mail_addr = params[:thetisBoxEdit] SqlHelper.validate_token([mail_addr], ['@-']) begin users = User.where("email='#{mail_addr}'").to_a rescue => evar end if users.nil? or users.empty? Log.add_error(request, evar) flash[:notice] = 'ERROR:' + t('email.address_not_found') else user_passwords_h = {} users.each do |user| newpass = UsersHelper.generate_password user.update_attribute(:pass_md5, UsersHelper.generate_digest_pass(user.name, newpass)) user_passwords_h[user] = newpass end NoticeMailer.password(user_passwords_h, ApplicationHelper.root_url(request)).deliver; flash[:notice] = t('email.sent') end render(:controller => 'login', :action => 'index') end
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def test_parse_bigger xml = <<-XML.strip_heredoc <request id="1027" creator="Iggy"> <action type="submit"> <source project="home:Iggy" package="TestPack" rev="1"/> <target project="kde4" package="mypackage"/> <options> <sourceupdate>cleanup</sourceupdate> </options> <acceptinfo rev="1" srcmd5="806a6e27ed7915d1bb8d8a989404fd5a" osrcmd5="d41d8cd98f00b204e9800998ecf8427e"/> </action> <priority>critical</priority> <state name="review" who="Iggy" when="2012-11-07T21:13:12"> <comment>No comment</comment> </state> <review state="new" when="2017-09-01T09:11:11" by_user="adrian"/> <review state="new" when="2017-09-01T09:11:11" by_group="test_group"/> <review state="accepted" when="2012-11-07T21:13:12" who="tom" by_user="tom"> <comment>review1</comment> </review> <review state="new" when="2012-11-07T21:13:13" who="tom" by_user="tom"> <comment>please accept</comment> </review> <description>Left blank</description> </request> XML req = BsRequest.new_from_xml(xml) req.save! # number got increased by one assert_equal 1027, req.number newxml = req.render_xml assert_equal xml, newxml wi = req.webui_infos(diffs: false) # iggy is *not* target maintainer assert_equal false, wi['is_target_maintainer'] assert_equal wi['actions'][0], type: :submit, sprj: 'home:Iggy', spkg: 'TestPack', srev: '1', tprj: 'kde4', tpkg: 'mypackage', name: 'Submit TestPack' end
0
Ruby
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
it "can set the password and ip_address" do password = 's3cure5tpasSw0rD' ip_address = '192.168.1.1' invite = Fabricate(:invite, email: '[email protected]') user = InviteRedeemer.create_user_from_invite(invite: invite, email: invite.email, username: 'walter', name: 'Walter White', password: password, ip_address: ip_address) expect(user).to have_password expect(user.confirm_password?(password)).to eq(true) expect(user.approved).to eq(true) expect(user.ip_address).to eq(ip_address) expect(user.registration_ip_address).to eq(ip_address) end
0
Ruby
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
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
0
Ruby
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
def test_private_address assert_raises PrivateAddressCheck::PrivateConnectionAttemptedError do PrivateAddressCheck.only_public_connections do TCPSocket.new("localhost", 80) end end end
0
Ruby
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The program contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.
https://cwe.mitre.org/data/definitions/362.html
vulnerable
it 'should escape the content of removed `plaintext` elements' do Sanitize.fragment('<plaintext>hello! <script>alert(0)</script>') .must_equal 'hello! &lt;script&gt;alert(0)&lt;/script&gt;' end
0
Ruby
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
def command(command) session.context.command name, command end
1
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
def auth_database ENV["MONGOHQ_SINGLE_NAME"] end
1
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
it "queries the primary node" do stats = Support::Stats.collect do session.with(consistency: :eventual)[:users].find(scope: scope).entries end stats[:primary].grep(Moped::Protocol::Query).count.should eq 1 end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def test_execute_details_truncates_summary spec_fetcher do |fetcher| fetcher.spec 'a', 2 do |s| s.summary = 'This is a lot of text. ' * 10_000 s.authors = ["Abraham Lincoln \x01", "\x02 Hirohito"] s.homepage = "http://a.example.com/\x03" end fetcher.legacy_platform end @cmd.handle_options %w[-r -d] use_ui @ui do @cmd.execute end expected = <<-EOF *** REMOTE GEMS *** a (2) Authors: Abraham Lincoln ., . Hirohito Homepage: http://a.example.com/. Truncating the summary for a-2 to 100,000 characters: #{" This is a lot of text. This is a lot of text. This is a lot of text.\n" * 1449} This is a lot of te pl (1) Platform: i386-linux Author: A User Homepage: http://example.com this is a summary EOF assert_equal expected, @ui.output assert_equal '', @ui.error end
1
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
def show load_object @orders = @user.orders.for_store(current_store).complete.order('completed_at desc') end
1
Ruby
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
it "fetches more" do users.insert(102.times.map { Hash["scope" => scope] }) stats = Support::Stats.collect do users.find(scope: scope).entries end stats[node_for_reads].grep(Moped::Protocol::GetMore).count.should eq 1 end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def self.get_copies_folder(user_id) my_folder = User.get_my_folder(user_id) unless my_folder.nil? folder_name_quot = SqlHelper.quote(Item.copies_folder) con = "(parent_id=#{my_folder.id}) and (name=#{folder_name_quot})" begin copies_folder = Folder.where(con).first rescue end if copies_folder.nil? folder = Folder.new folder.name = Item.copies_folder folder.parent_id = my_folder.id folder.owner_id = user_id.to_i folder.xtype = nil folder.read_users = '|' + user_id.to_s + '|' folder.write_users = '|' + user_id.to_s + '|' folder.save! copies_folder = folder end end return copies_folder end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
def create Log.add_info(request, params.inspect) return unless request.post? attrs = _process_user_attrs(nil, params[:user]) password = attrs[:password] attrs.delete(:password) @user = UsersHelper.get_initialized_user(attrs.permit(User::PERMIT_BASE)) @user.auth = User::AUTH_ALL if User.count <= 0 begin @user.save! rescue render(:controller => 'users', :action => 'new') return end @user.setup flash[:notice] = t('msg.register_success') if params[:from] == 'users_list' redirect_to(:controller => 'users', :action => 'list') else NoticeMailer.welcome(@user, password, ApplicationHelper.root_url(request)).deliver flash[:notice] << '<br/><span class=\'font_msg_bold\' style=\'color:firebrick;\'>'+t('user.initial_password')+'</span>'+t('msg.sent_by')+'<span class=\'font_msg_bold\'>'+t('email.name')+'</span>'+t('msg.check_it') redirect_to(:controller => 'login', :action => 'index') end end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
def initialize(set) @set = set @primary = false @secondary = false server = TCPServer.new 0 @host = Socket.gethostname @port = server.addr[1] server.close end
1
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
def move_multi Log.add_info(request, params.inspect) return unless request.post? if params[:check_item].nil? or params[:thetisBoxSelKeeper].nil? list render(:action => 'list') return end is_admin = @login_user.admin?(User::AUTH_ITEM) folder_id = params[:thetisBoxSelKeeper].split(':').last SqlHelper.validate_token([folder_id]) unless Folder.check_user_auth(folder_id, @login_user, 'w', true) flash[:notice] = 'ERROR:' + t('folder.need_auth_to_write_in') list render(:action => 'list') return end count = 0 params[:check_item].each do |item_id, value| if value == '1' begin item = Item.find(item_id) next if !is_admin and item.user_id != @login_user.id item.update_attribute(:folder_id, folder_id) rescue => evar item = nil Log.add_error(request, evar) end count += 1 end end flash[:notice] = t('item.moved', :count => count) list render(:action => 'list') end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
it "returns a hex string representation of the id" do expect(object_id.to_s).to eq(expected) end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def primary? @primary end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def command(database, command) options = consistency == :eventual ? { :flags => [:slave_ok] } : {} with_node do |node| node.command(database, command, options) end end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
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.find(item_id) next if !is_admin and item.user_id != @login_user.id item.destroy rescue => evar Log.add_error(request, evar) end count += 1 end end flash[:notice] = t('item.deleted', :count => count) end get_items end
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def add_node(session, new_nodename, all=false, auto_start=true) if all command = [PCS, "cluster", "node", "add", new_nodename] if auto_start command << '--start' command << '--enable' end out, stderror, retval = run_cmd(session, *command) else out, stderror, retval = run_cmd( session, PCS, "cluster", "localnode", "add", new_nodename ) end $logger.info("Adding #{new_nodename} to pcs_settings.conf") corosync_nodes = get_corosync_nodes() pcs_config = PCSConfig.new(Cfgsync::PcsdSettings.from_file('{}').text()) pcs_config.update_cluster($cluster_name, corosync_nodes) sync_config = Cfgsync::PcsdSettings.from_text(pcs_config.text()) # on version conflict just go on, config will be corrected eventually # by displaying the cluster in the web UI Cfgsync::save_sync_new_version( sync_config, corosync_nodes, $cluster_name, true ) return retval, out.join("\n") + stderror.join("\n") end
0
Ruby
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable
def notify Log.add_info(request, params.inspect) return unless request.post? root_url = ApplicationHelper.root_url(request) count = UsersHelper.send_notification(params[:check_user], params[:thetisBoxEdit], root_url) if count > 0 flash[:notice] = t('user.notification_sent')+ count.to_s + t('user.notification_sent_suffix') end redirect_to(:action => 'list') end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
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
0
Ruby
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
https://cwe.mitre.org/data/definitions/601.html
vulnerable
def destroy Log.add_info(request, params.inspect) return unless request.post? mail_account_id = params[:mail_account_id] SqlHelper.validate_token([mail_account_id]) mail_folder = MailFolder.find(params[:id]) trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRASH) if trash_folder.nil? mail_folder.force_destroy render(:text => '') else if mail_folder.get_parents(false).include?(trash_folder.id.to_s) mail_folder.force_destroy render(:text => '') else mail_folder.update_attribute(:parent_id, trash_folder.id) flash[:notice] = t('msg.moved_to_trash') prms = ApplicationHelper.get_fwd_params(params) prms[:controller] = params[:controller] prms[:action] = 'show_tree' @redirect_url = ApplicationHelper.url_for(prms) render(:partial => 'common/redirect_to', :layout => false) end end end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
def self.arrange_per_scope(address, user, scope, group_ids, team_ids) SqlHelper.validate_token([group_ids, team_ids]) case scope when 'private' address.owner_id = user.id address.groups = nil address.teams = nil when 'all' return false unless user.admin?(User::AUTH_ADDRESSBOOK) address.owner_id = 0 address.groups = nil address.teams = nil when 'common' return nil unless user.admin?(User::AUTH_ADDRESSBOOK) address.owner_id = 0 if group_ids.nil? or group_ids.empty? address.groups = nil else address.groups = '|' + group_ids.join('|') + '|' end if team_ids.nil? or team_ids.empty? address.teams = nil else address.teams = '|' + team_ids.join('|') + '|' end end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
it "stores the collection name" do collection.name.should eq :users end
0
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
it 'avoids xss attacks' do h = last_response.headers['X-MiniProfiler-Ids'] id = ::JSON.parse(h)[0] get "/mini-profiler-resources/results?id=%22%3E%3Cqss%3E" last_response.should_not be_ok last_response.body.should_not =~ /<qss>/ last_response.body.should =~ /&lt;qss&gt;/ end
0
Ruby
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def test_formats_valid AuthSourceLdap.any_instance.stubs(:valid?).returns(false) put :update, {:id => AuthSourceLdap.unscoped.first.id, :format => "weird", :auth_source_ldap => {:name => AuthSourceLdap.unscoped.first.name} }, set_session_user assert_response :success wierd_id = "#{AuthSourceLdap.unscoped.first.id}.weird" put :update, {:id => wierd_id, :auth_source_ldap => {:name => AuthSourceLdap.unscoped.first.name} }, set_session_user assert_response :success parameterized_id = "#{AuthSourceLdap.unscoped.first.id}-#{AuthSourceLdap.unscoped.first.name.parameterize}" put :update, {:id => parameterized_id, :auth_source_ldap => {:name => AuthSourceLdap.unscoped.first.name} }, set_session_user assert_response :success end
1
Ruby
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe
it "updates to a mongo advanced selector" do query.explain query.operation.selector.should eq( "$query" => selector, "$explain" => true, "$orderby" => { _id: 1 } ) end
0
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
def destroy_workflow Log.add_info(request, params.inspect) return unless request.post? Item.find(params[:id]).destroy @tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS) @group_id = params[:group_id] SqlHelper.validate_token([@group_id]) if @group_id.blank? @group_id = '0' # '0' for ROOT end render(:partial => 'groups/ajax_group_workflows', :layout => false) end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
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
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
it "has an empty list of dynamic seeds" do cluster.dynamic_seeds.should be_empty end
0
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
def update(change, flags = nil) update = Protocol::Update.new( operation.database, operation.collection, operation.selector, change, flags: flags ) session.with(consistency: :strong) do |session| session.execute update end end
0
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
def self.update_xorder(title, order) if title.nil? con = nil else con = ['title=?', title] end SqlHelper.validate_token([order]) User.update_all("xorder=#{order}", con) end
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def get_cluster_properties_definition(params, request, session) unless allowed_for_local_cluster(session, Permissions::READ) return 403, 'Permission denied' end stdout, _, retval = run_cmd( session, PCS, 'property', 'get_cluster_properties_definition' ) if retval == 0 return [200, stdout] end return [400, '{}'] end
0
Ruby
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable
def match?(name, ip) ip? ? pattern.include?(IPAddr.new(ip)) : matchname?(name) end
0
Ruby
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
def self.get_value(user_id, category, key) SqlHelper.validate_token([user_id, category, key]) con = [] con << "(user_id=#{user_id.to_i})" con << "(category='#{category}')" con << "(xkey='#{key}')" setting = Setting.where(con.join(' and ')).first return setting.xvalue unless setting.nil? return nil end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
it "updates a hostgroup with a parent parameter" do child = FactoryGirl.create(:hostgroup, :parent => @base) as_admin do assert_equal "original", child.parameters["x"] end post :update, {"id" => child.id, "hostgroup" => {"name" => child.name, :group_parameters_attributes => {"0" => {:name => "x", :value =>"overridden", :_destroy => ""}}}}, set_session_user assert_redirected_to hostgroups_url child.reload assert_equal "overridden", child.parameters["x"] end
0
Ruby
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def merge(server) previous = servers.find { |other| other == server } primary = server.primary? secondary = server.secondary? if previous previous.merge(server) else servers << server end end
0
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
def properly_encode(fragment, options) fragment.xml? ? fragment.to_xml(options) : fragment.to_html(options) end
0
Ruby
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
def with_secondary(retry_on_failure = true, &block) available_nodes = nodes.shuffle!.partition(&:secondary?).flatten while node = available_nodes.shift begin return yield node.apply_auth(auth) rescue Errors::ConnectionFailure # That node's no good, so let's try the next one. next end end
1
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
def remove_role(what, role) check_write_access! if what.kind_of? Group rel = self.package_group_role_relationships.where(bs_group_id: what.id) else rel = self.package_user_role_relationships.where(bs_user_id: what.id) end rel = rel.where(role_id: role.id) if role self.transaction do rel.delete_all write_to_backend end end
1
Ruby
CWE-275
Permission Issues
Weaknesses in this category are related to improper assignment or handling of permissions.
https://cwe.mitre.org/data/definitions/275.html
safe
def test_strip_tags_with_quote sanitizer = HTML::FullSanitizer.new string = '<" <img src="trollface.gif" onload="alert(1)"> hi' assert_equal ' hi', sanitizer.sanitize(string) end
1
Ruby
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
it "connects and yields the primary node" do replica_set.with_primary do |node| node.address.should eq @primary.address end end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
it 'removes existing content types' do subject.content_type :xls, 'application/vnd.ms-excel' subject.get :excel do 'some binary content' end get '/excel.json' expect(last_response.status).to eq(406) expect(last_response.body).to eq("The requested format 'txt' is not supported.") end
0
Ruby
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
it "delegates to the cluster" do session.cluster.should_receive(:socket_for).with(:read) session.send(:socket_for, :read) end
0
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
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
0
Ruby
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
def get_path Log.add_info(request, params.inspect) if params[:thetisBoxSelKeeper].blank? @folder_path = '/' + t('paren.unknown') render(:partial => 'ajax_folder_path', :layout => false) return end @selected_id = params[:thetisBoxSelKeeper].split(':').last SqlHelper.validate_token([@selected_id]) @folder_path = Folder.get_path(@selected_id) render(:partial => 'ajax_folder_path', :layout => false) end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
it "should use the provided CSR's content as the issuer" do Puppet::SSL::CertificateFactory.expects(:build).with do |*args| args[2].subject.to_s.should == "/CN=myhost" end.returns "my real cert" @ca.sign(@name, :ca, @request) end
1
Ruby
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
safe
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.to_i})" con << "(xtype='#{MailFolder::XTYPE_ACCOUNT_ROOT}')" order_by = 'xorder ASC, id ASC' return MailFolder.where(con.join(' and ')).order(order_by).to_a end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
def wf_issue Log.add_info(request, params.inspect) begin @item = Item.find(params[:id]) @workflow = @item.workflow rescue => evar Log.add_error(request, evar) end attrs = ActionController::Parameters.new({status: Workflow::STATUS_ACTIVE, issued_at: Time.now}) @workflow.update_attributes(attrs.permit(Workflow::PERMIT_BASE)) @orders = @workflow.get_orders render(:partial => 'ajax_workflow', :layout => false) end
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def ajax_move_mails Log.add_info(request, params.inspect) return unless request.post? folder_id = params[:thetisBoxSelKeeper].split(':').last SqlHelper.validate_token([folder_id]) begin mail_folder = MailFolder.find(folder_id) rescue => evar end if folder_id == '0' \ or mail_folder.nil? \ or mail_folder.user_id != @login_user.id flash[:notice] = 'ERROR:' + t('msg.cannot_save_in_folder') get_mails return end unless params[:check_mail].blank? count = 0 params[:check_mail].each do |email_id, value| if value == '1' begin email = Email.find(email_id) next if email.user_id != @login_user.id email.update_attribute(:mail_folder_id, folder_id) rescue => evar Log.add_error(request, evar) end count += 1 end end flash[:notice] = t('mail.moved', :count => count) end get_mails end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
it "stores the collection" do query.collection.should eq collection end
0
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
def one_time_password otp_username = $redis.get "otp_#{params[:token]}" if otp_username && user = User.find_by_username(otp_username) log_on_user(user) $redis.del "otp_#{params[:token]}" return redirect_to path("/") else @error = I18n.t('user_api_key.invalid_token') end render layout: 'no_ember' end
0
Ruby
NVD-CWE-noinfo
null
null
null
vulnerable
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 research_id = params[:research_id] SqlHelper.validate_token([research_id]) if research_id.blank? @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(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
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
it 'is valid with valid attributes' do notification = build(:notification) expect(notification).to be_valid end
0
Ruby
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
def update Log.add_info(request, params.inspect) return unless request.post? categories = [:general, :menu, :topic, :note, :smtp, :feed, :user, :log] yaml = ApplicationHelper.get_config_yaml categories.each do |cat| next if params[cat].nil? or params[cat].empty? yaml[cat] = Hash.new if yaml[cat].nil? params[cat].each do |key, val| if cat == :general case key when 'symbol_image' ConfigHelper.save_img('symbol.png', val) if val.size > 0 else yaml[cat][key] = val end elsif cat == :topic case key when 'src' ConfigHelper.save_html('topics.html', val) if val.size > 0 else yaml[cat][key] = val end elsif cat == :note case key when 'src' ConfigHelper.save_html('note.html', val) if val.size > 0 else yaml[cat][key] = val end else if params[:smtp]['auth_enabled'] == '0' val = nil if ['auth', 'user_name', 'password'].include?(key) end yaml[cat][key] = val end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
def command(database, cmd, options = {}) operation = Protocol::Command.new(database, cmd, options) process(operation) do |reply| result = reply.documents[0] raise Errors::OperationFailure.new( operation, result ) if result["ok"] != 1 || result["err"] || result["errmsg"] result end end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def create Log.add_info(request, params.inspect) return unless request.post? parent_id = params[:selectedFolderId] unless Folder.check_user_auth(parent_id, @login_user, 'w', true) flash[:notice] = 'ERROR:' + t('folder.need_auth_to_modify') render(:partial => 'ajax_folder_entry', :layout => false) return end if params[:thetisBoxEdit].blank? @folder = nil else @folder = Folder.new @folder.name = params[:thetisBoxEdit] @folder.xorder = Folder.get_order_max(parent_id) + 1 @folder.parent_id = parent_id @folder.inherit_parent_auth @folder.save! end render(:partial => 'ajax_folder_entry', :layout => false) end
1
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
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
0
Ruby
CWE-276
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
vulnerable
def secure_compare(a, b) return false unless bytesize(a) == bytesize(b) l = a.unpack("C*") r, i = 0, -1 b.each_byte { |v| r |= v ^ l[i+=1] } r == 0 end
1
Ruby
NVD-CWE-noinfo
null
null
null
safe
def rd.rewind; end
1
Ruby
CWE-119
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
https://cwe.mitre.org/data/definitions/119.html
safe
it "updates all matching documents" do users.insert(documents) users.find(scope: scope).update_all("$set" => { "updated" => true }) users.find(scope: scope, updated: true).count.should eq 2 end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def install_location filename, destination_dir # :nodoc: raise Gem::Package::PathError.new(filename, destination_dir) if filename.start_with? '/' destination_dir = realpath destination_dir destination_dir = File.expand_path destination_dir destination = File.join destination_dir, filename destination = File.expand_path destination raise Gem::Package::PathError.new(destination, destination_dir) unless destination.start_with? destination_dir + '/' destination.untaint destination end
1
Ruby
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
it "has an empty list of primaries" do cluster.primaries.should be_empty end
0
Ruby
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
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
0
Ruby
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def initialize(address) @address = address host, port = address.split(":") @ip_address = ::Socket.getaddrinfo(host, nil, ::Socket::AF_INET, ::Socket::SOCK_STREAM).first[3] @port = port.to_i @resolved_address = "#{@ip_address}:#{@port}" @timeout = 5 end
1
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
def test_show_owners_dont_load_objects skip "testing a psych-only API" unless defined?(::Psych::DisallowedClass) response = <<EOF --- - email: !ruby/object:Foo {} id: 1 handle: user1 - email: [email protected] - id: 3 handle: user3 - id: 4 EOF @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK'] assert_raises Psych::DisallowedClass do use_ui @ui do @cmd.show_owners("freewill") end end end
1
Ruby
CWE-502
Deserialization of Untrusted Data
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
it "returns true" do Moped::BSON::ObjectId.new(bytes).should == Moped::BSON::ObjectId.new(bytes) end
0
Ruby
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
func Test_SanitizePath(t *testing.T) { Convey("Sanitize malicious user-defined path", t, func() { testCases := []struct { path string expect string }{ {"../../../../../../../../../data/gogs/data/sessions/a/9/a9f0ab6c3ef63dd8", "data/gogs/data/sessions/a/9/a9f0ab6c3ef63dd8"}, {"data/gogs/../../../../../../../../../data/sessions/a/9/a9f0ab6c3ef63dd8", "data/gogs/data/sessions/a/9/a9f0ab6c3ef63dd8"}, {"data/sessions/a/9/a9f0ab6c3ef63dd8", "data/sessions/a/9/a9f0ab6c3ef63dd8"}, } for _, tc := range testCases { So(SanitizePath(tc.path), ShouldEqual, tc.expect) } }) }
1
Go
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
func (ctx *cbcAEAD) Seal(dst, nonce, plaintext, data []byte) []byte { // Output buffer -- must take care not to mangle plaintext input. ciphertext := make([]byte, uint64(len(plaintext))+uint64(ctx.Overhead()))[:len(plaintext)] copy(ciphertext, plaintext) ciphertext = padBuffer(ciphertext, ctx.blockCipher.BlockSize()) cbc := cipher.NewCBCEncrypter(ctx.blockCipher, nonce) cbc.CryptBlocks(ciphertext, ciphertext) authtag := ctx.computeAuthTag(data, nonce, ciphertext) ret, out := resize(dst, uint64(len(dst))+uint64(len(ciphertext))+uint64(len(authtag))) copy(out, ciphertext) copy(out[len(ciphertext):], authtag) return ret }
1
Go
CWE-190
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
https://cwe.mitre.org/data/definitions/190.html
safe
func TestReadRequest_BadConnectHost(t *testing.T) { data := []byte("CONNECT []%20%48%54%54%50%2f%31%2e%31%0a%4d%79%48%65%61%64%65%72%3a%20%31%32%33%0a%0a HTTP/1.0\n\n") r, err := ReadRequest(bufio.NewReader(bytes.NewReader(data))) if err == nil { t.Fatal("Got unexpected request = %#v", r) } }
0
Go
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination.
https://cwe.mitre.org/data/definitions/444.html
vulnerable
func (m *M) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAsym } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: M: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: M: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Arr", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAsym } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthAsym } postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAsym } if postIndex > l { return io.ErrUnexpectedEOF } var v MyType m.Arr = append(m.Arr, v) if err := m.Arr[len(m.Arr)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAsym(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthAsym } if (iNdEx + skippy) < 0 { return ErrInvalidLengthAsym } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil }
0
Go
CWE-129
Improper Validation of Array Index
The product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array.
https://cwe.mitre.org/data/definitions/129.html
vulnerable
func (mr *MockResourceOwnerPasswordCredentialsGrantStorageMockRecorder) DeleteAccessTokenSession(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccessTokenSession", reflect.TypeOf((*MockResourceOwnerPasswordCredentialsGrantStorage)(nil).DeleteAccessTokenSession), arg0, arg1) }
1
Go
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
func compileRegexps(regexpStrings []string) ([]*regexp.Regexp, error) { regexps := []*regexp.Regexp{} for _, regexpStr := range regexpStrings { r, err := regexp.Compile(regexpStr) if err != nil { return regexps, err } regexps = append(regexps, r) } return regexps, nil }
0
Go
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
func (cs *State) tryAddVote(vote *types.Vote, peerID p2p.ID) (bool, error) { added, err := cs.addVote(vote, peerID) if err != nil { // If the vote height is off, we'll just ignore it, // But if it's a conflicting sig, add it to the cs.evpool. // If it's otherwise invalid, punish peer. // nolint: gocritic if voteErr, ok := err.(*types.ErrVoteConflictingVotes); ok { if cs.privValidatorPubKey == nil { return false, errPubKeyIsNotSet } if bytes.Equal(vote.ValidatorAddress, cs.privValidatorPubKey.Address()) { cs.Logger.Error( "Found conflicting vote from ourselves. Did you unsafe_reset a validator?", "height", vote.Height, "round", vote.Round, "type", vote.Type) return added, err } cs.evpool.ReportConflictingVotes(voteErr.VoteA, voteErr.VoteB) return added, err } else if err == types.ErrVoteNonDeterministicSignature { cs.Logger.Debug("Vote has non-deterministic signature", "err", err) } else { // Either // 1) bad peer OR // 2) not a bad peer? this can also err sometimes with "Unexpected step" OR // 3) tmkms use with multiple validators connecting to a single tmkms instance // (https://github.com/tendermint/tendermint/issues/3839). cs.Logger.Info("Error attempting to add vote", "err", err) return added, ErrAddingVote } } return added, nil }
1
Go
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
func (p *CompactProtocol) ReadListBegin() (elemType Type, size int, err error) { size_and_type, err := p.readByteDirect() if err != nil { return } size = int((size_and_type >> 4) & 0x0f) if size == 15 { size2, e := p.readVarint32() if e != nil { err = NewProtocolException(e) return } if size2 < 0 { err = invalidDataLength return } size = int(size2) } if uint64(size) > p.trans.RemainingBytes() || p.trans.RemainingBytes() == UnknownRemaining { err = invalidDataLength return } elemType, e := p.getType(compactType(size_and_type)) if e != nil { err = NewProtocolException(e) return } return }
1
Go
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
safe
func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) { params := k.GetParams(ctx) expEpochID := k.GetEpochIdentifier(ctx) if epochIdentifier != expEpochID { return } // mint coins, update supply epochMintProvision, found := k.GetEpochMintProvision(ctx) if !found { panic("the epochMintProvision was not found") } mintedCoin := sdk.NewCoin(params.MintDenom, epochMintProvision.TruncateInt()) if err := k.MintAndAllocateInflation(ctx, mintedCoin); err != nil { panic(err) } // check if a period is over. If it's completed, update period, and epochMintProvision period := k.GetPeriod(ctx) epochsPerPeriod := k.GetEpochsPerPeriod(ctx) newProvision := epochMintProvision // current epoch number needs to be within range for the period // Given, epochNumber = 1, period = 0, epochPerPeriod = 365 // 1 - 365 * 0 < 365 --- nothing to do here // Given, epochNumber = 731, period = 1, epochPerPeriod = 365 // 731 - 1 * 365 > 365 --- a period has passed! we change the epochMintProvision and set a new period if epochNumber-epochsPerPeriod*int64(period) > epochsPerPeriod { period++ k.SetPeriod(ctx, period) period = k.GetPeriod(ctx) bondedRatio := k.stakingKeeper.BondedRatio(ctx) newProvision = types.CalculateEpochMintProvision( params, period, epochsPerPeriod, bondedRatio, ) k.SetEpochMintProvision(ctx, newProvision) } ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeMint, sdk.NewAttribute(types.AttributeEpochNumber, fmt.Sprintf("%d", epochNumber)), sdk.NewAttribute(types.AttributeKeyEpochProvisions, newProvision.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), ), ) }
0
Go
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
func TestReportConflictingVotes(t *testing.T) { var height int64 = 10 pool, pv := defaultTestPool(height) val := types.NewValidator(pv.PrivKey.PubKey(), 10) ev := types.NewMockDuplicateVoteEvidenceWithValidator(height+1, defaultEvidenceTime, pv, evidenceChainID) pool.ReportConflictingVotes(ev.VoteA, ev.VoteB) // shouldn't be able to submit the same evidence twice pool.ReportConflictingVotes(ev.VoteA, ev.VoteB) // evidence from consensus should not be added immediately but reside in the consensus buffer evList, evSize := pool.PendingEvidence(defaultEvidenceMaxBytes) require.Empty(t, evList) require.Zero(t, evSize) next := pool.EvidenceFront() require.Nil(t, next) // move to next height and update state and evidence pool state := pool.State() state.LastBlockHeight++ state.LastBlockTime = ev.Time() state.LastValidators = types.NewValidatorSet([]*types.Validator{val}) pool.Update(state, []types.Evidence{}) // should be able to retrieve evidence from pool evList, _ = pool.PendingEvidence(defaultEvidenceMaxBytes) require.Equal(t, []types.Evidence{ev}, evList) }
1
Go
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
func (m *MockAuthorizeResponder) GetCode() string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCode") ret0, _ := ret[0].(string) return ret0 }
1
Go
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
func TestAuthorizeTeamPacks(t *testing.T) { t.Parallel() runTestCases(t, []authTestCase{ // Team maintainer can read packs of the team. { user: test.UserTeamMaintainerTeam1, object: &fleet.Pack{ TeamIDs: []uint{1}, }, action: read, allow: true, }, // Team observer cannot read packs of the team. { user: test.UserTeamObserverTeam1TeamAdminTeam2, object: &fleet.Pack{ TeamIDs: []uint{1}, }, action: read, allow: false, }, // Team observer cannot write packs of the team. { user: test.UserTeamObserverTeam1TeamAdminTeam2, object: &fleet.Pack{ TeamIDs: []uint{1}, }, action: write, allow: false, }, // Members of a team cannot read packs of another team. { user: test.UserTeamAdminTeam1, object: &fleet.Pack{ TeamIDs: []uint{2}, }, action: read, allow: false, }, // Members of a team cannot read packs of another team. { user: test.UserTeamAdminTeam1, object: &fleet.Pack{ TeamIDs: []uint{2}, }, action: read, allow: false, }, // Team maintainers can read global packs. { user: test.UserTeamMaintainerTeam1, object: &fleet.Pack{}, action: read, allow: true, }, // Team admins can read global packs. { user: test.UserTeamAdminTeam1, object: &fleet.Pack{}, action: read, allow: true, }, // Team admins cannot write global packs. { user: test.UserTeamAdminTeam1, object: &fleet.Pack{}, action: write, allow: false, }, }) }
0
Go
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
func (s *FositeMemoryStore) ClientAssertionJWTValid(_ context.Context, jti string) error { s.RLock() defer s.RUnlock() if exp, exists := s.BlacklistedJTIs[jti]; exists && exp.After(time.Now()) { return errors.WithStack(fosite.ErrJTIKnown) } return nil }
1
Go
CWE-294
Authentication Bypass by Capture-replay
A capture-replay flaw exists when the design of the software makes it possible for a malicious user to sniff network traffic and bypass authentication by replaying it to the server in question to the same effect as the original message (or with minor changes).
https://cwe.mitre.org/data/definitions/294.html
safe
func (s *FositeSQLStore) SetClientAssertionJWT(ctx context.Context, j string, exp time.Time) error { db := s.db(ctx) // delete expired if _, err := db.ExecContext(ctx, fmt.Sprintf("DELETE FROM hydra_oauth2_%s WHERE expires_at < now()", sqlTableBlacklistedJTI)); err != nil { return sqlcon.HandleError(err) } if err := s.setClientAssertionJWT(ctx, newBlacklistedJTI(j, exp)); errors.Is(err, sqlcon.ErrUniqueViolation) { // found a jti return errors.WithStack(fosite.ErrJTIKnown) } else if err != nil { return err } // setting worked without a problem return nil }
1
Go
CWE-294
Authentication Bypass by Capture-replay
A capture-replay flaw exists when the design of the software makes it possible for a malicious user to sniff network traffic and bypass authentication by replaying it to the server in question to the same effect as the original message (or with minor changes).
https://cwe.mitre.org/data/definitions/294.html
safe
func (m *MockAuthorizeResponder) GetHeader() http.Header { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetHeader") ret0, _ := ret[0].(http.Header) return ret0 }
1
Go
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
func (mr *MockAuthorizeRequesterMockRecorder) AppendRequestedScope(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendRequestedScope", reflect.TypeOf((*MockAuthorizeRequester)(nil).AppendRequestedScope), arg0) }
1
Go
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
func (ua *UserAPI) Post() { if !(ua.AuthMode == common.DBAuth) { ua.SendForbiddenError(errors.New("")) return } if !(ua.SelfRegistration || ua.IsAdmin) { log.Warning("Registration can only be used by admin role user when self-registration is off.") ua.SendForbiddenError(errors.New("")) return } user := models.User{} if err := ua.DecodeJSONReq(&user); err != nil { ua.SendBadRequestError(err) return } err := validate(user) if err != nil { log.Warningf("Bad request in Register: %v", err) ua.RenderError(http.StatusBadRequest, "register error:"+err.Error()) return } if !ua.IsAdmin && user.HasAdminRole { msg := "Non-admin cannot create an admin user." log.Errorf(msg) ua.SendForbiddenError(errors.New(msg)) return } userExist, err := dao.UserExists(user, "username") if err != nil { log.Errorf("Error occurred in Register: %v", err) ua.SendInternalServerError(errors.New("internal error")) return } if userExist { log.Warning("username has already been used!") ua.SendConflictError(errors.New("username has already been used")) return } emailExist, err := dao.UserExists(user, "email") if err != nil { log.Errorf("Error occurred in change user profile: %v", err) ua.SendInternalServerError(errors.New("internal error")) return } if emailExist { log.Warning("email has already been used!") ua.SendConflictError(errors.New("email has already been used")) return } userID, err := dao.Register(user) if err != nil { log.Errorf("Error occurred in Register: %v", err) ua.SendInternalServerError(errors.New("internal error")) return } ua.Redirect(http.StatusCreated, strconv.FormatInt(userID, 10)) }
1
Go
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
safe
func (p *CompactProtocol) ReadMapBegin() (keyType Type, valueType Type, size int, err error) { size32, e := p.readVarint32() if e != nil { err = NewProtocolException(e) return } if size32 < 0 { err = invalidDataLength return } if uint64(size32*2) > p.trans.RemainingBytes() || p.trans.RemainingBytes() == UnknownRemaining { err = invalidDataLength return } size = int(size32) keyAndValueType := byte(STOP) if size != 0 { keyAndValueType, err = p.readByteDirect() if err != nil { return } } keyType, _ = p.getType(compactType(keyAndValueType >> 4)) valueType, _ = p.getType(compactType(keyAndValueType & 0xf)) return }
1
Go
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
safe
if err := utils.WithProcfd(c.root, b.Destination, func(procfd string) error { flags := defaultMountFlags if m.Flags&unix.MS_RDONLY != 0 { flags = flags | unix.MS_RDONLY } var ( source = "cgroup" data = filepath.Base(subsystemPath) ) if data == "systemd" { data = cgroups.CgroupNamePrefix + data source = "systemd" } return unix.Mount(source, procfd, "cgroup", uintptr(flags), data) }); err != nil { return err } } else { if err := mountToRootfs(b, c); err != nil { return err } } }
1
Go
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The program contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.
https://cwe.mitre.org/data/definitions/362.html
safe
func (m *NidOptEnum) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowThetest } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NidOptEnum: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NidOptEnum: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Field1", wireType) } m.Field1 = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowThetest } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Field1 |= TheTestEnum(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipThetest(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthThetest } if (iNdEx + skippy) < 0 { return ErrInvalidLengthThetest } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil }
0
Go
CWE-129
Improper Validation of Array Index
The product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array.
https://cwe.mitre.org/data/definitions/129.html
vulnerable
func (*UpdateAccountRequest) Descriptor() ([]byte, []int) { return file_console_proto_rawDescGZIP(), []int{36} }
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (m *MockRefreshTokenStrategy) RefreshTokenSignature(arg0 string) string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RefreshTokenSignature", arg0) ret0, _ := ret[0].(string) return ret0 }
1
Go
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
func (x *UpdateGroupRequest) ProtoReflect() protoreflect.Message { mi := &file_console_proto_msgTypes[37] 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) }
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable