Security Advisories (9)
CVE-2020-11022 (2020-04-29)

In jQuery versions greater than or equal to 1.2 and before 3.5.0, passing HTML from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

CVE-2020-11023 (2020-04-29)

In jQuery versions greater than or equal to 1.0.3 and before 3.5.0, passing HTML containing <option> elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

CVE-2019-11358 (2019-04-20)

jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype.

CVE-2015-9251 (2018-01-18)

jQuery before 3.0.0 is vulnerable to Cross-site Scripting (XSS) attacks when a cross-domain Ajax request is performed without the dataType option, causing text/javascript responses to be executed.

CVE-2011-4969 (2013-03-08)

Cross-site scripting (XSS) vulnerability in jQuery before 1.6.3, when using location.hash to select elements, allows remote attackers to inject arbitrary web script or HTML via a crafted tag.

CVE-2012-6708 (2018-01-18)

jQuery before 1.9.0 is vulnerable to Cross-site Scripting (XSS) attacks. The jQuery(strInput) function does not differentiate selectors from HTML in a reliable fashion. In vulnerable versions, jQuery determined whether the input was HTML by looking for the '<' character anywhere in the string, giving attackers more flexibility when attempting to construct a malicious payload. In fixed versions, jQuery only deems the input to be HTML if it explicitly starts with the '<' character, limiting exploitability only to attackers who can control the beginning of a string, which is far less common.

CVE-2020-7656 (2020-05-19)

jquery prior to 1.9.0 allows Cross-site Scripting attacks via the load method. The load method fails to recognize and remove "<script>" HTML tags that contain a whitespace character, i.e: "</script >", which results in the enclosed script logic to be executed.

CVE-2019-5428

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as _proto_, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

CVE-2014-6071 (2018-01-16)

jQuery 1.4.2 allows remote attackers to conduct cross-site scripting (XSS) attacks via vectors related to use of the text method inside after.

NAME

Squatting::Controller - default controller class for Squatting

SYNOPSIS

package App::Controllers;
use Squatting ':controllers';
our @C = (
  C(
    Thread => [ '/forum/(\d+)/thread/(\d+)-(\w+)' ],
    get => sub {
      my ($self, $forum_id, $thread_id, $slug) = @_;
      #
      # get thread from database...
      #
      $self->render('thread');
    },
    post => sub {
      my ($self, $forum_id, $thread_id, $slug) = @_;
      # 
      # add post to thread
      #
      $self->redirect(R('Thread', $forum_id, $thread_id, $slug));
    }
  )
);

DESCRIPTION

Squatting::Controller is the default controller class for Squatting applications. Its job is to take HTTP requests and construct an appropriate response by setting up output headers and returning content.

API

Object Construction

Squatting::Controller->new($name => \@urls, %methods)

The constructor takes a name, an arrayref or URL patterns, and a hash of method definitions. There is a helper function called C() that makes this slightly less verbose.

$self->clone([ %opts ])

This will create a shallow copy of the controller. You may optionally pass in a hash of options that will be merged into the new clone.

HTTP Request Handlers

$self->get(@args)

$self->post(@args)

$self->put(@args)

$self->delete(@args)

$self->head(@args)

$self->options(@args)

$self->trace(@args)

$self->connect(@args)

These methods are called when their respective HTTP requests are sent to the controller. @args is the list of regex captures from the URL pattern in $self->urls that matched $self->env->{REQUEST_PATH}.

Attribute Accessors

The following methods are lvalue subroutines that contain information relevant to the current controller and current request/response cycle.

$self->name

This returns the name of the controller.

$self->urls

This returns the arrayref of URL patterns that the controller responds to.

$self->cr

This returns the Continuity::Request object for the current session.

$self->env

This returns a hashref populated with a CGI-like environment. This is where you'll find the incoming HTTP headers.

$self->input

This returns a hashref containing the incoming CGI parameters.

Example: Interpreting the query ?x=5&y=true&z=2&z=1&z=3 .

$self->input->{x} is         5
$self->input->{y} is    "true"
$self->input->{z} is [2, 1, 3]

@keys = $self->param

$value = $self->param($key)

$self->param($key, $value)

This is an accessor for $self->input that provides an API that's a subset of the CGI module's param() function. It exists, because there are many perl modules that can make use of an object that follows this API. It is not complete, but it should be good enough for WWW::Facebook::API::Canvas and many other modules.

$self->cookies

This returns a hashref that holds both the incoming and outgoing cookies.

Incoming cookies are just simple scalar values, whereas outgoing cookies are hashrefs that can be passed to CGI::Cookie to construct a cookie string.

Example: Setting a cookie named 'foo'

$self->cookies->{foo} = { -Value => 'bar', -Expires => '+1d' };

Example: Getting the value of a cookie named 'baz'

my $baz = $self->cookies->{baz};

$self->state

If you've setup sessions, this method will return the current session data as a hashref.

$self->v

This returns a hashref that represents the outgoing variables for this request. This hashref will be passed to a view's templates when render() is called.

$self->status

This returns an integer representing the outgoing HTTP status code. See HTTP::Status for more details.

$self->status = 404;  # Resource Not Found

$self->headers

This returns a hashref representing the outgoing HTTP headers.

Example: Setting the outgoing Content-Type to text/plain

$self->headers->{'Content-Type'} = 'text/plain';

$self->log

This returns a logging object if one has been set up for your app. If it exists, you should be able to call methods like debug(), info(), warn(), error(), and fatal() against it, and the output of this would typically end up in an error log.

$self->view

This returns the name of the default view for the current request. If it's undefined, the first view in @App::Views::V will be considered the default.

$self->app

This returns the name of the app that this controller belongs to.

Output

$self->render($template, [ $view ])

This method will return a string generated by the specified template and view. If a view is not specified, the first view object in @App::Views::V will be used.

$self->redirect($path, [ $status ])

This method is a shortcut for setting $self->status to 302 and $self->headers->{Location} to the specified URL. You may optionally pass in a different status code as the second parameter.

SEE ALSO

Squatting, Squatting::View