angular.js/test/ng
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
..
directive fix($compile): reject multi-expression interpolations for src attribute 2013-06-24 14:17:18 -07:00
filter fix(date): correctly format dates with more than 3 sub-second digits 2013-05-07 22:59:46 +01:00
anchorScrollSpec.js fix($sniffer): report history false on Android < 4 2012-05-14 15:12:51 -07:00
animationSpec.js feat(ngAnimate): add support for animation 2013-04-02 14:05:06 -07:00
animatorSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
browserSpecs.js fix($browser): should use first value for a cookie. 2013-05-11 09:28:14 -07:00
cacheFactorySpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
compileSpec.js fix($compile): disallow interpolations for DOM event handlers 2013-06-21 17:37:44 -07:00
controllerSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
documentSpec.js chore(module): move files around in preparation for more modules 2012-03-28 11:16:35 -07:00
exceptionHandlerSpec.js chore(module): move files around in preparation for more modules 2012-03-28 11:16:35 -07:00
httpBackendSpec.js feat($http): add support for aborting via timeout promises 2013-05-20 14:15:04 -07:00
httpSpec.js fix($http): ensure case-insens. header overriding 2013-06-19 21:30:59 +01:00
interpolateSpec.js fix($compile): reject multi-expression interpolations for src attribute 2013-06-24 14:17:18 -07:00
localeSpec.js chore(module): move files around in preparation for more modules 2012-03-28 11:16:35 -07:00
locationSpec.js feat(jqLite): switch bind/unbind to more recent jQuery on/off 2013-06-19 20:53:24 +01:00
logSpec.js feat($log): add $log.debug() 2013-01-17 16:47:39 -08:00
parseSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
qSpec.js feat($q): add $q.always() method 2013-04-24 20:56:18 +01:00
rootElementSpec.js feat($rootElement): added application root element 2012-06-02 14:50:58 -07:00
rootScopeSpec.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
snifferSpec.js feat($sniffer): Add support for supportsAnimations flag for detecting CSS Animations browser support 2013-05-08 15:40:37 -07:00
timeoutSpec.js fix($timeout): allow calling $timeout.cancel() with undefined 2012-06-04 17:43:14 -07:00
windowSpec.js chore(module): move files around in preparation for more modules 2012-03-28 11:16:35 -07:00