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 remove_all
delete = Protocol::Delete.new(
operation.database,
operation.collection,
operation.selector
)
session.with(consistency: :strong) do |session|
session.execute delete
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 login(database, username, password)
auth[database.to_s] = [username, password]
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.get_sql_like(attr_names, keyword)
key = ActiveRecord::Base.connection.quote("%#{SqlHelper.escape_for_like(keyword)}%")
con = []
attr_names.each do |attr_name|
con << "(#{attr_name} like #{key})"
end
sql = con.join(' or ')
sql = '(' + sql + ')' if con.length > 1
return sql
... | 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_upload_binaries
ActionController::IntegrationTest::reset_auth
post "/build/home:Iggy/10.2/i586/TestPack", nil
assert_response 401
prepare_request_with_user "adrian", "so_alone"
post "/build/home:Iggy/10.2/i586/TestPack", nil
assert_response 403
prepare_request_with_user "king", ... | 1 | Ruby | CWE-434 | Unrestricted Upload of File with Dangerous Type | The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | safe |
def get_folder_items
Log.add_info(request, params.inspect)
unless params[:thetisBoxSelKeeper].blank?
@folder_id = params[:thetisBoxSelKeeper].split(':').last
end
begin
if Folder.check_user_auth(@folder_id, @login_user, 'r', true)
@items = Folder.get_items(@login_user, @folder_id)... | 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 sanitize_string(host)
if host.start_with?(".")
/\A(.+\.)?#{Regexp.escape(host[1..-1])}\z/i
else
/\A#{Regexp.escape host}\z/i
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 add_fence_level(session, level, devices, node, remove = false)
if not remove
stdout, stderr, retval = run_cmd(
session, PCS, "stonith", "level", "add", level, node, devices
)
return retval,stdout, stderr
else
stdout, stderr, retval = run_cmd(
session, PCS, "stonith", "level", "remove... | 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 use the sender address is no return path is specified" do
Mail.defaults do
delivery_method :exim
end
mail = Mail.new do
to "to@test.lindsaar.net"
from "from@test.lindsaar.net"
sender "sender@test.lindsaar.net"
subject "Can't set the return-path"
... | 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_using_size(mail_account_id, add_con=nil)
SqlHelper.validate_token([mail_account_id])
con = []
con << "(mail_account_id=#{mail_account_id})"
con << "(#{add_con})" unless add_con.nil? or add_con.empty?
return (Email.count_by_sql("select SUM(size) from emails where #{con.join(' and ')... | 0 | 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 comments_closed?
!(allow_comments? && in_feedback_window?)
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 set_disp_ctrl
Log.add_info(request, params.inspect)
return unless request.post?
folder_id = params[:id]
SqlHelper.validate_token([folder_id])
if Folder.check_user_auth(folder_id, @login_user, 'w', true)
@folder = Folder.find(folder_id)
disp_ctrls = []
check_bbs_top = par... | 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 "handles Symbol keys" do
cl = subject.build_command_line("true", :abc => "def")
expect(cl).to eq "true --abc def"
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 add_group( group, role )
check_write_access!
unless role.kind_of? Role
role = Role.get_by_title(role)
end
if role.global
#only nonglobal roles may be set in a project
raise SaveError, "tried to set global role '#{role_title}' for group '#{group}' in package '#{self.name}'"
e... | 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_auth_plain
sock = FakeSocket.new
smtp = Net::SMTP.new 'localhost', 25
smtp.instance_variable_set :@socket, sock
assert smtp.auth_plain("foo", "bar").success?
assert_equal "AUTH PLAIN AGZvbwBiYXI=\r\n", sock.write_io.string
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 self.trim_by_capacity(user_id, mail_account_id, capacity_mb)
# FEATURE_MAIL_STRICT_CAPACITY >>>
=begin
# max_size = capacity_mb * 1024 * 1024
# cur_size = MailAccount.get_using_size(mail_account_id)
#
# if cur_size > max_size
# over_size = cur_size - max_size
# emails = []
#
# # First, em... | 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_for(user_id, fiscal_year=nil)
SqlHelper.validate_token([user_id, fiscal_year])
begin
con = []
con << "(user_id=#{user_id})"
if fiscal_year.nil?
return PaidHoliday.where(con).order('year ASC').to_a
else
con << "(year=#{fiscal_year})"
return PaidHol... | 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 'should not choke on valueless attributes' do
@s.fragment('foo <a href>foo</a> bar')
.must_equal 'foo <a href="" rel="nofollow">foo</a> bar'
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 generate(time, inc = 0)
pid = Process.pid % 0xFFFF
[
time >> 24 & 0xFF, # 4 bytes time (network order)
time >> 16 & 0xFF,
time >> 8 & 0xFF,
time & 0xFF,
@machine_id[0], # 3 bytes machine
@machine_id[1],
... | 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 test_destroy
@model.hosts.clear
@model.interfaces.clear
@model.domains.clear
delete :destroy, {:id => @model}, set_session_user
assert_redirected_to subnets_url
refute Subnet.exists?(@model.id)
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 test_execute_details
spec_fetcher do |fetcher|
fetcher.spec 'a', 2 do |s|
s.summary = 'This is a lot of text. ' * 4
s.authors = ['Abraham Lincoln', 'Hirohito']
s.homepage = 'http://a.example.com/'
end
fetcher.legacy_platform
end
@cmd.handle_options %w[-r -d]... | 1 | Ruby | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | safe |
def self.save_value(user_id, category, key, value)
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
if value.nil?
unless setting.ni... | 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 order_by
order_option = ''
if self.order_column
direction = self.order_direction || 'ASC'
order_option = "#{self.order_column} #{direction}"
end
order_option.present? ? order_option : @@default_order
end | 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_acl_permission(session, acl_role_id, perm_type, xpath_id, query_id)
stdout, stderror, retval = run_cmd(
session, PCS, "acl", "permission", "add", acl_role_id.to_s, perm_type.to_s,
xpath_id.to_s, query_id.to_s
)
if retval != 0
if stderror.empty?
return "Error adding permission"
else
... | 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 update
Log.add_info(request, params.inspect)
return unless request.post?
@address = Address.find(params[:id])
@address.attributes = params[:address]
@address = AddressbookHelper.arrange_per_scope(@address, @login_user, params[:scope], params[:groups], params[:teams])
if @address.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 process_preflight(env)
result = Result.preflight(env)
resource, error = match_resource(env)
unless resource
result.miss(error)
return {}
end
return resource.process_preflight(env, result)
end | 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 |
it "respects #sort" do
users.find(scope: scope).sort(_id: -1).one.should eq documents.last
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 from_time(time, options = {})
from_data(options[:unique] ? @@generator.next(time.to_i) : [ time.to_i ].pack("Nx8"))
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 "does not reject is content_type is empty but otherwise checks out" do
file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "").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 ==(other)
@host == other.host && @port == other.port
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 ismaster_command?(incoming_message)
data = StringIO.new(incoming_message)
data.read(20) # header and flags
data.gets("\x00") # collection name
data.read(8) # skip/limit
selector = Moped::BSON::Document.deserialize(data)
selector == { "ismaster" => 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 remove_constraint(session, constraint_id)
stdout, stderror, retval = run_cmd(
session, PCS, "constraint", "remove", constraint_id
)
$logger.info stdout
return retval
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 get_avail_fence_agents(params, request, session)
if not allowed_for_local_cluster(session, Permissions::READ)
return 403, 'Permission denied'
end
agents = getFenceAgents(session)
return JSON.generate(agents)
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 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 ... | 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 distinct values for +key+" do
users.insert(documents)
users.find(scope: scope).distinct(:count).should =~ [0, 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 |
it "creates an index with the provided name" do
indexes.create(key, name: "custom_index_name")
indexes[key]["name"].should eq "custom_index_name"
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 render_with_explicit_unescaped_template
render :template => "test/h*llo_world"
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 get_stonith_agents_avail(session)
code, result = send_cluster_request_with_token(
session, params[:cluster], 'get_avail_fence_agents'
)
return {} if 200 != code
begin
sa = JSON.parse(result)
if (sa["noresponse"] == true) or (sa["notauthorized"] == "true") or (sa["notoken"] == true) or (sa["pacem... | 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 alive?
if Kernel::select([self], nil, nil, 0)
!eof? rescue false
else
true
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 make_hs256_token(payload = nil)
payload = { sub: 'abc123' } if payload.nil?
JWT.encode payload, client_secret, 'HS256'
end | 0 | Ruby | CWE-347 | Improper Verification of Cryptographic Signature | The software does not verify, or incorrectly verifies, the cryptographic signature for data. | https://cwe.mitre.org/data/definitions/347.html | vulnerable |
def move
Log.add_info(request, params.inspect)
return unless request.post?
@group = Group.find(params[:id])
unless params[:thetisBoxSelKeeper].blank?
parent_id = params[:thetisBoxSelKeeper].split(':').last
childs = @group.get_childs(true, false)
if childs.include?(parent_id) or ... | 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 __bson_dump__(io, key)
io << Types::OBJECT_ID
io << key
io << NULL_BYTE
io << data.pack('C12')
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.get_group_folder(group_id)
SqlHelper.validate_token([group_id])
begin
return Folder.where("(owner_id=#{group_id}) and (xtype='#{Folder::XTYPE_GROUP}')").first
rescue => evar
Log.add_error(nil, evar)
return nil
end
end | 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 gate_process
HistoryHelper.keep_last(request)
@login_user = User.find(session[:login_user_id])
begin
if @login_user.nil? \
or @login_user.time_zone.nil? or @login_user.time_zone.empty?
unless THETIS_USER_TIMEZONE_DEFAULT.nil? or THETIS_USER_TIMEZONE_DEFAULT.empty?
... | 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 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-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 "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 refresh
info = command "admin", ismaster: 1
@refreshed_at = Time.now
primary = true if info["ismaster"]
secondary = true if info["secondary"]
peers = []
peers.push info["primary"] if info["primary"]
peers.concat info["hosts"] if info["hosts"]
peers.concat info["... | 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_destroy
subnet = Subnet.first
subnet.hosts.clear
subnet.interfaces.clear
subnet.domains.clear
delete :destroy, {:id => subnet}, set_session_user
assert_redirected_to subnets_url
assert !Subnet.exists?(subnet.id)
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 tmp_dir
ENV['TMPDIR'] || ENV['TEMP'] || '/tmp'
end | 0 | Ruby | CWE-310 | Cryptographic Issues | Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not address... | https://cwe.mitre.org/data/definitions/310.html | vulnerable |
it "executes a distinct command" do
database.should_receive(:command).with(
distinct: collection.name,
key: "name",
query: selector
).and_return("values" => [ "durran", "bernerd" ])
query.distinct(:name)
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 legal?(string)
string.to_s =~ /^[0-9a-f]{24}$/i ? true : 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 |
def self.get_for(user_id, category=nil)
SqlHelper.validate_token([user_id, category])
con = []
con << "(user_id=#{user_id})"
con << "(category='#{category}')" unless category.nil?
settings = Setting.where(con.join(' and ')).to_a
return nil if settings.nil? or settings.empty?
hash = Ha... | 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 sync_server(server)
[].tap do |hosts|
socket = server.socket
if socket.connect
info = socket.simple_query Protocol::Command.new(:admin, ismaster: 1)
if info["ismaster"]
server.primary = true
end
if info["secondary"]
server.... | 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 team_organize
Log.add_info(request, params.inspect)
team_id = params[:team_id]
unless team_id.blank?
begin
@team = Team.find(team_id)
rescue
@team = nil
ensure
if @team.nil?
flash[:notice] = t('msg.already_deleted', :name => Team.model_name.human)
... | 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 secondaries
servers.select(&:secondary?)
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 self.delete_statistics_group(group_id)
yaml = Research.get_config_yaml
if yaml.nil? or yaml[:statistics].nil?
return []
end
groups = yaml[:statistics][:groups]
return [] if groups.nil?
ary = groups.split('|')
ary.delete group_id.to_s
ary.compact!
ary.delete ''
... | 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 show
filename = Rails.root.join("attachments", @attachment.filename)
unless File.exist?(filename)
COURSE_LOGGER.log("Cannot find the file '#{@attachment.filename}' for"\
" attachment #{@attachment.name}")
flash[:error] = "Error loading #{@attachment.name} from #{@attac... | 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 "syncs the cluster" do
cluster.should_receive(:sync) do
cluster.servers << server
end
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 get_auth_users
Log.add_info(request, params.inspect)
begin
@folder = Folder.find(params[:id])
rescue
@folder = nil
end
@users = []
session[:folder_id] = params[:id]
if !@login_user.nil? and (@login_user.admin?(User::AUTH_FOLDER) or (!@folder.nil? and @folder.in_my_folde... | 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 'should return nil if there is not key' do
expect(jwt_validator.jwks_key(:auth0, jwks_kid)).to eq(nil)
end | 0 | Ruby | CWE-347 | Improper Verification of Cryptographic Signature | The software does not verify, or incorrectly verifies, the cryptographic signature for data. | https://cwe.mitre.org/data/definitions/347.html | vulnerable |
def set_description
Log.add_info(request, params.inspect)
if params[:id].nil? or params[:id].empty?
@item = Item.new_info(0)
@item.attributes = params.require(:item).permit(Item::PERMIT_BASE)
@item.user_id = @login_user.id
@item.title = t('paren.no_title')
@item.save
else
... | 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 "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
@object.select(@request).should == :file_server
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 each
cursor = Cursor.new(session.with(retain_socket: true), operation)
cursor.to_enum.tap do |enum|
enum.each do |document|
yield document
end if block_given?
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 |
it "returns true" do
session.should be_safe
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 queue
Threaded.stack(:pipelined_operations)
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_tree_by_group_for_admin(group_id)
SqlHelper.validate_token([group_id])
folder_tree = {}
tree_id = '0'
if group_id.to_s == '0'
sql = 'select distinct * from folders'
where = " where (parent_id = #{tree_id})"
where << " and ((xtype is null) or not(xtype = '#{XTYPE_GROU... | 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 check_default_at_signup_permissions
all_permissions = Permission.all.pluck(:id)
admin_permissions = Permission.where('name LIKE ? OR name = ?', 'admin%', 'ticket.agent').pluck(:id) # admin.*/ticket.agent permissions
normal_permissions = (all_permissions - admin_permissions) | (admin_permissions - all_... | 0 | Ruby | NVD-CWE-noinfo | null | null | null | vulnerable |
def sync_server(server)
[].tap do |hosts|
socket = server.socket
if socket.connect
info = socket.simple_query Protocol::Command.new(:admin, ismaster: 1)
if info["ismaster"]
server.primary = true
end
if info["secondary"]
server.... | 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 |
it "yields the new session" do
session.stub(with: new_session)
session.new(new_options) do |session|
session.should eql new_session
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 |
it "raises no exception" do
lambda do
cluster.sync_server server
end.should_not raise_exception
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 "rejects #{node.inspect}" do
@report.host = node
expect { @report.process }.to raise_error(ArgumentError, /Invalid node/)
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 t... | https://cwe.mitre.org/data/definitions/22.html | safe |
def self.get_by_email(mail_addr, user, book=Address::BOOK_BOTH)
SqlHelper.validate_token([mail_addr])
email_con = []
email_con.push("(email1='#{mail_addr}')")
email_con.push("(email2='#{mail_addr}')")
email_con.push("(email3='#{mail_addr}')")
con = []
con.push('('+email_con.join(' or ')+... | 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 show_owners name
response = rubygems_api_request :get, "api/v1/gems/#{name}/owners.yaml" do |request|
request.add_field "Authorization", api_key
end
with_response response do |resp|
owners = YAML.load resp.body
say "Owners for gem: #{name}"
owners.each do |owner|
say ... | 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 |
def to_s
to_bson.unpack("H*")[0].force_encoding(UTF8)
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 delete_attachment
Log.add_info(request, '') # Not to show passwords.
target_user = nil
user_id = params[:user_id]
zeptair_id = params[:zeptair_id]
attachment_id = params[:attachment_id]
SqlHelper.validate_token([user_id, zeptair_id, attachment_id])
unless user_id.blank?
if @... | 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.get_tree(klass, tree, conditions, node_id, order_by)
SqlHelper.validate_token([node_id])
if conditions.nil?
con = ''
else
con = Marshal.load(Marshal.dump(conditions)) + ' and '
end
con << "(parent_id=#{node_id.to_i})"
tree[node_id] = klass.where(con).order(order_by).to_a... | 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_statistics_group
Log.add_info(request, params.inspect)
group_id = params[:group_id]
if group_id.nil? or group_id.empty?
@group_ids = Research.get_statistics_groups
render(:partial => 'ajax_statistics_groups', :layout => false)
return
end
@group_ids = Research.delet... | 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_role(what, role)
check_write_access!
self.transaction do
if what.kind_of? Group
self.package_group_role_relationships.create!(role: role, group: what)
else
self.package_user_role_relationships.create!(role: role, user: what)
end
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 stub_bad_jwks
stub_request(:get, 'https://samples.auth0.com/.well-known/jwks-bad.json')
.to_return(
status: 404
)
end | 0 | Ruby | CWE-347 | Improper Verification of Cryptographic Signature | The software does not verify, or incorrectly verifies, the cryptographic signature for data. | https://cwe.mitre.org/data/definitions/347.html | vulnerable |
def get_items_order
Log.add_info(request, params.inspect)
@folder_id = params[:id]
SqlHelper.validate_token([@folder_id])
if @folder_id != '0'
begin
@folder = Folder.find(@folder_id)
rescue => evar
@folder = nil
Log.add_error(request, evar)
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 store(opts = {})
# no write access check here, since this operation may will disable this permission ...
@commit_opts = opts
save!
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_update_valid
put :update, {:id => hostgroups(:common), :hostgroup => { :name => hostgroups(:common).name }}, set_session_user
assert_redirected_to hostgroups_url
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 hash
[ip_address, port].hash
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 logging(operations, &block)
Support::Stats.record(self, operations)
_logging(operations, &block)
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 "should return :file if the request key is fully qualified" do
@request.expects(:key).returns File.expand_path('/foo')
@object.select_terminus(@request).should == :file
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 tags_for_index(model)
model.tags.inject("".html_safe) do |out, tag|
query = controller.send(:current_query) || ""
hashtag = "##{tag}"
if query.empty?
query = hashtag
elsif !query.include?(hashtag)
query += " #{hashtag}"
end
out << link_to_function(tag, "crm.... | 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 validate_line(line)
# A bare CR or LF is not allowed in RFC5321.
if /[\r\n]/ =~ line
raise ArgumentError, "A line must not contain CR or LF"
end
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 initialize(seeds, direct = false)
@seeds = seeds
@direct = direct
@servers = []
@dynamic_seeds = []
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 get_official_titles
Log.add_info(request, params.inspect)
@group_id = (params[:id] || '0') # '0' for ROOT
SqlHelper.validate_token([@group_id])
session[:group_id] = params[:id]
session[:group_option] = 'official_title'
render(:partial => 'ajax_official_titles', :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 email
user_info['email'] || id_info['email']
end | 0 | Ruby | CWE-290 | Authentication Bypass by Spoofing | This attack-focused weakness is caused by improperly implemented authentication schemes that are subject to spoofing attacks. | https://cwe.mitre.org/data/definitions/290.html | vulnerable |
def ==(other)
return false unless other.is_a?(ObjectId)
to_bson == other.to_bson
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_user_archive_fields(user_archive)
user_archive_array = []
topic_data = user_archive.topic
user_archive = user_archive.as_json
topic_data = Topic.with_deleted.find_by(id: user_archive['topic_id']) if topic_data.nil?
return user_archive_array if topic_data.nil?
categories ... | 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 promote
@primary = true
@secondary = false
hiccup
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 "skips +n+ documents" do
users.insert(documents)
users.find(scope: scope).skip(1).to_a.should eq [documents.last]
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 testLoginByToken
users = []
users << {"username" => "user1", "token" => "token1"}
users << {"username" => "user2", "token" => "token2"}
users << {"username" => SUPERUSER, "token" => "tokenS"}
password_file = File.open($user_pass_file, File::RDWR|File::CREAT)
password_file.truncate(0)
p... | 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 self.search_by_user(key, operator, value)
key_name = key.sub(/^.*\./,'')
users = User.all(:conditions => "#{key_name} #{operator} '#{value_to_sql(operator, value)}'")
hosts = users.map(&:hosts).flatten
opts = hosts.empty? ? "= 'nil'" : "IN (#{hosts.map(&:id).join(','... | 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.trim(user_id, mail_account_id, max)
SqlHelper.validate_token([user_id, mail_account_id])
begin
count = Email.where("mail_account_id=#{mail_account_id.to_i}").count
if count > max
#logger.fatal("[INFO] Email.trim(user_id:#{user_id}, mail_account_id:#{mail_account_id}, max:#{max})")
... | 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 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 ... | 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.search_by_puppetclass(key, operator, value)
conditions = "puppetclasses.name #{operator} '#{value_to_sql(operator, value)}'"
hosts = Host.my_hosts.all(:conditions => conditions, :joins => :puppetclasses, :select => 'DISTINCT hosts.id').map(&:id)
host_groups = Hostgr... | 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 check_owner
return if params[:id].nil? or params[:id].empty? or @login_user.nil?
begin
owner_id = Item.find(params[:id]).user_id
rescue
owner_id = -1
end
if !@login_user.admin?(User::AUTH_ITEM) and owner_id != @login_user.id
Log.add_check(request, '[check_owner]'+request.to_... | 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-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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.