Summary: This adds basic security hooks to Angular 2. * `SecurityContext` is a private API between core, compiler, and platform-browser. `SecurityContext` communicates what context a value is used in across template parser, compiler, and sanitization at runtime. * `SanitizationService` is the bare bones interface to sanitize values for a particular context. * `SchemaElementRegistry.securityContext(tagName, attributeOrPropertyName)` determines the security context for an attribute or property (it turns out attributes and properties match for the purposes of sanitization). Based on these hooks: * `DomSchemaElementRegistry` decides what sanitization applies in a particular context. * `DomSanitizationService` implements `SanitizationService` and adds *Safe Value*s, i.e. the ability to mark a value as safe and not requiring further sanitization. * `url_sanitizer` and `style_sanitizer` sanitize URLs and Styles, respectively (surprise!). `DomSanitizationService` is the default implementation bound for browser applications, in the three contexts (browser rendering, web worker rendering, server side rendering). BREAKING CHANGES: *** SECURITY WARNING *** Angular 2 Release Candidates do not implement proper contextual escaping yet. Make sure to correctly escape all values that go into the DOM. *** SECURITY WARNING *** Reviewers: IgorMinar Differential Revision: https://reviews.angular.io/D103
		
			
				
	
	
		
			61 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
 | |
| 
 | |
| export var isDefaultChangeDetectionStrategy: typeof t.isDefaultChangeDetectionStrategy =
 | |
|     r.isDefaultChangeDetectionStrategy;
 | |
| export type ChangeDetectorState = t.ChangeDetectorState;
 | |
| export var ChangeDetectorState: typeof t.ChangeDetectorState = r.ChangeDetectorState;
 | |
| export var CHANGE_DETECTION_STRATEGY_VALUES: typeof t.CHANGE_DETECTION_STRATEGY_VALUES =
 | |
|     r.CHANGE_DETECTION_STRATEGY_VALUES;
 | |
| export var constructDependencies: typeof t.constructDependencies = r.constructDependencies;
 | |
| export type LifecycleHooks = t.LifecycleHooks;
 | |
| export var LifecycleHooks: typeof t.LifecycleHooks = r.LifecycleHooks;
 | |
| export var LIFECYCLE_HOOKS_VALUES: typeof t.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES;
 | |
| export type ReflectorReader = t.ReflectorReader;
 | |
| export var ReflectorReader: typeof t.ReflectorReader = r.ReflectorReader;
 | |
| export var ReflectorComponentResolver: typeof t.ReflectorComponentResolver =
 | |
|     r.ReflectorComponentResolver;
 | |
| export type AppElement = t.AppElement;
 | |
| export var AppElement: typeof t.AppElement = r.AppElement;
 | |
| export var AppView: typeof t.AppView = r.AppView;
 | |
| export type DebugAppView<T> = t.DebugAppView<T>;
 | |
| export var DebugAppView: typeof t.DebugAppView = r.DebugAppView;
 | |
| export type ViewType = t.ViewType;
 | |
| export var ViewType: typeof t.ViewType = r.ViewType;
 | |
| export var MAX_INTERPOLATION_VALUES: typeof t.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES;
 | |
| export var checkBinding: typeof t.checkBinding = r.checkBinding;
 | |
| export var flattenNestedViewRenderNodes: typeof t.flattenNestedViewRenderNodes =
 | |
|     r.flattenNestedViewRenderNodes;
 | |
| export var interpolate: typeof t.interpolate = r.interpolate;
 | |
| export var ViewUtils: typeof t.ViewUtils = r.ViewUtils;
 | |
| export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES =
 | |
|     r.VIEW_ENCAPSULATION_VALUES;
 | |
| export var DebugContext: typeof t.DebugContext = r.DebugContext;
 | |
| export var StaticNodeDebugInfo: typeof t.StaticNodeDebugInfo = r.StaticNodeDebugInfo;
 | |
| export var devModeEqual: typeof t.devModeEqual = r.devModeEqual;
 | |
| export var uninitialized: typeof t.uninitialized = r.uninitialized;
 | |
| export var ValueUnwrapper: typeof t.ValueUnwrapper = r.ValueUnwrapper;
 | |
| export var TemplateRef_: typeof t.TemplateRef_ = r.TemplateRef_;
 | |
| export type RenderDebugInfo = t.RenderDebugInfo;
 | |
| export var RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo;
 | |
| export var SecurityContext: typeof t.SecurityContext = r.SecurityContext;
 | |
| export type SecurityContext = t.SecurityContext;
 | |
| export var SanitizationService: typeof t.SanitizationService = r.SanitizationService;
 | |
| export type SanitizationService = t.SanitizationService;
 | |
| export var createProvider: typeof t.createProvider = r.createProvider;
 | |
| export var isProviderLiteral: typeof t.isProviderLiteral = r.isProviderLiteral;
 | |
| export var EMPTY_ARRAY: typeof t.EMPTY_ARRAY = r.EMPTY_ARRAY;
 | |
| export var EMPTY_MAP: typeof t.EMPTY_MAP = r.EMPTY_MAP;
 | |
| export var pureProxy1: typeof t.pureProxy1 = r.pureProxy1;
 | |
| export var pureProxy2: typeof t.pureProxy2 = r.pureProxy2;
 | |
| export var pureProxy3: typeof t.pureProxy3 = r.pureProxy3;
 | |
| export var pureProxy4: typeof t.pureProxy4 = r.pureProxy4;
 | |
| export var pureProxy5: typeof t.pureProxy5 = r.pureProxy5;
 | |
| export var pureProxy6: typeof t.pureProxy6 = r.pureProxy6;
 | |
| export var pureProxy7: typeof t.pureProxy7 = r.pureProxy7;
 | |
| export var pureProxy8: typeof t.pureProxy8 = r.pureProxy8;
 | |
| export var pureProxy9: typeof t.pureProxy9 = r.pureProxy9;
 | |
| export var pureProxy10: typeof t.pureProxy10 = r.pureProxy10;
 | |
| export var castByValue: typeof t.castByValue = r.castByValue;
 | |
| export type Console = t.Console;
 | |
| export var Console: typeof t.Console = r.Console;
 |