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 create_local
Log.add_info(request, params.inspect)
return unless request.post?
@tmpl_folder, @tmpl_local_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_LOCAL)
unless @tmpl_local_folder.nil?
item = Item.new_info(@tmpl_local_folder.id)
item.title = t('template.new')... | 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 find(request)
get_terminus(request).find(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 'returns success' do
get "/session/email-login/#{email_token.token}"
expect(response).to redirect_to("/")
end | 0 | Ruby | NVD-CWE-noinfo | null | null | null | vulnerable |
def ensure_connected
# Don't run the reconnection login if we're already inside an
# +ensure_connected+ block.
return yield if Threaded.executing? :connection
Threaded.begin :connection
retry_on_failure = true
begin
connect unless connected?
yield
rescue E... | 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_quorum_info(params, request, session)
if not allowed_for_local_cluster(session, Permissions::READ)
return 403, 'Permission denied'
end
if ISRHEL6
stdout_status, stderr_status, retval = run_cmd(
PCSAuth.getSuperuserSession, CMAN_TOOL, "status"
)
stdout_nodes, stderr_nodes, retval = ru... | 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 reset_users
Log.add_info(request, params.inspect)
return unless request.post?
count = 0
unless params[:check_user].nil?
params[:check_user].each do |user_id, value|
if value == '1'
SqlHelper.validate_token([user_id])
begin
Research.destroy_all("use... | 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_escape_backtick
assert_equal "\\`", escape_javascript("`")
end | 1 | Ruby | CWE-80 | Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) | The software receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. | https://cwe.mitre.org/data/definitions/80.html | safe |
def write(*args)
raise Errors::ConnectionFailure, "Socket connection was closed by remote host" unless alive?
super
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
def test_update_invalid
Medium.any_instance.stubs(:valid?).returns(false)
put :update, {:id => Medium.first, :medium => {:name => nil}}, 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 |
def update_fence_device(params, request, session)
if not allowed_for_local_cluster(session, Permissions::WRITE)
return 403, 'Permission denied'
end
$logger.info "Updating fence device"
$logger.info params
param_line = getParamList(params)
$logger.info param_line
if not params[:resource_id]
out, ... | 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 test_mailfrom
sock = FakeSocket.new
smtp = Net::SMTP.new 'localhost', 25
smtp.instance_variable_set :@socket, sock
assert smtp.mailfrom("foo@example.com").success?
assert_equal "MAIL FROM:<foo@example.com>\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 |
it 'fails when local logins via email is disabled' do
SiteSetting.enable_local_logins_via_email = false
get "/session/email-login/#{email_token.token}"
expect(response.status).to eq(404)
end | 0 | Ruby | CWE-287 | Improper Authentication | When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct. | https://cwe.mitre.org/data/definitions/287.html | vulnerable |
def self.get_team_folder(team_id)
SqlHelper.validate_token([team_id])
begin
return Folder.where("(owner_id=#{team_id.to_i}) and (xtype='#{Folder::XTYPE_TEAM}')").first
rescue => evar
Log.add_error(nil, evar)
return nil
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 update_q_ctrl
Log.add_info(request, params.inspect)
item_id = params[:item_id]
q_code = params[:q_code]
q_param = params[:q_param]
cap = params[:caption]
yaml = Research.get_config_yaml
type = q_param.split(':').first
vals = q_param[type.length+1 .. -1]
yaml[q_code] = {:ite... | 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}").count
if count > max
#logger.fatal("[INFO] Email.trim(user_id:#{user_id}, mail_account_id:#{mail_account_id}, max:#{max})")
ov... | 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 status
{
"ismaster" => @primary,
"secondary" => @secondary,
"hosts" => @set.nodes.map(&:address),
"me" => address,
"maxBsonObjectSize" => 16777216,
"ok" => 1.0
}
end | 1 | Ruby | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
it "should be a subclass of Base" do
Puppet::FileServing::Content.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 |
def self.get_comment_of(item_id, user_id)
SqlHelper.validate_token([item_id, user_id])
begin
comment = Comment.where("(user_id=#{user_id}) and (item_id=#{item_id}) and (xtype='#{Comment::XTYPE_DIST_ACK}')").first
rescue => evar
Log.add_error(nil, evar)
end
return comment
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 install_location filename, destination_dir # :nodoc:
raise Gem::Package::PathError.new(filename, destination_dir) if
filename.start_with? '/'
destination_dir = File.realpath destination_dir if
File.respond_to? :realpath
destination_dir = File.expand_path destination_dir
destination =... | 0 | Ruby | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of t... | https://cwe.mitre.org/data/definitions/22.html | vulnerable |
def test_render_with_explicit_unescaped_template
assert_raise(ActionView::MissingTemplate) { get :render_with_explicit_unescaped_template }
get :render_with_explicit_escaped_template
assert_equal "Hello w*rld!", @response.body
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 :test_render_parse_nil_param do
assert_raises(ArgumentError) { parser.parse_memory(nil) }
end | 0 | Ruby | CWE-241 | Improper Handling of Unexpected Data Type | The software does not handle or incorrectly handles when a particular element is not the expected type, e.g. it expects a digit (0-9) but is provided with a letter (A-Z). | https://cwe.mitre.org/data/definitions/241.html | vulnerable |
def auth_node_configured?
ENV["MONGOHQ_SINGLE_PASS"]
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
def proxy(client, mongo)
incoming_message = client.read(16)
length, op_code = incoming_message.unpack("l<x8l<")
incoming_message << client.read(length - 16)
if op_code == OP_QUERY && ismaster_command?(incoming_message)
# Intercept the ismaster command and send our own re... | 1 | Ruby | CWE-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.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 ... | 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 "removes the stored credentials" do
cluster.logout :admin
cluster.auth.should be_empty
end | 0 | Ruby | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
def deliver!(mail)
envelope_from = mail.return_path || mail.sender || mail.from_addrs.first
return_path = "-f " + '"' + envelope_from.escape_for_shell + '"' if envelope_from
arguments = [settings[:arguments], return_path].compact.join(" ")
self.class.call(settings[:location], arguments, ma... | 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_configs_cluster(nodes, cluster_name)
data = {
'cluster_name' => cluster_name,
}
$logger.debug 'Fetching configs from the cluster'
threads = []
node_configs = {}
nodes.each { |node|
threads << Thread.new {
code, out = send_request_with_token(
... | 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 disconnect
auth.clear
connection.disconnect
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 on_moved
Log.add_info(request, params.inspect)
return unless request.post?
location_id = params[:id]
SqlHelper.validate_token([location_id])
if location_id.blank?
location = Location.get_for(@login_user)
if location.nil?
location = Location.new
location.user_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 initialize(hosts, options)
@options = {
down_interval: 30,
refresh_interval: 300
}.merge(options)
@seeds = hosts
@nodes = hosts.map { |host| Node.new(host) }
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 connect
connection.connect ip_address, port, timeout
@down_at = nil
refresh
rescue Timeout::Error
raise Errors::ConnectionFailure, "Timed out connection to Mongo on #{address}"
rescue Errno::ECONNREFUSED
raise Errors::ConnectionFailure, "Could not connect to Mongo on #{add... | 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 _unmarshal(val, options)
unmarshal?(val, options) ? Marshal.load(val) : val
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 "sets the object id's data" do
Moped::BSON::ObjectId.new(bytes).data.should == bytes
end | 0 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
def api_endpoint(uri)
host = uri.host
begin
res = @dns.getresource "_rubygems._tcp.#{host}",
Resolv::DNS::Resource::IN::SRV
rescue Resolv::ResolvError => e
verbose "Getting SRV record failed: #{e}"
uri
else
target = res.target.to_s.strip
if ... | 0 | Ruby | CWE-346 | Origin Validation Error | The software does not properly verify that the source of data or communication is valid. | https://cwe.mitre.org/data/definitions/346.html | vulnerable |
def set_cluster_conf(params, request, session)
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, 'Permission denied'
end
if params[:cluster_conf] != nil and params[:cluster_conf].strip != ""
Cfgsync::ClusterConf.backup()
Cfgsync::ClusterConf.from_text(params[:cluster_conf]).save... | 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 add_order_constraint(
session, resourceA, resourceB, actionA, actionB, score, symmetrical=true,
force=false, autocorrect=true
)
sym = symmetrical ? "symmetrical" : "nonsymmetrical"
if score != ""
score = "score=" + score
end
command = [
PCS, "constraint", "order", actionA, resourceA, "then",... | 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.get_for(mail_account_id, enabled=nil, trigger=nil)
return [] if mail_account_id.nil?
SqlHelper.validate_token([mail_account_id, trigger])
con = []
con << "(mail_account_id=#{mail_account_id.to_i})"
con << "(enabled=#{(enabled)?(1):(0)})" unless enabled.nil?
con << SqlHelper.get_sql... | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
it "stores whether the connection is direct" do
cluster.direct.should be_true
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 read_config(self, config, **kwargs):
self.recaptcha_private_key = config.get("recaptcha_private_key")
self.recaptcha_public_key = config.get("recaptcha_public_key")
self.enable_registration_captcha = config.get(
"enable_registration_captcha", False
)
self.reca... | 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 "doesn't try to set flags" do
session.stub(socket_for: socket)
expect { session.query(query) }.not_to raise_exception
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 is_a_copy?(folder_obj_cache=nil)
return false if self.source_id.nil?
# Exclude those created from system templates.
src_item = Item.find_by_id(self.source_id)
if src_item.nil?
return true
else
return !src_item.in_system_folder?(folder_obj_cache)
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 url_valid?(url)
url = begin
URI.parse(url)
rescue StandardError
false
end
url.is_a?(URI::HTTP) || url.is_a?(URI::HTTPS)
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 create_profile_sheet
Log.add_info(request, params.inspect)
return unless request.post?
user_id = params[:id]
@user = User.find(user_id)
@item = @user.create_profile_sheet
@user.update_attribute(:item_id, @item.id)
render(:partial => 'ajax_profile_sheet', :layout => false)
end | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
it "should reject a subjectAltName for a non-DNS value" do
@request.stubs(:subject_alt_names).returns ['DNS:foo', 'email:bar@example.com']
expect { @ca.check_internal_signing_policies(@name, @request, true) }.to raise_error(
Puppet::SSL::CertificateAuthority::CertificateSigningError,
... | 1 | Ruby | CWE-264 | Permissions, Privileges, and Access Controls | Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control. | https://cwe.mitre.org/data/definitions/264.html | safe |
def rename
Log.add_info(request, params.inspect)
return unless request.post?
@mail_folder = MailFolder.find(params[:id])
unless params[:thetisBoxEdit].blank?
@mail_folder.name = params[:thetisBoxEdit]
@mail_folder.save
end
render(:partial => 'ajax_folder_name', :layout => false)... | 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.find_by_sql_with_limit(sql, offset, limit)
sql = sanitize_sql(sql)
add_limit!(sql, {:limit => limit, :offset => offset})
find_by_sql(sql)
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_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].nil? and !params[:group_id].empty?
@group_id = params[:group_id]
end
submit_url = ur... | 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_by_ajax
Log.add_info(request, params.inspect)
return unless request.post?
cat_h = {:desktop => User::AUTH_DESKTOP, :user => User::AUTH_USER, :log => User::AUTH_LOG}
yaml = ApplicationHelper.get_config_yaml
cat_h.keys.each do |cat|
next if params[cat].blank?
unless @log... | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
it "changes the current database" do
session.use "moped_test_2"
session.command(dbStats: 1)["db"].should eq "moped_test_2"
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
it "yields all indexes on the collection" do
indexes.to_a.should eq \
session[:"system.indexes"].find(ns: "moped_test.users").to_a
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 "instructs the cluster to reconnect" do
session.stub(with: new_session)
new_session.cluster.should_receive(:reconnect)
session.new(new_options)
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 connection
@connection ||= Connection.new
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
def limited?
@query_op.limit > 0
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 test_execute_details_cleans_text
spec_fetcher do |fetcher|
fetcher.spec 'a', 2 do |s|
s.summary = 'This is a lot of text. ' * 4
s.authors = ["Abraham Lincoln \x01", "\x02 Hirohito"]
s.homepage = "http://a.example.com/\x03"
end
fetcher.legacy_platform
end
@cm... | 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 |
it "should find a user by first name and last name" do
@cur_user.stub(:pref).and_return(:activity_user => 'Billy Elliot')
controller.instance_variable_set(:@current_user, @cur_user)
User.should_receive(:where).with("(upper(first_name) LIKE upper('%Billy%') AND upper(last_name) LIKE upper('%Elliot%... | 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 query(query)
if options[:consistency] == :eventual
query.flags |= [:slave_ok] if query.respond_to? :flags
mode = :read
else
mode = :write
end
reply = socket_for(mode).execute(query)
reply.tap do |reply|
if reply.flags.include?(:query_failure)
... | 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.set_statistics_groups(group_ids)
yaml = Research.get_config_yaml
yaml = Hash.new if yaml.nil?
if group_ids.nil?
unless yaml[:statistics].nil?
yaml[:statistics].delete :groups
end
else
if yaml[:statistics].nil?
yaml[:statistics] = Hash.new
end
... | 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 "sets the object id's data" do
Moped::BSON::ObjectId.new(bytes).data.should == bytes
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 create_title
return unless request.post?
titles = User.get_config_titles
titles = [] if titles.nil?
titles << t('user.new_title')
User.save_config_titles(titles)
render(:partial => 'ajax_title', :layout => false)
end | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
it "should allow requests that are whitelisted" do
set_cookie("__profilin=stylin")
get '/whitelisted'
last_response.headers['X-MiniProfiler-Ids'].should_not be_nil
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 set_auth_users
Log.add_info(request, params.inspect)
@folder = Folder.find(params[:id])
if Folder.check_user_auth(@folder.id, @login_user, 'w', true)
read_users = []
write_users = []
users_auth = params[:users_auth]
unless users_auth.nil?
users_auth.each do |auth_par... | 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 "sanitizes crazy params" do
cl = subject.build("true", modified_params)
expect(cl).to eq "true --user bob --pass P@\\$sw0\\^\\&\\ \\|\\<\\>/-\\+\\*d\\% --db --desc=Some\\ Description --symkey --symkey-dash pkg1 some\\ pkg --pool 123 --pool 456"
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 index
respond_to do |format|
format.json do
dir = params[:dir]
dir = 'desc' unless SORT_DIRECTIONS.include?(dir.try(:upcase))
@occurrences = @bug.occurrences.order("occurred_at #{dir}").limit(50)
last = params[:last].present? ? @bug.occurrences.find_by_number(params[:la... | 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 output_versions output, versions
versions.each do |gem_name, matching_tuples|
matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse
platforms = Hash.new { |h,version| h[version] = [] }
matching_tuples.each do |n, _|
platforms[n.version] << n.platform if n.platform
... | 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 test_login_should_redirect_to_back_url_param
# request.uri is "test.host" in test environment
back_urls = [
'http://test.host/issues/show/1',
'http://test.host/',
'/'
]
back_urls.each do |back_url|
post :login, :username => 'jsmith', :password => 'jsmith', :back_url => back... | 1 | 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 | safe |
it "updates the first matching document" do
users.insert(documents)
users.find(scope: scope).update("$set" => { "updated" => true })
users.find(scope: scope, updated: true).count.should eq 1
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
it "should escape evil haxxor attemptes" do
Mail.defaults do
delivery_method :sendmail, :arguments => nil
end
mail = Mail.new do
from '"foo\";touch /tmp/PWNED;\""@blah.com'
to '"foo\";touch /tmp/PWNED;\""@blah.com'
subject 'invalid RFC2822'
end
Mail::Sendm... | 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_comment
Log.add_info(request, params.inspect)
return unless request.post?
unless params[:thetisBoxEdit].empty?
@comment = Comment.find(params[:comment_id])
if @comment.nil?
redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html' )
return
end
@comment.message... | 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 stop
@manager.shutdown
@nodes.each &:stop
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_by_ajax
Log.add_info(request, params.inspect)
cat_h = {:desktop => User::AUTH_DESKTOP, :user => User::AUTH_USER, :log => User::AUTH_LOG}
yaml = ApplicationHelper.get_config_yaml
cat_h.keys.each do |cat|
next if params[cat].nil? or params[cat].empty?
unless @login_user.admin... | 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 recognize #destroy" do
{ :delete => "/users/1" }.should_not be_routable
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 new(options = {})
session = with(options)
session.instance_variable_set(:@cluster, cluster.dup)
if block_given?
yield session
else
session
end
end | 1 | Ruby | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
def remove_resource(params, request, session)
if not allowed_for_local_cluster(session, Permissions::WRITE)
return 403, 'Permission denied'
end
force = params['force']
no_error_if_not_exists = params.include?('no_error_if_not_exists')
errors = ""
params.each { |k,v|
if k.index("resid-") == 0
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 current_database
return @current_database if defined? @current_database
if database = options[:database]
set_current_database(database)
else
raise "No database set for session. Call #use or #with before accessing the database"
end
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
it "should collapse all comments and emails on a specific contact" do
comment = double(Comment)
Comment.should_receive(:find).with("1").and_return(comment)
comment.should_receive(:update_attribute).with(:state, 'Collapsed')
xhr :get, :timeline, :type => "comment", :id => "1", :state => "Coll... | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
def each
documents = load
documents.each { |doc| yield doc }
while more?
return kill if limited? && @limit <= 0
documents = get_more
documents.each { |doc| yield doc }
end
end | 1 | Ruby | CWE-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)
return unless request.post?
order_ary = params[:groups_order]
Research.set_statistics_groups(order_ary)
render(:text => '')
end | 1 | Ruby | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
def test_reminders_should_only_include_issues_the_user_can_see
with_settings :default_language => 'en' do
user = User.find(3)
member = Member.create!(:project_id => 2, :principal => user, :role_ids => [1])
Issue.create!(:project_id => 2, :tracker_id => 1, :status_id => 1,
:... | 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 data
@data ||= @@generator.next
end | 1 | Ruby | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | safe |
def command(command)
operation = Protocol::Command.new(name, command)
result = session.with(consistency: :strong) do |session|
session.simple_query(operation)
end
raise Errors::OperationFailure.new(
operation, result
) unless result["ok"] == 1.0
result
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 html_postprocess(_field, html)
helper = ContentTextHelpers.new
helper.sanitize(helper.auto_link(html))
end | 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 to_s
@@string_format % data.unpack("C12")
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 read
reply = Protocol::Reply.allocate
reply.length,
reply.request_id,
reply.response_to,
reply.op_code,
reply.flags,
reply.cursor_id,
reply.offset,
reply.count = @sock.read(36).unpack('l5<q<l2<')
if reply.count == 0
reply.docume... | 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.connect(host, port, timeout)
Timeout::timeout(timeout) do
new(host, port).tap do |sock|
sock.set_encoding 'binary'
end
end
end | 1 | Ruby | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
def entries(path=nil, identifier=nil, options={})
p1 = scm_iconv(@path_encoding, 'UTF-8', path)
manifest = hg('rhmanifest', '-r', CGI.escape(hgrev(identifier)),
'--', CGI.escape(without_leading_slash(p1.to_s))) do |io|
output = io.read.force_encoding('UTF-... | 1 | Ruby | NVD-CWE-noinfo | null | null | null | safe |
def calculated_media_type
@calculated_media_type ||= calculated_content_type.split("/").first
end | 1 | Ruby | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
it "returns the query" do
query.limit(5).should eql query
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.generate_key_pair(key_base_name, recipient, real_name)
public_key_file_name = "#{key_base_name}.pub"
private_key_file_name = "#{key_base_name}.sec"
script = generate_key_script(public_key_file_name, private_key_file_name, recipient, real_name)
script_file = Tempfile.new('gpg-script'... | 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 |
it "raises an exception" do
expect { session.current_database }.to raise_exception
end | 0 | Ruby | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
def sanitize(params)
return [] if params.nil? || params.empty?
params.collect do |k, v|
[sanitize_key(k), sanitize_value(v)]
end
end | 1 | Ruby | CWE-78 | Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') | The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/78.html | safe |
it 'does not log in with incorrect two factor' do
post "/session/email-login/#{email_token.token}", params: {
second_factor_token: "0000",
second_factor_method: UserSecondFactor.methods[:totp]
}
expect(response.status).to eq(200)
... | 0 | Ruby | CWE-287 | Improper Authentication | When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct. | https://cwe.mitre.org/data/definitions/287.html | vulnerable |
def remove_constraint_rule(session, rule_id)
stdout, stderror, retval = run_cmd(
session, PCS, "constraint", "rule", "remove", rule_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 test_escape_dollar_sign
assert_equal "\\$", escape_javascript("$")
end | 1 | Ruby | CWE-80 | Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) | The software receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. | https://cwe.mitre.org/data/definitions/80.html | safe |
it "should reject a non-critical extension that isn't on the whitelist" do
@request.stubs(:request_extensions).returns [{ "oid" => "peach",
"value" => "meh",
"critical" => false }]
expect ... | 1 | Ruby | CWE-264 | Permissions, Privileges, and Access Controls | Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control. | https://cwe.mitre.org/data/definitions/264.html | safe |
it "returns a hex string representation of the id" do
Moped::BSON::ObjectId.from_data(bytes).to_s.should eq "4e4d66343b39b68407000001"
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 consistency
options[:consistency]
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 setup_cluster(params, request, session)
if not allowed_for_superuser(session)
return 403, 'Permission denied'
end
$logger.info("Setting up cluster: " + params.inspect)
nodes_rrp = params[:nodes].split(';')
options = []
myoptions = JSON.parse(params[:options])
transport_udp = false
options_udp = ... | 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 "does not set the slave ok flag" do
stats = Support::Stats.collect do
session.with(consistency: :strong)[:users].find(scope: scope).one
end
query = stats[:primary].grep(Moped::Protocol::Query).first
query.flags.should_not include :slave_ok
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 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.... | 1 | Ruby | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
it "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 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.