Security Advisories (12)
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.

CVE-2018-14040 (2018-07-13)

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.

NAME

UR::Manual::Cookbook - Recepies for getting things working

Database Changes

Synchronizing your classes to the database schema

From under your application's Namespace directory, use the command-line tool

ur update classes

This will load all the data sources under the DataSource subdirectory of the Namespace, find out what has changed between the last time you ran update classes (possibly never) and now, save the current database schema information in the Namespace's MetaDB, and update the class definitions for any changed entities.

Possible conflicts

Avoid tables called 'type' or 'types'. It will conflict with the class metadata class names where their class names end in '::Type'. The 'ur update classes' tool will rename the class to 'YourNamespace::TypeTable' to avoid the conflict, while keeping the table_name the same.

A table with multiple primary keys should not have one of them called 'id'. This will result in a conflict with the requirement that a class must have have a property called 'id' that uniquely identifies a member.

Relationships

Class relationships provide a way to describe how one class links to another. They are added to a class by creating a property that lists how the class' properties relate to each other.

There are two basic kinds of relationships: forward and reverse, Forward relationships are used to model the has-a condition, where the primary class holds the ID of the related class's instance. Reverse relationships are used when the related class has a property pointing back to the primary class. They are usually used to model a has-many situation where the related class holds the ID of which primary class instance it is related to.

Has-a (One-to-one)

The container class/table has a foreign key pointing to a contained class/table as in

table Container
column          type        constraint
----------------------------------------
container_id    Integer     primary key
value           Varchar     not null
contained_id    Integer     references contained(contained_id)

table Contained
column          type        constraint
----------------------------------------
contained_id    Integer     primary key
contained_value Varchar   not null

Adding a forward relationship involves creating a property where the 'is' is the name of the related class, and an 'id_by' indicating which property on the primary class provides the foreign key with the related class' ID.

The class definition for the container would look like this:

