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 primary?
@primary
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 closed?
!@server || @server.closed?
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 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 | 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 "returns a new session" do
session.with(new_options).should_not eql session
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 delete_attachment
Log.add_info(request, params.inspect)
return unless request.post?
begin
attach = Attachment.find(params[:attachment_id])
@item = Item.find(attach.item_id)
unless @item.check_user_auth(@login_user, 'w', true)
raise t('msg.need_to_be_owner')
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 test_jail_instances_should_have_limited_methods
expected = ["class", "inspect", "method_missing", "methods", "respond_to?", "respond_to_missing?", "to_jail", "to_s", "instance_variable_get"]
expected.delete('respond_to_missing?') if RUBY_VERSION > '1.9.3' # respond_to_missing? is private in rubies above 1... | 0 | 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 | vulnerable |
def default_ids_hash(populate_values = false)
ids = HashWithIndifferentAccess.new
hash_keys.each do |col|
ids[col] = populate_values ? Array(self.send(col)) : []
end
ids
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 kill_cursors(*args)
raise NotImplementedError, "#kill_cursors cannot be called on Context; it must be called directly on a node"
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_value(user_id, category, key)
SqlHelper.validate_token([user_id, category, key])
con = []
con << "(user_id=#{user_id})"
con << "(category='#{category}')"
con << "(xkey='#{key}')"
setting = Setting.where(con.join(' and ')).first
return setting.xvalue unless setting.nil?
... | 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 install_location filename, destination_dir # :nodoc:
raise Gem::Package::PathError.new(filename, destination_dir) if
filename.start_with? '/'
destination_dir = File.realpath destination_dir if
File.respond_to? :realpath
destination_dir = File.expand_path destination_dir
destination =... | 1 | Ruby | CWE-59 | Improper Link Resolution Before File Access ('Link Following') | The software attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. | https://cwe.mitre.org/data/definitions/59.html | safe |
def check_owner
return if params[:id].blank? or @login_user.nil?
begin
owner_id = Workflow.find(params[:id]).user_id
rescue
owner_id = -1
end
if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id
Log.add_check(request, '[check_owner]'+request.to_s)
fl... | 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(database, command)
super database, :$cmd, command, limit: -1
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 receive_replies(operations)
operations.map do |operation|
read if operation.is_a?(Protocol::Query) || operation.is_a?(Protocol::GetMore)
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 get_mail_content
Log.add_info(request, params.inspect)
email_id = params[:id]
begin
@email = Email.find(email_id)
render(:partial => 'ajax_mail_content', :layout => false)
rescue => evar
Log.add_error(nil, evar)
render(:text => '')
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 drop_on_desktop
Log.add_info(request, params.inspect)
return unless request.post?
if @login_user.nil?
t = Time.now
render(:text => (t.hour.to_s + t.min.to_s + t.sec.to_s))
return
end
toy = Toy.new
toy.user_id = @login_user.id
toy.x = params[:x].to_i
toy.y = pa... | 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 "with params as nil" do
cl = subject.build_command_line("true", nil)
expect(cl).to eq "true"
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 paidhld_update
Log.add_info(request, params.inspect)
return unless request.post?
year = params[:year].to_i
num = params[:num].to_f
user = User.find(params[:user_id])
unless user.nil?
PaidHoliday.update_for(user.id, year, num)
end
flash[:notice] = t('msg.update_success')
... | 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 "with params as nil" do
cl = subject.build("true", nil)
expect(cl).to eq "true"
end | 1 | 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 | safe |
def remote_remove_node(params, request, session)
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, 'Permission denied'
end
if params[:remove_nodename] != nil
retval, output = remove_node(session, params[:remove_nodename])
else
return 400, "No nodename specified"
end
if re... | 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 initialize
@counter = 0
@machine_id = Digest::MD5.digest(Socket.gethostname).unpack("N")[0]
@mutex = Mutex.new
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 stop
Log.add_info(request, params.inspect)
return unless request.post?
ApplicationHelper.delete_file_safe(Research.get_pages)
render(:text => '')
rescue => evar
Log.add_error(request, evar)
render(:text => evar.to_s)
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 "changes the fields returned" do
users.insert(documents)
users.find(scope: scope).select(_id: 0).to_a.should eq documents
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 proxy(client, mongo)
incoming_message = client.read(16)
length, op_code = incoming_message.unpack("l<x8l<")
incoming_message << client.read(length - 16)
if op_code == OP_QUERY && ismaster_command?(incoming_message)
# Intercept the ismaster command and send our own re... | 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 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... | 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 "creates an index with no options" do
indexes.create name: 1
indexes[name: 1].should_not be_nil
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 login(username, password)
session.context.login(name, username, password)
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 destroy
Log.add_info(request, params.inspect)
return unless request.post?
if params[:check_equipment].nil?
list
render(:action => 'list')
return
end
count = 0
params[:check_equipment].each do |equipment_id, value|
SqlHelper.validate_token([equipment_id])
if... | 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 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
user_id = params[:user_id]
zeptair_id = params[:zeptair_id]
group_id = params[:grou... | 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(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-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 "with params as empty Hash" do
cl = subject.build("true", {})
expect(cl).to eq "true"
end | 1 | 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 | safe |
it 'does not log in with incorrect two factor' do
post "/session/email-login/#{email_token.token}", params: {
second_factor_token: "0000",
second_factor_method: UserSecondFactor.methods[:totp]
}
expect(response.status).to eq(200)
... | 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 nofollowify_links(string)
if this_blog.dofollowify
string
else
string.gsub(/<a(.*?)>/i, '<a\1 rel="nofollow">')
end
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 "connects and yields the secondary node" do
Time.stub(:new).and_return(Time.now + 10)
replica_set.with_secondary do |node|
node.command "admin", ping: 1
@secondaries.map(&:address).should include node.address
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 |
it "passes the initial directory" do
expect(File.cleanpath('C/../../D')).to eq "../D"
end | 0 | 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 t... | https://cwe.mitre.org/data/definitions/22.html | vulnerable |
def destroy_profile_sheet
Log.add_info(request, params.inspect)
return unless request.post?
user_id = params[:id]
@user = User.find(user_id)
item_id = @user.item_id
@user.update_attribute(:item_id, nil)
Item.find(item_id).destroy
@item = nil
render(:partial => 'ajax_profile_sh... | 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_map
Log.add_info(request, params.inspect)
@group_id = (params[:id] || '0') # '0' for ROOT
SqlHelper.validate_token([@group_id])
@office_map = OfficeMap.get_for_group(@group_id)
session[:group_id] = params[:id]
session[:group_option] = 'office_map'
render(:partial => 'ajax_map'... | 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 entries(path=nil, identifier=nil, options={})
p1 = scm_iconv(@path_encoding, 'UTF-8', path)
manifest = hg('rhmanifest', '-r', CGI.escape(hgrev(identifier)),
'--', CGI.escape(without_leading_slash(p1.to_s))) do |io|
output = io.read.force_encoding('UTF-... | 0 | Ruby | NVD-CWE-noinfo | null | null | null | vulnerable |
it "should redeem the invite if invited by non staff and approve if staff not required to approve" do
inviter = invite.invited_by
user = invite_redeemer.redeem
expect(user.name).to eq(name)
expect(user.username).to eq(username)
expect(user.invited_by).to eq(inviter)
expect(invit... | 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 "returns distinct values for +key+" do
users.insert(documents)
users.find(scope: scope).distinct(:count).should =~ [0, 1]
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 self.get_value(user_id, category, key)
SqlHelper.validate_token([user_id, category, key])
con = []
con << "(user_id=#{user_id})"
con << "(category='#{category}')"
con << "(xkey='#{key}')"
setting = Setting.where(con.join(' and ')).first
return setting.xvalue unless setting.nil?
... | 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 protected!
gui_request = ( # these are URLs for web pages
request.path == '/' or
request.path == '/manage' or
request.path == '/permissions' or
request.path.match('/managec/.+/main')
)
if request.path.start_with?('/remote/') or request.path == '/run_pcs'
unless PCSAuth.lo... | 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 |
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(:first_name => 'Billy').and_return([@user])
User.should_receive(:where).with(:last_na... | 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.get_childs(folder_id, conditions, recursive, admin, ret_obj)
SqlHelper.validate_token([folder_id])
arr = []
if recursive
folder_tree = Folder.get_tree(Hash.new, conditions, folder_id, admin)
return [] if folder_tree.nil?
folder_tree.each do |parent_id, childs|
if ret... | 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 remove_constraint_rule_remote(params, request, session)
if not allowed_for_local_cluster(session, Permissions::WRITE)
return 403, 'Permission denied'
end
if params[:rule_id]
retval = remove_constraint_rule(session, params[:rule_id])
if retval == 0
return "Constraint rule #{params[:rule_id]} ... | 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 remove_all_groups
check_write_access!
self.package_group_role_relationships.delete_all
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 |
it "should reject a subjectAltName for a non-DNS value" do
@request.stubs(:subject_alt_names).returns ['DNS:foo', 'email:bar@example.com']
expect { @ca.sign(@name, true) }.to raise_error(
Puppet::SSL::CertificateAuthority::CertificateSigningError,
/subjectAltName outside the DN... | 0 | 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 | vulnerable |
it "to xml" do
expect(user.to_xml).to eql([user.name].to_xml)
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 |
def get_items
if params[:action] == 'get_items'
Log.add_info(request, params.inspect)
end
@folder_id = params[:id]
SqlHelper.validate_token([@folder_id])
if Folder.check_user_auth(@folder_id, @login_user, 'r', true)
=begin
# if !@login_user.nil? and @login_user.admin?(User::AUTH_ITEM)... | 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 destroy
Log.add_info(request, params.inspect)
return unless request.post?
begin
Item.destroy(params[:id])
rescue => evar
Log.add_error(request, evar)
end
if params[:from_action].nil?
render(:text => params[:id])
else
params.delete(:controller)
params.de... | 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_cluster_tokens(params, request, session)
# pcsd runs as root thus always returns hacluster's tokens
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, "Permission denied"
end
on, off = get_nodes
nodes = on + off
nodes.uniq!
return [200, JSON.generate(get_tokens_of_nodes(n... | 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 execute(op)
mode = options[:consistency] == :eventual ? :read : :write
socket = socket_for(mode)
if safe?
last_error = Protocol::Command.new(
"admin", { getlasterror: 1 }.merge(safety)
)
socket.execute(op, last_error).documents.first.tap do |result|
... | 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 query(database, collection, selector, options = {})
if consistency == :eventual
options[:flags] ||= []
options[:flags] |= [:slave_ok]
end
with_node do |node|
node.query(database, collection, selector, options)
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 |
it "should choose :file_server when the settings name is 'puppet' and no server is specified" do
modules = mock 'modules'
@request.expects(:protocol).returns "puppet"
@request.expects(:server).returns nil
Puppet.settings.expects(:value).with(:name).returns "puppet"
@object... | 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 self.get_group_value(group_id, category, key)
SqlHelper.validate_token([group_id, category, key])
con = []
con << "(group_id=#{group_id.to_i})"
con << "(category='#{category}')"
con << "(xkey='#{key}')"
setting = Setting.where(con.join(' and ')).first
return setting.xvalue unless s... | 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 "creates a hostgroup with a parent parameter" do
post :create, {"hostgroup" => {"name"=>"test_it", "parent_id" => @base.id, :realm_id => realms(:myrealm).id,
:group_parameters_attributes => {"0" => {:name => "x", :value =>"overridden", :_destroy => ""}}}}, set_session_u... | 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 "removes the socket" do
cluster.should_receive(:remove).with(dead_server)
cluster.socket_for :write
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 remove_all
session.with(consistency: :strong) do |session|
session.context.remove operation.database,
operation.collection,
operation.selector
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 |
it "returns the result of the block" do
session.with(new_options) { false }.should eq false
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 "delegates to the cluster" do
session.cluster.should_receive(:socket_for).with(:read)
session.send(:socket_for, :read)
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 start
@nodes.each &:start
@worker = Thread.start do
Thread.abort_on_exception = true
catch(:shutdown) do
loop do
Moped.logger.debug "replica_set: waiting for next client"
server, client = @manager.next_client
if server
Mope... | 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 do_project_copy( params )
# copy entire project in the backend
begin
path = "/source/#{URI.escape(self.name)}"
path << Suse::Backend.build_query_from_hash(params, [:cmd, :user, :comment, :oproject, :withbinaries, :withhistory, :makeolder])
Suse::Backend.post path, nil
rescue Suse::Ba... | 0 | 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 | vulnerable |
def begin(name)
stack(name).push true
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 delete_break
Log.add_info(request, params.inspect)
return unless request.post?
@timecard = Timecard.find(params[:id])
if params[:org_start].nil?
org_start = nil
else
org_start = UtilDateTime.parse(params[:org_start]).to_time
end
@timecard.delete_break(org_start)
un... | 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(session, configs, nodes, cluster_name, tokens={})
@configs = configs
@nodes = nodes
@cluster_name = cluster_name
@published_configs_names = @configs.collect { |cfg|
cfg.class.name
}
@additional_tokens = tokens
@session = session
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 group
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[:display] == 'mine'
redirect_to(:action => 'month')... | 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 "recognizes and generates #index" do
{ :get => "/users" }.should route_to(:controller => "users", :action => "index")
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 create_patchinfo_from_request(req)
check_write_access!
patchinfo = Package.new(:name => "patchinfo", :title => "Patchinfo", :description => "Collected packages for update")
self.packages << patchinfo
patchinfo.add_flag("build", "enable", nil, nil)
patchinfo.add_flag("useforbuild", "disable", ... | 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 instantiate variant, mac=nil
# Filenames must end in a hex representation of a mac address but only if mac is not empty
log_halt 403, "Invalid MAC address: #{mac}" unless valid_mac?(mac) || mac.nil?
log_halt 403, "Unrecognized pxeboot config type: #{variant}" unless de... | 0 | Ruby | CWE-284 | Improper Access Control | The software does not restrict or incorrectly restricts access to a resource from an unauthorized actor. | https://cwe.mitre.org/data/definitions/284.html | vulnerable |
def tok(s)
case s[0]
when ?{ then ['{', s[0,1], s[0,1]]
when ?} then ['}', s[0,1], s[0,1]]
when ?: then [':', s[0,1], s[0,1]]
when ?, then [',', s[0,1], s[0,1]]
when ?[ then ['[', s[0,1], s[0,1]]
when ?] then [']', s[0,1], s[0,1]]
when ?n then nulltok(s)
when ?t then truetok(s)
... | 1 | Ruby | CWE-399 | Resource Management Errors | Weaknesses in this category are related to improper management of system resources. | https://cwe.mitre.org/data/definitions/399.html | safe |
def gate_process
HistoryHelper.keep_last(request)
@login_user = User.find_by_id(session[:login_user_id])
begin
if @login_user.nil? \
or @login_user.time_zone.nil? or @login_user.time_zone.empty?
unless THETIS_USER_TIMEZONE_DEFAULT.nil? or THETIS_USER_TIMEZONE_DEFAULT.empty?
... | 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 restart
stop
start
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 file_list io # :nodoc:
header = String.new
read_until_dashes io do |line|
header << line
end
YAML.load header
end | 0 | 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 | vulnerable |
it "sorts the results" do
users.insert(documents)
users.find(scope: scope).sort(n: -1).to_a.should eq documents.reverse
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 update_images_order
Log.add_info(request, params.inspect)
order_ary = params[:images_order]
item = Item.find(params[:id])
item.images_without_content.each do |img|
class << img
def record_timestamps; false; end
end
img.update_attribute(:xorder, order_ary.index(img.id.... | 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 "returns the value from the block" do
session.with { :value }.should eq :value
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 redirect_back_or_default(default, options={})
back_url = params[:back_url].to_s
if back_url.present?
begin
uri = URI.parse(back_url)
# do not redirect user to another host or to the login or register page
if ((uri.relative? && back_url.match(%r{\A/\w})) || (uri.host == reques... | 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 self.save_group_value(group_id, category, key, value)
SqlHelper.validate_token([group_id, category, key])
con = []
con << "(group_id=#{group_id.to_i})"
con << "(category='#{category}')"
con << "(xkey='#{key}')"
setting = Setting.where(con.join(' and ')).first
if value.nil?
un... | 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 response' do
get "/session/email-login/adasdad"
expect(response.status).to eq(200)
expect(CGI.unescapeHTML(response.body)).to match(
I18n.t('email_login.invalid_token')
)
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 update_map
Log.add_info(request, params.inspect)
group_id = params[:group_id]
SqlHelper.validate_token([group_id])
@office_map = OfficeMap.get_for_group(group_id, true)
params[:office_map].delete(:group_id)
@office_map.update_attributes(params.require(:office_map).permit(OfficeMap::PER... | 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 "inserts a single document" do
document = { "_id" => Moped::BSON::ObjectId.new, "scope" => scope }
session[:users].insert(document)
session[:users].find(document).one.should eq document
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_update_valid
Realm.any_instance.stubs(:valid?).returns(true)
put :update, {:id => Realm.first.name,
:realm => { :realm_proxy_id => SmartProxy.first.id } }, set_session_user
assert_equal SmartProxy.first.id, Realm.first.realm_proxy_id
assert_redirected_to realms_url
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 login
Log.add_info(request, '') # Not to show passwords.
user = User.authenticate(params[:user])
if user.nil?
flash[:notice] = '<span class=\'font_msg_bold\'>'+t('user.u_name')+'</span>'+t('msg.or')+'<span class=\'font_msg_bold\'>'+t('password.name')+'</span>'+t('msg.is_invalid')
if ... | 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 each
documents = load
documents.each { |doc| yield doc }
while more?
return kill if limited? && @limit <= 0
documents = get_more
documents.each { |doc| yield doc }
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 show
if params[:action] == 'show'
Log.add_info(request, params.inspect)
end
@mail_filter = MailFilter.find_by_id(params[:id])
if @mail_filter.nil?
render(:text => 'ERROR:' + t('msg.already_deleted', :name => MailFilter.model_name.human))
return
else
if @mail_filter.mai... | 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 self.set_statistics_groups(group_ids)
yaml = Research.get_config_yaml
yaml = Hash.new if yaml.nil?
if group_ids.nil?
unless yaml[:statistics].nil?
yaml[:statistics].delete(:groups)
end
else
if yaml[:statistics].nil?
yaml[:statistics] = Hash.new
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 insert(documents)
documents = [documents] unless documents.is_a? Array
database.session.with(consistency: :strong) do |session|
session.context.insert(database.name, name, documents)
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 valid?(user, password)
return false if user.blank?
if PasswordHash.legacy?(user.password, password)
update_password(user, password)
return true
end
PasswordHash.verified?(user.password, password)
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 self.load input
::YAML.safe_load(input, [::Symbol])
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 |
def update
article = Ticket::Article.find(params[:id])
authorize!(article)
clean_params = Ticket::Article.association_name_to_id_convert(params)
clean_params = Ticket::Article.param_cleanup(clean_params, true)
# only apply preferences changes (keep not updated keys/values)
clean_params = art... | 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 |
def hg(*args, &block)
# as of hg 4.4.1, early parsing of bool options is not terminated at '--'
if args.any? { |s| s =~ HG_EARLY_BOOL_ARG }
raise HgCommandArgumentError, "malicious command argument detected"
end
if args.take_while { |s| s != '--' }.any? { |s| ... | 0 | Ruby | NVD-CWE-noinfo | null | null | null | vulnerable |
it "rejects a file if named .html and is as HTML, but we're told JPG" do
file = File.open(fixture_file("empty.html"))
assert Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "image/jpg").spoofed?
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 |
def generate(time, counter = 0)
[time, @machine_id, Process.pid, counter << 8].pack("N NX lXX NX")
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.using(file, name, content_type)
new(file, name, content_type)
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 |
def get_mail_attachment
Log.add_info(request, params.inspect)
attached_id = params[:id].to_i
begin
mail_attach = MailAttachment.find(attached_id)
rescue => evar
end
if mail_attach.nil?
redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html')
return
end
begin
email... | 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 database" do
collection.database.should eq database
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 attachments_without_content
return [] if self.id.nil?
sql = 'select id, title, memo, name, size, content_type, comment_id, xorder, location from attachments'
sql << ' where comment_id=' + self.id.to_s
sql << ' order by xorder ASC'
begin
attachments = Attachment.find_by_sql(sql)
res... | 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 ajax_move_items
Log.add_info(request, params.inspect)
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')
get_items... | 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 quote_column_name(name) #:nodoc:
@quoted_column_names[name] ||= "`#{name}`"
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 "re-enabled functionality if whitelisted" do
Rack::MiniProfiler.config.authorization_mode = :whitelist
expect(Rack::MiniProfiler).to receive(:request_authorized?) { true }.twice
get '/html?pp=enable'
last_response.body.should include('/mini-profiler-resources/includes.js')
... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.