angular.js/src/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 docs(ngRepeat): fix typo 2013-06-20 11:07:13 +01:00
filter docs(filters): fix minor typographical error 2013-05-20 15:36:10 +01:00
anchorScroll.js docs(anchorScroll): correct word "location" 2012-12-19 21:01:41 +01:00
animation.js style(*): fix up semicolon and var usage 2013-05-09 15:01:22 +01:00
animator.js feat(ngdocs): support popover, foldouts and foldover annotations 2013-06-17 22:00:54 -07:00
browser.js feat(jqLite): switch bind/unbind to more recent jQuery on/off 2013-06-19 20:53:24 +01:00
cacheFactory.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
compile.js fix($compile): reject multi-expression interpolations for src attribute 2013-06-24 14:17:18 -07:00
controller.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
document.js docs(*): simplify doc urls 2012-06-12 00:10:18 -07:00
exceptionHandler.js style(exceptionHandler): add ws 2013-04-11 15:32:20 -07:00
filter.js docs(filter): improve syntax for usage in templates 2013-04-24 21:55:58 +01:00
http.js fix($http): ensure case-insens. header overriding 2013-06-19 21:30:59 +01:00
httpBackend.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
interpolate.js fix($compile): reject multi-expression interpolations for src attribute 2013-06-24 14:17:18 -07:00
locale.js docs(*): simplify doc urls 2012-06-12 00:10:18 -07:00
location.js feat(jqLite): switch bind/unbind to more recent jQuery on/off 2013-06-19 20:53:24 +01:00
log.js feat($log): add $log.debug() 2013-01-17 16:47:39 -08:00
parse.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
q.js docs($q): fix a few issues 2013-06-13 22:42:10 +01:00
rootElement.js docs(*): simplify doc urls 2012-06-12 00:10:18 -07:00
rootScope.js chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
sniffer.js feat($sniffer): Add support for supportsAnimations flag for detecting CSS Animations browser support 2013-05-08 15:40:37 -07:00
timeout.js docs($timeout): minor cleanup 2013-05-14 20:47:39 +01:00
window.js docs($window): fix example 2013-05-09 12:47:41 +01:00