@@ -13,9 +13,7 @@ private import semmle.javascript.DynamicPropertyAccess
1313 */
1414module Angular2 {
1515 /** Gets a reference to a `Router` object. */
16- DataFlow:: SourceNode router ( ) {
17- result .hasUnderlyingType ( "@angular/router" , "Router" )
18- }
16+ DataFlow:: SourceNode router ( ) { result .hasUnderlyingType ( "@angular/router" , "Router" ) }
1917
2018 /** Gets a reference to a `RouterState` object. */
2119 DataFlow:: SourceNode routerState ( ) {
@@ -60,13 +58,15 @@ module Angular2 {
6058 result = activatedRouteSnapshot ( ) .getAPropertyRead ( "data" ) .getAPropertyRead ( name )
6159 or
6260 // this.route.foo.subscribe(foo => { ... })
63- result = activatedRoute ( ) .getAPropertyRead ( name ) .getAMethodCall ( "subscribe" ) .getABoundCallbackParameter ( 0 , 0 )
61+ result =
62+ activatedRoute ( )
63+ .getAPropertyRead ( name )
64+ .getAMethodCall ( "subscribe" )
65+ .getABoundCallbackParameter ( 0 , 0 )
6466 }
6567
6668 /** Gets an array of URL segments matched by some route. */
67- private DataFlow:: SourceNode urlSegmentArray ( ) {
68- result = activatedRouteProp ( "url" )
69- }
69+ private DataFlow:: SourceNode urlSegmentArray ( ) { result = activatedRouteProp ( "url" ) }
7070
7171 /** Gets a data flow node referring to a `UrlSegment` object matched by some route. */
7272 DataFlow:: SourceNode urlSegment ( ) {
@@ -115,9 +115,7 @@ module Angular2 {
115115 this = routerStateSnapshot ( ) .getAPropertyRead ( "url" )
116116 }
117117
118- override string getSourceType ( ) {
119- result = "Angular route parameter"
120- }
118+ override string getSourceType ( ) { result = "Angular route parameter" }
121119 }
122120
123121 /** Gets a reference to a `DomSanitizer` object. */
@@ -127,20 +125,32 @@ module Angular2 {
127125
128126 /** A value that is about to be promoted to a trusted HTML or CSS value. */
129127 private class AngularXssSink extends DomBasedXss:: Sink {
130- AngularXssSink ( ) { this = domSanitizer ( ) .getAMethodCall ( [ "bypassSecurityTrustHtml" , "bypassSecurityTrustStyle" ] ) .getArgument ( 0 ) }
128+ AngularXssSink ( ) {
129+ this =
130+ domSanitizer ( )
131+ .getAMethodCall ( [ "bypassSecurityTrustHtml" , "bypassSecurityTrustStyle" ] )
132+ .getArgument ( 0 )
133+ }
131134 }
132135
133136 /** A value that is about to be promoted to a trusted script value. */
134137 private class AngularCodeInjectionSink extends CodeInjection:: Sink {
135- AngularCodeInjectionSink ( ) { this = domSanitizer ( ) .getAMethodCall ( [ "bypassSecurityTrustScript" ] ) .getArgument ( 0 ) }
138+ AngularCodeInjectionSink ( ) {
139+ this = domSanitizer ( ) .getAMethodCall ( [ "bypassSecurityTrustScript" ] ) .getArgument ( 0 )
140+ }
136141 }
137142
138143 /**
139144 * A value that is about to be promoted to a trusted URL or resource URL value.
140145 */
141146 private class AngularUrlSink extends ClientSideUrlRedirect:: Sink {
142147 // We mark this as a client URL redirect sink for precision reasons, though its description can be a bit confusing.
143- AngularUrlSink ( ) { this = domSanitizer ( ) .getAMethodCall ( [ "bypassSecurityTrustUrl" , "bypassSecurityTrustResourceUrl" ] ) .getArgument ( 0 ) }
148+ AngularUrlSink ( ) {
149+ this =
150+ domSanitizer ( )
151+ .getAMethodCall ( [ "bypassSecurityTrustUrl" , "bypassSecurityTrustResourceUrl" ] )
152+ .getArgument ( 0 )
153+ }
144154 }
145155
146156 private predicate taintStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
@@ -155,13 +165,9 @@ module Angular2 {
155165 }
156166
157167 private class AngularTaintStep extends TaintTracking:: AdditionalTaintStep {
158- AngularTaintStep ( ) {
159- taintStep ( _, this )
160- }
168+ AngularTaintStep ( ) { taintStep ( _, this ) }
161169
162- override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
163- taintStep ( pred , succ )
164- }
170+ override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) { taintStep ( pred , succ ) }
165171 }
166172
167173 /** Gets a reference to an `HttpClient` object. */
@@ -180,13 +186,9 @@ module Angular2 {
180186 argumentOffset = 0
181187 }
182188
183- override DataFlow:: Node getUrl ( ) {
184- result = getArgument ( argumentOffset )
185- }
189+ override DataFlow:: Node getUrl ( ) { result = getArgument ( argumentOffset ) }
186190
187- override DataFlow:: Node getHost ( ) {
188- none ( )
189- }
191+ override DataFlow:: Node getHost ( ) { none ( ) }
190192
191193 override DataFlow:: Node getADataNode ( ) {
192194 getMethodName ( ) = [ "patch" , "post" , "put" ] and
@@ -207,8 +209,6 @@ module Angular2 {
207209
208210 /** A reference to the DOM location obtained through `DomAdapter.getLocation()`. */
209211 private class DomAdapterLocation extends DOM:: LocationSource:: Range {
210- DomAdapterLocation ( ) {
211- this = domAdapter ( ) .getAMethodCall ( "getLocation" )
212- }
212+ DomAdapterLocation ( ) { this = domAdapter ( ) .getAMethodCall ( "getLocation" ) }
213213 }
214214}
0 commit comments