Security Advisories (11)
CVE-2018-14041 (2018-07-13)

In Bootstrap before 4.1.2, XSS is possible in the data-target property of scrollspy.

CVE-2018-14042 (2018-07-13)

In Bootstrap before 4.1.2, XSS is possible in the data-container property of tooltip.

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

UR::Observer - bind callbacks to object changes

SYNOPSIS

$rocket = Acme::Rocket->create(
    fuel_level => 100
);

$observer = $rocket->add_observer(
    aspect => 'fuel_level',
    callback => 
        sub {
            print "fuel level is: " . shift->fuel_level . "\n"
        },
    priority => 2,
);

$observer2 = UR::Observer->create(
    subject_class_name => 'Acme::Rocket',
    subject_id    => $rocket->id,
    aspect => 'fuel_level',
    callback =>
        sub {
            my($self,$changed_aspect,$old_value,$new_value) = @_;
            if ($new_value == 0) {
                print "Bail out!\n";
            }
        },
    priority => 0
);


for (3 .. 0) {
    $rocket->fuel_level($_);
}
# fuel level is: 3
# fuel level is: 2
# fuel level is: 1
# Bail out!
# fuel level is: 0

$observer->delete;

DESCRIPTION

UR::Observer implements the observer pattern for UR objects. These observers can be attached to individual object instances, or to whole classes. They can send notifications for changes to object attributes, or to other state changes such as when an object is loaded from its datasource or deleted.

CONSTRUCTOR

Observers can be created either by using the method add_observer() on another class, or by calling create() on the UR::Observer class.

my $o1 = Some::Other::Class->add_observer(...);
my $o2 = $object_instance->add_observer(...);
my $o3 = UR::Observer->create(...);

The constructor accepts these parameters:

subject_class_name

The name of the class the observer is watching. If this observer is being created via add_observer(), then it figures out the subject_class_name from the class or object it is being called on.

subject_id

The ID of the object the observer is watching. If this observer is being created via add_observer(), then it figures out the subject_id from the object it was called on. If add_observer() was called as a class method, then subject_id is omitted, and means that the observer should fire for changes on any instance of the class or sub-class.

priority

A numeric value used to determine the order the callbacks are fired. Lower numbers are higher priority, and are run before callbacks with a numerically higher priority. The default priority is 1. Negative numbers are ok.

aspect

The attribute the observer is watching for changes on. The aspect is commonly one of the properties of the class. In this case, the callback is fired after the property's value changes. aspect can be omitted, which means the observer should fire for any change in the object state. If both subject_id and aspect are omitted, then the observer will fire for any change to any instance of the class.

There are other, system-level aspects that can be watched for that correspond to other types of state change:

create

After a new object instance is created

delete

After an n object instance is deleted

load

After an object instance is loaded from its data source

commit

After an object instance has changes saved to its data source

callback

A coderef that is called after the observer's event happens. The coderef is passed four parameters: $self, $aspect, $old_value, $new_value. In this case, $self is the object that is changing, not the UR::Observer instance (unless, of course, you have created an observer on UR::Observer). The return value of the callback is ignored.

once

If the 'once' attribute is true, the observer is deleted immediately after the callback is run. This has the effect of running the callback only once, no matter how many times the observer condition is triggered.

note

A text string that is ignored by the system

Custom aspects

You can create an observer for an aspect that is neither a property nor one of the system aspects by listing the aspect names in the metadata for the class.

class My::Class {
    has => [ 'prop_a', 'another_prop' ],
    valid_signals => ['custom', 'pow' ],
};

my $o = My::Class->add_observer(
            aspect => 'pow',
            callback => sub { print "POW!\n" },
        );
My::Class->__signal_observers__('pow');  # POW!

my $obj = My::Class->create(prop_a => 1);
$obj->__signal_observers__('custom');  # not an error

To help catch typos, creating an observer for a non-standard aspect throws an exception unless the named aspect is in the list of 'valid_signals' in the class metadata. Nothing in the system will trigger these observers, but they can be triggered in your own code using the __signal_observers()__ class or object method. Sending a signal for an aspect that no observers are watching for is not an error.