Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 854da35

Browse files
refact($parse): remove expression sandbox
1 parent b091095 commit 854da35

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/content/guide/expression.ngdoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ You can try evaluating different expressions here:
113113
Angular does not use JavaScript's `eval()` to evaluate expressions. Instead Angular's
114114
{@link ng.$parse $parse} service processes these expressions.
115115

116-
Angular expressions do not have access to global variables like `window`, `document` or `location`.
116+
Angular expressions do not have direct access to global variables like `window`, `document` or `location`.
117117
This restriction is intentional. It prevents accidental access to the global state – a common source of subtle bugs.
118118

119-
Instead use services like `$window` and `$location` in functions called from expressions. Such services
120-
provide mockable access to globals.
119+
Instead use services like `$window` and `$location` in functions on controllers, which are then called from expressions.
120+
Such services provide mockable access to globals.
121121

122122
It is possible to access the context object using the identifier `this` and the locals object using the
123123
identifier `$locals`.

docs/content/guide/security.ngdoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ Control of the Angular templates makes applications vulnerable even if there was
7171

7272
* Do not mix client and server templates
7373
* Do not use user input to generate templates dynamically
74-
* Do not run user input through `$scope.$eval` (or any of the other expression parsing functions listed above).
74+
* Do not run user input through `$scope.$eval` (or any of the other expression parsing functions listed above)
7575
* Consider using {@link ng.directive:ngCsp CSP} (but don't rely only on CSP)
7676

77-
**You can use server-side templating to dynamically generate CSS, URLs, etc, but not for generating templates that are
77+
**You can use suitably sanitized server-side templating to dynamically generate CSS, URLs, etc, but not for generating templates that are
7878
bootstrapped/compiled by Angular.**
7979

80-
**If you have to keep on using the user-provided content in a template then the safest option is to ensure that it is only
80+
**If you must continue to allow user-provided content in an Angular template then the safest option is to ensure that it is only
8181
present in the part of the template that is made inert via the {@link ngNonBindable} directive.**
8282

8383

src/ng/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var objectValueOf = OBJECT_CTOR_PROTO.valueOf;
3434

3535
// Sandboxing Angular Expressions
3636
// ------------------------------
37-
// Angular expressions are no longer sandboxed. So it is now possible to access arbitary JS code by
37+
// Angular expressions are no longer sandboxed. So it is now even easier to access arbitary JS code by
3838
// various means such as obtaining a reference to native JS functions like the Function constructor.
3939
//
4040
// As an example, consider the following Angular expression:

0 commit comments

Comments
 (0)