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

Yancy::Plugin::Form - Generate form HTML using various UI libraries

VERSION

version 1.049

SYNOPSIS

use Mojolicious::Lite;
plugin Yancy => {
    backend => 'pg://localhost/mysite',
    read_schema => 1,
};
app->yancy->plugin( 'Form::Bootstrap4' );
app->routes->get( '/people/:id/edit' )->to(
    'yancy#set',
    schema => 'people',
    template => 'edit_people',
);
app->start;
__DATA__
@@ edit_people.html.ep
%= $c->yancy->form->form_for( 'people' );

DESCRIPTION

The Form plugins generate forms from JSON schemas. Plugin and application developers can use the form plugin API to make forms, and then sites can load a specific form library plugin to match the style of the site.

NOTE: This API is EXPERIMENTAL and will be considered stable in Yancy version 2.0. Please report any issues you have or features you'd like to see. Minor things may change before version 2.0, so be sure to read the release changelog before upgrading.

Available Libraries

HELPERS

All form plugins add the same helpers with the same arguments so that applications can use the form plugin that matches their site's appearance. Yancy plugin and app developers should use form plugins to build forms so that users can easily customize the form's appearance.

yancy->form->input

my $html = $c->yancy->form->input( %args );
%= $c->yancy->form->plugin( %args );

Create a form input. Usually one of a <input>, <textarea, or <select> element, but can be more.

%args is a list of name/value pairs with the following keys:

type

The type of the input field to create. One of the JSON schema types. See "Data Collections" in Yancy::Help::Config for details on the supported types.

format

For string types, the format the string should take. One of the supported JSON schema formats, along with some additional ones. See "Generated Forms" in Yancy::Help::Config for details on the supported formats.

pattern

A regex pattern to validate the field before submit.

required

If true, the field will be marked as required.

readonly

If true, the field will be marked as read-only.

disabled

If true, the field will be marked as disabled.

placeholder

The placeholder for <input> and <textarea> elements.

id

The ID for this field.

class

A string with additional classes to add to this field.

minlength

The minimum length of the text in this field. Used to validate the form.

maxlength

The maximum length of the text in this field. Used to validate the form.

minimum

The minimum value for the number in this field. Used to validate the form.

maximum

The maximum value for the number in this field. Used to validate the form.

Most of these properties are the same as the JSON schema field properties. See "Generated Forms" in Yancy::Help::Config for details on how Yancy translates JSON schema into forms.

yancy->form->input_for

my $html = $c->yancy->form->input_for( $schema, $property, %args );
%= $c->yancy->form->input_for( $schema, $property, %args );

Create a form input for the given schema's property. This creates just the input field, nothing else. To add a label, see field_for.

yancy->form->filter_for

my $html = $c->yancy->form->filter_for( $schema, $property, %args );
%= $c->yancy->form->filter_for( $schema, $property, %args );

Create a form input suitable as a filter for the given schema's property. A filter input is never a required field, and always allows some kind of "blank" value. The filter automatically captures a value from the query parameter of the same name as the $property. This creates just the input field, nothing else.

yancy->form->field_for

my $html = $c->yancy->form->field_for( $schema, $name, %args );
%= $c->yancy->form->field_for( $schema, $name, %args );

Generate a field for the given $schema and property $name. The field will include a <label>, the appropriate input (<input>, <select>, or otherwise ), and any descriptive text. %args is a hash with the following keys:

title

The field's title. Defaults to the title defined for this property in the schema (see Yancy::Help::Config), or the field's name.

description

The field's description. Optional. Defaults to the description defined for this property in the schema (see Yancy::Help::Config).

yancy->form->form_for

my $html = $c->yancy->form->form_for( $schema, %opt );
%= $c->yancy->form->plugin( $schema, %opt );

Generate a form to edit an item from the given $schema. The form will include all the fields, a CSRF token, and a single button to submit the form.

method

The method attribute for the <form> tag. Defaults to POST.

action

The action URL for the <form> tag.

item

A hashref of values to fill in the form. Defaults to the value of the item in the stash (which is set by "set" in Yancy::Controller::Yancy.)

SEE ALSO

Yancy

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.