angular.js/test/ng/directive
Chirayu Krishnappa 38deedd6e3 fix($compile): reject multi-expression interpolations for src attribute
BREAKING CHANGE: Concatenating expressions makes it hard to reason about
    whether some combination of concatenated values are unsafe to use
    and could easily lead to XSS.  By requiring that a single expression
    be used for *[src/ng-src] such as iframe[src], object[src], etc.
    (but not img[src/ng-src] since that value is sanitized), we ensure that the value
    that's used is assigned or constructed by some JS code somewhere
    that is more testable or make it obvious that you bound the value to
    some user controlled value.  This helps reduce the load when
    auditing for XSS issues.

    To migrate your code, follow the example below:

        Before:
            JS:
                scope.baseUrl = 'page';
                scope.a = 1;
                scope.b = 2;
            HTML:
                <!-- Are a and b properly escaped here? Is baseUrl
                     controlled by user? -->
                <iframe src="{{baseUrl}}?a={{a}&b={{b}}">

        After:
            JS:
                var baseUrl = "page";
                scope.getIframeSrc = function() {
                  // There are obviously better ways to do this.  The
                  // key point is that one will think about this and do
                  // it the right way.
                  var qs = ["a", "b"].map(function(value, name) {
                      return encodeURIComponent(name) + "=" +
                             encodeURIComponent(value);
                    }).join("&");
                  // baseUrl isn't on scope so it isn't bound to a user
                  // controlled value.
                  return baseUrl + "?" + qs;
                }
            HTML: <iframe src="{{getIframeSrc()}}">
2013-06-24 14:17:18 -07:00
..
aSpec.js fix(a): workaround IE bug affecting mailto urls 2013-02-14 16:42:58 -08:00
booleanAttrsSpec.js fix($compile): reject multi-expression interpolations for src attribute 2013-06-24 14:17:18 -07:00
formSpec.js feat(jqLite): switch bind/unbind to more recent jQuery on/off 2013-06-19 20:53:24 +01:00
inputSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
ngBindSpec.js chore(ngSanitize): extract $sanitize, ngBindHtml, linkyFilter into a module 2012-04-11 15:50:47 -07:00
ngClassSpec.js fix(ngClass): should remove classes when object is the same but property has changed 2013-04-16 13:15:49 +01:00
ngClickSpec.js chore(tests): rename all directive names to the normalized form 2012-04-09 11:48:54 -07:00
ngCloakSpec.js chore(tests): rename all directive names to the normalized form 2012-04-09 11:48:54 -07:00
ngControllerSpec.js feat(controller): support as instance syntax 2013-04-22 23:28:41 -07:00
ngCspSpec.js feat($parse): CSP compatibility 2012-04-27 23:04:24 -07:00
ngEventDirsSpec.js chore(tests): rename all directive names to the normalized form 2012-04-09 11:48:54 -07:00
ngIfSpec.js chore(ngAnimate): CSS classes X-setup/X-start -> X/X-active 2013-05-08 16:03:31 -07:00
ngIncludeSpec.js chore(ngAnimate): CSS classes X-setup/X-start -> X/X-active 2013-05-08 16:03:31 -07:00
ngInitSpec.js chore(tests): rename all directive names to the normalized form 2012-04-09 11:48:54 -07:00
ngKeySpec.js feat(directive): add ngKeypress directive for handling keypress event 2013-03-08 21:56:32 +01:00
ngNonBindableSpec.js chore(tests): rename all directive names to the normalized form 2012-04-09 11:48:54 -07:00
ngPluralizeSpec.js fix(ngPluralize): handle the empty string as a valid override 2013-05-10 20:03:24 +01:00
ngRepeatSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
ngShowHideSpec.js chore(ngAnimate): CSS classes X-setup/X-start -> X/X-active 2013-05-08 16:03:31 -07:00
ngSrcsetSpec.js feat(ngSrcset): add new ngSrcset directive 2013-05-14 21:29:21 +01:00
ngSrcSpec.js fix(ngSrc): don't set src if value is empty string 2012-09-06 16:06:24 -07:00
ngStyleSpec.js chore(tests): rename all directive names to the normalized form 2012-04-09 11:48:54 -07:00
ngSwitchSpec.js chore(ngAnimate): CSS classes X-setup/X-start -> X/X-active 2013-05-08 16:03:31 -07:00
scriptSpec.js fix(script): Incorrectly reading script text on ie 2012-04-20 11:29:34 -07:00
selectSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
styleSpec.js chore(module): move files around in preparation for more modules 2012-03-28 11:16:35 -07:00