@@ -15,44 +15,46 @@ import advanced_security.javascript.frameworks.ui5.UI5HTML
1515import semmle.javascript.RestrictedLocations
1616private import advanced_security.javascript.frameworks.ui5.UI5
1717
18- class FirstLineOfMainHtml extends HTML:: DocumentElement , FirstLineOf {
19- FirstLineOfMainHtml ( ) {
20- exists ( UI5:: WebApp app | this . getFile ( ) . ( FirstLineOf ) . getFile ( ) = app )
18+ class FirstLineOfDocumentElementWebApp extends HTML:: DocumentElement , FirstLineOf {
19+ FirstLineOfDocumentElementWebApp ( ) {
20+ exists ( UI5:: WebApp app | app . getDocument ( ) = this )
2121 }
2222}
2323
2424newtype TAlertLocation =
2525 TFrameOptions ( FrameOptions frameOptions ) or
26- TFirstLineOfMainHtml ( FirstLineOfMainHtml htmlStartTag )
26+ TFirstLineOfDocumentElementWebApp ( FirstLineOfDocumentElementWebApp htmlStartTag )
2727
2828class AlertLocation extends TAlertLocation {
2929 FrameOptions asFrameOptions ( ) { this = TFrameOptions ( result ) }
3030
31- FirstLineOfMainHtml asFirstLineOfMainHtml ( ) { this = TFirstLineOfMainHtml ( result ) }
31+ FirstLineOfDocumentElementWebApp asFirstLineOfDocumentElementWebApp ( ) { this = TFirstLineOfDocumentElementWebApp ( result ) }
3232
3333 string toString ( ) {
3434 result = this .asFrameOptions ( ) .toString ( ) or
35- result = this .asFirstLineOfMainHtml ( ) .toString ( )
35+ result = this .asFirstLineOfDocumentElementWebApp ( ) .toString ( )
3636 }
3737
3838 predicate hasLocationInfo ( string path , int sl , int sc , int el , int ec ) {
3939 this .asFrameOptions ( ) .getLocation ( ) .hasLocationInfo ( path , sl , sc , el , ec )
4040 or
41- this .asFirstLineOfMainHtml ( ) .hasLocationInfo ( path , sl , sc , el , ec )
41+ this .asFirstLineOfDocumentElementWebApp ( ) .hasLocationInfo ( path , sl , sc , el , ec )
4242 }
4343}
4444
45- from AlertLocation alert , string message
45+ from AlertLocation alertLocation , string message
4646where
47- exists ( FrameOptions frameOptions | frameOptions .allowsAllOriginEmbedding ( ) |
48- alert .asFrameOptions ( ) = frameOptions and
49- message =
50- "Possible clickjacking vulnerability due to " + frameOptions .toString ( ) +
51- " being set to `allow`."
52- )
53- or
54- exists ( UI5:: WebApp app | thereIsNoFrameOptionSet ( app ) |
55- alert .asFirstLineOfMainHtml ( ) .getFile ( ) = app and
47+ exists ( UI5:: WebApp app |
48+ exists ( FrameOptions frameOptions | app .getFrameOptions ( ) = frameOptions |
49+ frameOptions .allowsAllOriginEmbedding ( ) and
50+ alertLocation .asFrameOptions ( ) = frameOptions and
51+ message =
52+ "Possible clickjacking vulnerability due to " + frameOptions .toString ( ) +
53+ " being set to `allow`."
54+ )
55+ or
56+ isMissingFrameOptionsToPreventClickjacking ( app ) and
57+ alertLocation .asFirstLineOfDocumentElementWebApp ( ) = app .getDocument ( ) and
5658 message = "Possible clickjacking vulnerability due to missing frame options."
5759 )
58- select alert , message
60+ select alertLocation , message
0 commit comments