class TheNamespace::Container {
   table_name => 'container',
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [ 
       value => { is => 'Varchar' },
   ],
   has_optional => [
       contained_id => { is => 'Integer' },
       contained => { is => 'TheNamespace::Contained',
                      id_by => 'contained_id' },
   ],
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

If there was a NOT NULL constraint on the contained_id column, then the contained_id and contained properties should go in the "has" section.

And now for the contained class. We'll also include a reverse relationship pointing back to the container it's a part of.

class TheNamespace::Contained {
   table_name => 'contained',
   id_by => [
       contained_id => { is => 'Integer' },
   ],
   has => [
       container => { is => 'TheNamespace::Container',
                      reverse_as => 'contained',
                      is_many => 1 },
       contained_value => { is => 'Varchar' },
   ],
   data_source => 'TheNamsapce::DataSource::TheDatabase',
};

Note that the reverse_as parameter of the container property actually points to the object accessor, not the id accessor. It doesn't make sense, but that's how it is for now. Hopefully we'll come up with a better syntax.

Has-many

The contained class/table has a foreign key pointing to the container it's a part of.

table Container
column          type        constraint
------------------------------------------
container_id    Integer     primary key
value           Varchar     not null

table Contained
column          type        constraint
------------------------------------------
contained_id    Integer     primary key
contained_value Varchar     not null
container_id    Integer     references container(container_id)

To create a reverse relationship, you must first create a forward relationship on the related class pointing back to the primary class. Then, creating the reverse relationship involves adding a property where the 'is' is the name of the related class, and a 'reverse_as' indicating which property on the related class describes the forward relationship between that related class and the primary class.

class TheNamespace::Container {
   table_name => 'container',
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       value => { is => 'Varchar' },
       containeds => { is => 'TheNamespace::Contained',
                       reverse_as => 'container',
                       is_many => 1 },
   ],
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

class TheNamespace::Contained {
   table_name => 'contained',
   id_by => [
       contained_id => { is => 'Integer' },
   ],
   has => [
       contained_value => { is => 'Varchar' },
       container_id => { is => 'Integer' },
       container => { is => 'TheNamespace::Container',
                      id_by => 'container_id' },
   ],
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

Many-to-many

Storing a has-many relationship requires a bridge table between the two main entities.

table Container
column          type        constraint
--------------------------------------------
container_id    Integer     primary key
value           Varchar     not null

table Contained
column          type        constraint
--------------------------------------------
contained_id    Integer     primary key
contained_value Varchar     not null
container_id    Integer     references container(container_id)

table Bridge
column          type        constraint
--------------------------------------------
container_id    Integer     references container(container_id)
contained_id    Integer     references contained(contained_id)
primary key(container_id,contained_id)

Here, both the Container and Contained classes have accessors to return a list of all the objects satisfying the relationship through the bridge table.

class TheNamespace::Container {
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       value => { is => 'Varchar' },
   ],
   has_many => [
       bridges =>    { is => 'TheNamespace::Bridge',
                       reverse_as => 'container' },
       containeds => { is => 'TheNamespace::Contained',
                       via => 'bridge',
                       to => 'contained' },
   ],
   table_name => 'container',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

class TheNamespace::Bridge {
   id_by => [
       container_id => { is => 'Integer' },
       contained_id => { is => 'Integer' },
   ],
   has => [
       container => { is => 'TheNamespace::Container',
                      id_by => 'container_id' },
       contained => { is => 'TheNamespace::Contained',
                      id_by => 'contained_id' },
   ],
   table_name => 'bridge',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

class TheNamespace::Contained {
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       contained_value => { is => 'Varchar' },
   ],
   has_many => [
       bridges =>    { is => 'TheNamespace::Bridge',
                       reverse_as => 'contained' },
       containers => { is => 'TheNamespace::Container',
                       via => 'bridge',
                       to => 'container' },
   ],
   table_name => 'container',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

Indirect Properties

Indirect properties are used to add a property to a class where the data is actually stored in a direct property of a related class.

Singly-indirect

As in the has-a relationship, and the container class wants to have a property actually stored on the contained class. Using the same schema in the has-a relationship above, and we want the contained_value property to be accessible from the container class.

class TheNamespace::Container {
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       # This implies a contained_id property, too
       contained       => { is => 'TheNamespace::Contained',
                            id_by => 'contained_id' },
       contained_value => { via => 'contained',
                            to => 'contained_value' },
   ],
   table_name => 'container',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

You can now use contained_value as an accessor on TheNamespace::Container objects. You can also use contained_value as a parameter in get(), and the underlying data source will use a join if possible in the SQL query.

Many Singly-indirect

As in the singly-indirect recipe, but the container-contained relationship is has-many

class Container {
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       containeds => { is => 'TheNamespace::Contained',
                       reverse_as => 'container',
                       is_many => 1 },
       contained_values => { via => 'containeds',
                             to => 'container_value',
                             is_many => 1 },
   ],
   table_name => 'container',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

Doubly-indirect

If you have a normal has-a relationship between a container and a contained item, and the contained item also has-a third-level contained thing, and you'd like to have a property of the innermost class available to the first container:

class Container {
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       contained       => { is => 'TheNamsepace::Contained',
                            id_by => 'contained_id '},
       inner_contained => { is => 'TheNamespace::InnerContained,
                            via => 'contained',
                            to => 'inner_contained_id' },
       inner_contained_value => { via => 'inner_contained',
                                  to => 'inner_contained_value' },
   ],
   table_name => 'container',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

Many doubly-indirect

Combining the has-many relationship and the doubly indirect recipe

class Container {
   id_by => [
       container_id => { is => 'Integer' },
   ],
   has => [
       containeds       => { is => 'TheNamsepace::Contained',
                             reverse_as => 'container',
                             is_many => 1},
       inner_containeds => { is => 'TheNamespace::InnerContained,
                             via => 'contained',
                             to => 'contained',
                             is_many => 1 },
       inner_contained_values => { via => 'inner_containeds',
                                   to => 'inner_contained_value',
                                   is_many => 1 },
   ],
   table_name => 'container',
   data_source => 'TheNamespace::DataSource::TheDatabase',
};

And then you get an accessor inner_containeds to return a list of inner-contained objects, and another accessor inner_contained_values to return a list of their values.