code stringlengths 12 2.05k | label int64 0 1 | programming_language stringclasses 9
values | cwe_id stringlengths 6 14 | cwe_name stringlengths 5 103 ⌀ | description stringlengths 36 1.23k ⌀ | url stringlengths 36 48 ⌀ | label_name stringclasses 2
values |
|---|---|---|---|---|---|---|---|
def self.parse_csv_row(row, book, idxs, user)
imp_id = (idxs[0].nil? or row[idxs[0]].nil?)?(nil):(row[idxs[0]].strip)
SqlHelper.validate_token([imp_id])
unless imp_id.blank?
org_address = Address.find_by_id(imp_id)
end
if org_address.nil?
address = Address.new
else
address ... | 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 to_s
@@string_format % data.unpack("C12")
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 set_attachment
Log.add_info(request, params.inspect)
return unless request.post?
created = false
if params[:id].blank?
@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_tit... | 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 resource_status(params, request, session)
if not allowed_for_local_cluster(session, Permissions::READ)
return 403, 'Permission denied'
end
resource_id = params[:resource]
@resources,@groups = getResourcesGroups(session)
location = ""
res_status = ""
@resources.each {|r|
if r.id == resource_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 match?(name, ip)
if ip?
if pattern.include?(IPAddr.new(ip))
Puppet.deprecation_warning "Authentication based on IP address is deprecated; please use certname-based rules instead"
true
else
false
end
else
matchname?(nam... | 1 | 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 | safe |
def demote
@primary = false
@secondary = true
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 "returns a new session" do
session.with(new_options).should_not eql session
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_more(database, collection, cursor_id, limit)
process Protocol::GetMore.new(database, collection, cursor_id, limit)
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 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 |
it "doesn't log in the user when not approved" do
SiteSetting.must_approve_users = true
get "/session/email-login/#{email_token.token}"
expect(response.status).to eq(200)
expect(CGI.unescapeHTML(response.body)).to include(
I18n.t("login.not_approved")
)
e... | 0 | Ruby | NVD-CWE-noinfo | null | null | null | vulnerable |
def reconnect
@servers = servers.map { |server| Server.new(server.address) }
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 "raises a connection error" do
lambda do
node.ensure_connected do
node.command("admin", ping: 1)
end
end.should raise_exception(Moped::Errors::ConnectionFailure)
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
def create_clamp_code(nbits, signed)
if signed == :signed
max = (1 << (nbits - 1)) - 1
min = -(max + 1)
else
max = (1 << nbits) - 1
min = 0
end
"val = (val < #{min}) ? #{min} : (val > #{max}) ? #{max} : val"
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.search_by_user(key, operator, value)
key_name = key.sub(/^.*\./,'')
condition = sanitize_sql_for_conditions(["? #{operator} ?", key_name, value_to_sql(operator, value)])
users = User.all(:conditions => condition)
hosts = users.map(&:hosts).flatten
opts ... | 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
@sock = nil
@request_id = 0
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 'supports passing read options to RMagick' do
expect_any_instance_of(::Magick::Image::Info).to receive(:density=).with(10)
expect_any_instance_of(::Magick::Image::Info).to receive(:size=).with("200x200")
instance.manipulate! :read => {
:density => 10,
:size => %{"200x200"}
... | 0 | 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 | vulnerable |
def query(operation)
reply = session.query operation
@get_more_op.limit -= reply.count if limited?
@get_more_op.cursor_id = reply.cursor_id
@kill_cursor_op.cursor_ids = [reply.cursor_id]
reply.documents
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 meeting_link(uniqueid, data)
notification = t(
"notifications.meeting.#{data[:type]}",
name: data[:user],
group_name: data[:group],
meeting_name: data[:typename]
)
link = specific_meeting_link(data[:type], data[:typeid], data[:group_id])
notification_link(uniqueid, link, no... | 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 check_action_permission!(skip_source = nil)
super(skip_source)
# only perform the following check, if we are called from
# BsRequest.permission_check_change_state! (that is, if
# skip_source is set to true). Always executing this check
# would be a regression, because this code is also execute... | 1 | Ruby | CWE-732 | Incorrect Permission Assignment for Critical Resource | The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. | https://cwe.mitre.org/data/definitions/732.html | safe |
def remote_remove_nodes(params, request, session)
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, 'Permission denied'
end
count = 0
out = ""
node_list = []
options = []
while params["nodename-" + count.to_s]
node_list << params["nodename-" + count.to_s]
count = count +... | 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.execute_action_move(mail_filter, email, val)
mail_folder_id = val
SqlHelper.validate_token([mail_folder_id])
begin
mail_folder = MailFolder.find(mail_folder_id)
rescue => evar
end
if !mail_folder.nil? and (mail_folder.user_id == email.user_id)
email.update_attribute(:mai... | 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_login_with_suburi_should_not_redirect_to_another_suburi
@relative_url_root = Redmine::Utils.relative_url_root
Redmine::Utils.relative_url_root = '/redmine'
back_urls = [
'http://test.host/',
'http://test.host/fake',
'http://test.host/fake/issues',
'http://test.host/redmin... | 0 | Ruby | NVD-CWE-Other | Other | NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset. | https://nvd.nist.gov/vuln/categories | vulnerable |
def initialize(seeds, options = {})
@cluster = Cluster.new(seeds)
@options = options
@options[:consistency] ||= :eventual
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_corosync_conf_remote(params, request, session)
if not allowed_for_local_cluster(session, Permissions::READ)
return 403, 'Permission denied'
end
return get_corosync_conf()
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 |
it "should not display completed tasks" do
task_1 = FactoryGirl.create(:task, :user_id => current_user.id, :name => "Your first task", :bucket => "due_asap", :assigned_to => current_user.id)
task_2 = FactoryGirl.create(:task, :user_id => current_user.id, :name => "Completed task", :bucket => "due_asap", :comple... | 0 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
def ajax_delete_mails
Log.add_info(request, params.inspect)
folder_id = params[:id]
mail_account_id = params[:mail_account_id]
unless params[:check_mail].blank?
mail_folder = MailFolder.find(folder_id)
trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRAS... | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
it "updates the selector to mongo's advanced selector" do
query.sort(a: 1)
query.operation.selector.should eq(
"$query" => selector,
"$orderby" => { a: 1 }
)
end | 0 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
def self.run!(reset: false) # :nodoc:
if check!
super
else
Null
end
end | 1 | Ruby | NVD-CWE-noinfo | null | null | null | safe |
def auth_session(auth = true)
session = Moped::Session.new auth_seeds, database: auth_database
session.login *auth_credentials if auth
session
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_auth_teams
Log.add_info(request, params.inspect)
folder_id = params[:id]
SqlHelper.validate_token([folder_id])
begin
@folder = Folder.find(folder_id)
rescue
@folder = nil
end
target_user_id = (@login_user.admin?(User::AUTH_TEAM))?(nil):(@login_user.id)
@teams = T... | 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 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)
... | 0 | 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 | vulnerable |
def calculated_content_type
@calculated_content_type ||= type_from_file_command.chomp
end | 0 | Ruby | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
def munge_name(name)
# LAK:NOTE http://snurl.com/21zf8 [groups_google_com]
# Change to name.downcase.split(".",-1).reverse for FQDN support
name.downcase.split(".").reverse
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 media_type_mismatch?
! supplied_file_media_types.include?(calculated_media_type)
end | 0 | Ruby | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
def get_group_equipment
Log.add_info(request, params.inspect)
@group_id = nil
if !params[:thetisBoxSelKeeper].nil?
@group_id = params[:thetisBoxSelKeeper].split(':').last
elsif !params[:group_id].blank?
@group_id = params[:group_id]
end
SqlHelper.validate_token([@group_id])
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 |
def with_node
if consistency == :eventual
cluster.with_secondary do |node|
yield node
end
else
cluster.with_primary do |node|
yield node
end
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 test_verify_security_policy_checksum_missing
skip 'openssl is missing' unless defined?(OpenSSL::SSL)
@spec.cert_chain = [PUBLIC_CERT.to_pem]
@spec.signing_key = PRIVATE_KEY
build = Gem::Package.new @gem
build.spec = @spec
build.setup_signer
FileUtils.mkdir 'lib'
FileUtils.touch ... | 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 media_types_from_name
@media_types_from_name ||= content_types_from_name.collect(&:media_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 address
"#{@host}:#{@port}"
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_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-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 ajax_delete_items
Log.add_info(request, params.inspect)
unless params[:check_item].blank?
is_admin = @login_user.admin?(User::AUTH_ITEM)
count = 0
params[:check_item].each do |item_id, value|
if value == '1'
begin
item = Item.find(item_id)
nex... | 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 set_auth_teams
Log.add_info(request, params.inspect)
@folder = Folder.find(params[:id])
if Folder.check_user_auth(@folder.id, @login_user, 'w', true)
read_teams = []
write_teams = []
teams_auth = params[:teams_auth]
unless teams_auth.nil?
teams_auth.each do |auth_para... | 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 update_config
Log.add_info(request, params.inspect)
return unless request.post?
yaml = ApplicationHelper.get_config_yaml
unless params[:timecard].blank?
yaml[:timecard] = Hash.new if yaml[:timecard].nil?
params[:timecard].each do |key, val|
yaml[:timecard][key] = val
... | 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_corosync_version()
begin
stdout, stderror, retval = run_cmd(
PCSAuth.getSuperuserSession, COROSYNC, "-v"
)
rescue
stdout = []
end
if retval == 0
match = /version\D+(\d+)\.(\d+)\.(\d+)/.match(stdout.join())
if match
return match[1..3].collect { | x | x.to_i }
end
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 edit
Log.add_info(request, params.inspect)
address_id = params[:id]
begin
@address = Address.find(address_id)
rescue => evar
@address = nil
Log.add_error(request, evar)
redirect_to(:controller => 'login', :action => 'logout')
return
end
render(:layout => (!r... | 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.validate_token(tokens, extra_chars=nil)
if extra_chars.nil?
extra_chars = ''
else
extra_chars = Regexp.escape(extra_chars.join())
end
regexp = Regexp.new("^[ ]*[a-zA-Z0-9_.@\\-#{extra_chars}]+[ ]*$")
[tokens].flatten.each do |token|
next if token.blank?
if token... | 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_for(user_id, date)
begin
con = "(user_id=#{user_id}) and (date='#{date}')"
return Timecard.where(con).first
rescue
end
return nil
end | 0 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
def get_terminus(request)
indirection.terminus(select(request))
end | 1 | Ruby | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | safe |
it "sets the query operation's limit field" do
query.limit(5)
query.operation.limit.should eq 5
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_default_for(user_id, xtype=nil)
SqlHelper.validate_token([user_id, xtype])
con = []
con << "(user_id=#{user_id})"
con << '(is_default=1)'
con << "(xtype='#{xtype}')" unless xtype.blank?
where = ''
unless con.nil? or con.empty?
where = 'where ' + con.join(' and ')
... | 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 update_attachments_order
Log.add_info(request, params.inspect)
return unless request.post?
order_ary = params[:attachments_order]
item = Item.find(params[:id])
item.attachments_without_content.each do |attach|
class << attach
def record_timestamps; false; end
end
... | 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 empty Hash" do
cl = subject.build_command_line("true", {})
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 |
it "sets the slave ok flag" do
stats = Support::Stats.collect do
session.with(consistency: :eventual)[:users].find(scope: scope).one
end
query = stats[:secondary].grep(Moped::Protocol::Query).first
query.flags.should include :slave_ok
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 drop other indexes" do
indexes[age: -1].should_not be_nil
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 setup
raise Puppet::Error.new("Puppet master is not supported on Microsoft Windows") if Puppet.features.microsoft_windows?
# Handle the logging settings.
if options[:debug] or options[:verbose]
if options[:debug]
Puppet::Util::Log.level = :debug
else
Puppet::Util::Log.leve... | 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 all matching documents" do
session.should_receive(:with, :consistency => :strong).
and_yield(session)
session.should_receive(:execute).with do |delete|
delete.flags.should eq []
delete.selector.should eq query.operation.selector
end
query.remove_all
... | 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 add_acl_remote(params, request, session)
if not allowed_for_local_cluster(session, Permissions::GRANT)
return 403, 'Permission denied'
end
if params["item"] == "permission"
retval = add_acl_permission(
session,
params["role_id"], params["type"], params["xpath_id"], params["query_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 crop_command
target = @attachment.instance
if target.cropping?(@attachment.name)
w = target.send :"#{@attachment.name}_crop_w"
h = target.send :"#{@attachment.name}_crop_h"
x = target.send :"#{@attachment.name}_crop_x"
y = target.send :"#{@attachment.name}_crop_y"
... | 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 "removes the first matching document" do
session.should_receive(:with, :consistency => :strong).
and_yield(session)
session.should_receive(:execute).with do |delete|
delete.flags.should eq [:remove_first]
delete.selector.should eq query.operation.selector
end
que... | 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 "should raise an error if the image fails an integrity check when downloaded" do
stub_request(:get, "www.example.com/test.jpg").to_return(body: File.read(file_path("test.jpg")))
expect(running {
@instance.remote_image_url = "http://www.example.com/test.jpg"
}).to raise_error(CarrierWav... | 0 | Ruby | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
def node_standby(params, request, session)
if params[:name]
code, response = send_request_with_token(
session, params[:name], 'node_standby', true, {"node"=>params[:name]}
)
# data={"node"=>params[:name]} for backward compatibility with older versions of pcs/pcsd
else
if not allowed_for_local_... | 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 legal?(str)
!!str.match(/^[0-9a-f]{24}$/i)
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 send_request_with_token(session, node, request, post=false, data={}, remote=true, raw_data=nil, timeout=30, additional_tokens={})
token = additional_tokens[node] || get_node_token(node)
$logger.info "SRWT Node: #{node} Request: #{request}"
if not token
$logger.error "Unable to connect to node #{node}, no ... | 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_acls(session, cib_dom=nil)
unless cib_dom
cib_dom = get_cib_dom(session)
return {} unless cib_dom
end
acls = {
'role' => {},
'group' => {},
'user' => {},
'target' => {}
}
cib_dom.elements.each('/cib/configuration/acls/*') { |e|
type = e.name[4..-1]
if e.name == 'acl_r... | 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 set_image
Log.add_info(request, params.inspect)
created = false
if params[:id].nil? or params[:id].empty?
@item = Item.new_info(0)
@item.attributes = params[:item]
@item.user_id = @login_user.id
@item.title = t('paren.no_title')
[:image0, :image1].each do |img|
... | 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 unfold(string)
string.gsub(/#{CRLF}#{WSP}+/, ' ').gsub(/#{WSP}+/, ' ')
end | 0 | 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 | vulnerable |
def test_update_invalid
AuthSourceLdap.any_instance.stubs(:valid?).returns(false)
put :update, {:id => AuthSourceLdap.first, :auth_source_ldap => {:name => AuthSourceLdap.first.name} }, set_session_user
assert_template 'edit'
end | 0 | Ruby | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
it "allows/disable marshalling" do
store = Redis::Store::Factory.create :marshalling => false
store.instance_variable_get(:@marshalling).must_equal(false)
store.instance_variable_get(:@options)[:raw].must_equal(true)
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 'should not overwrite an existing file if overwrite_stored_key is not set' do
@plugin.stubs(:lookup_config_option).with('learn_public_keys').returns('1')
@plugin.stubs(:lookup_config_option).with('publickey_dir').returns('ssh/pkd')
@plugin.stubs(:lookup_config_option).with('over... | 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 "does not raise error if record is not pending" do
reviewable = ReviewableUser.needs_review!(target: Fabricate(:user, email: invite.email), created_by: invite.invited_by)
reviewable.status = Reviewable.statuses[:ignored]
reviewable.save!
invite_redeemer.redeem
reviewabl... | 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 opposite_direction
direction.to_sym == :asc ? :desc : :asc
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 nodes
# Find the nodes that were down but are ready to be refreshed, or those
# with stale connection information.
needs_refresh, available = @nodes.partition do |node|
(node.down? && node.down_at < (Time.new - @options[:down_interval])) ||
node.needs_refresh?(Time.new - @opt... | 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 sanitize_value(value)
case value
when Array then value.collect { |i| i.to_s.shellescape }
when NilClass then value
else value.to_s.shellescape
end | 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 "should be a subclass of Base" do
Puppet::FileServing::Metadata.superclass.should equal(Puppet::FileServing::Base)
end | 1 | Ruby | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | safe |
it 'does not include user or group archived messages' do
UserArchivedMessage.archive!(user.id, group_message)
UserArchivedMessage.archive!(user.id, private_message)
topics = TopicQuery.new(nil).list_private_messages_all(user).topics
expect(topics).to eq([])
GroupArchivedMessage.arch... | 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 "handles Symbol keys with tailing '='" 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 destroy_workflow
Log.add_info(request, params.inspect)
Item.find(params[:id]).destroy
@tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS)
@group_id = params[:group_id]
if @group_id.nil? or @group_id.empty?
@group_id = '0' # '0'... | 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 spoofed?
if has_name? && has_extension? && media_type_mismatch? && mapping_override_mismatch?
Paperclip.log("Content Type Spoof: Filename #{File.basename(@name)} (#{supplied_file_content_types}), content type discovered from file command: #{calculated_content_type}. See documentation to allow this... | 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 accept
to_io.accept
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_groups_order
Log.add_info(request, params.inspect)
order_ary = params[:groups_order]
Research.set_statistics_groups order_ary
render(:text => '')
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 verify_active_session
if !request.post? && params[:status].blank? && User.exists?(session[:user].presence)
warning _("You have already logged in")
redirect_back_or_to hosts_path
return
end
end | 0 | Ruby | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
def authorized?(request)
origin_host = request.get_header("HTTP_HOST")&.slice(VALID_ORIGIN_HOST, 1) || ""
forwarded_host = request.x_forwarded_host&.slice(VALID_FORWARDED_HOST, 1) || ""
@permissions.allows?(origin_host) && (forwarded_host.blank? || @permissions.allows?(forwarded_host))
... | 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 test_ordering
User.current = users( :Iggy )
#project is given as axml
axml = Xmlhash.parse(
"<project name='home:Iggy'>
<title>Iggy's Home Project</title>
<description>dummy</description>
<repository name='images'>
<arch>local</arch>
<arch>i586</arch>... | 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 self.validate_token(tokens, extra_chars=nil)
if extra_chars.nil?
extra_chars = ''
else
extra_chars = Regexp.escape(extra_chars.join())
end
regexp = Regexp.new("^[ ]*[a-zA-Z0-9_#{extra_chars}]+[ ]*$")
[tokens].flatten.each do |token|
next if token.blank?
if token.to_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 |
def verify_spec_name
return if spec.name =~ Gem::Specification::VALID_NAME_PATTERN
raise Gem::InstallError, "#{spec} has an invalid name"
end | 1 | Ruby | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
def with_primary(retry_on_failure = true, &block)
if node = nodes.find(&:primary?)
begin
node.ensure_primary do
return yield node.apply_auth(auth)
end
rescue Errors::ConnectionFailure, Errors::ReplicaSetReconfigured
# Fall through to the code below if ... | 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 build(command, params = nil)
return command.to_s if params.nil? || params.empty?
"#{command} #{assemble_params(sanitize(params))}"
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 private_message_reset_new
topic_query = TopicQuery.new(current_user)
if params[:topic_ids].present?
unless Array === params[:topic_ids]
raise Discourse::InvalidParameters.new(
"Expecting topic_ids to contain a list of topic ids"
)
end
topic_scope = topic_query... | 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 cat(path, identifier=nil)
p = CGI.escape(scm_iconv(@path_encoding, 'UTF-8', path))
hg 'rhcat', '-r', CGI.escape(hgrev(identifier)), hgtarget(p) do |io|
io.binmode
io.read
end
rescue HgCommandAborted
nil # means not found
end | 0 | Ruby | NVD-CWE-noinfo | null | null | null | vulnerable |
def update_zept_allowed
Log.add_info(request, params.inspect)
return unless request.post?
user = User.find(params[:id])
zept_allowed = params[:zept_allowed]
if zept_allowed == 'true'
unless user.allowed_zept_connect?
user.update_attribute(:zeptair_id, User::ZEPTID_PLACE_HOLDER)
... | 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 do_execute
Log.add_info(request, params.inspect)
return unless request.post?
mail_account = MailAccount.find(params[:mail_account_id])
mail_folder = MailFolder.find(params[:mail_folder_id])
if mail_account.user_id != @login_user.id \
or mail_folder.user_id != @login_user.id
re... | 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 count" do
database.stub(command: { "n" => 4 })
query.count.should eq 4
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 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)
... | 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 first
limit(-1).each.first
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_for(group_id, include_parents=false, enabled=nil)
SqlHelper.validate_token([group_id])
con = []
#con << "(disabled=#{!enabled})" unless enabled.nil?
if include_parents
group_con = '(group_id is null)'
unless group_id.nil? or group_id.to_s == '0'
group_obj_cache = {... | 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 check_owner
return if params[:id].blank? or @login_user.nil?
mail_account = MailAccount.find(params[:id])
if !@login_user.admin?(User::AUTH_MAIL) and mail_account.user_id != @login_user.id
Log.add_check(request, '[check_owner]'+request.to_s)
flash[:notice] = t('msg.need_to_be_owner')
... | 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_path
Log.add_info(request, params.inspect)
if params[:thetisBoxSelKeeper].nil? or params[:thetisBoxSelKeeper].empty?
@group_path = '/' + t('paren.unknown')
render(:partial => 'ajax_group_path', :layout => false)
return
end
@selected_id = params[:thetisBoxSelKeeper].split(':... | 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 edit_timecard
Log.add_info(request, params.inspect)
date_s = params[:date]
if date_s.nil? or date_s.empty?
@date = Date.today
date_s = @date.strftime(Schedule::SYS_DATE_FORM)
else
@date = Date.parse(date_s)
end
@timecard = Timecard.get_for(@login_user.id, date_s)
... | 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 all campaigns belonging to the inbox to administrators' do
# create a random campaign
create(:campaign, account: account)
get "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}/campaigns",
headers: administrator.create_new_auth_token,
as: :json
... | 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 get_data_center_from_api_key(api_key)
# Return an empty string for invalid API keys so Gibbon hits the main endpoint
data_center = ""
if api_key && api_key["-"]
# Add a period since the data_center is a subdomain and it keeps things dry
data_center = "#{api_key.split('-').last... | 0 | Ruby | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.