@@ -26,7 +26,7 @@ private module Sendgrid {
26
26
}
27
27
28
28
/** Gets a reference to a `SendGridAPIClient` instance call with `send` or `post`. */
29
- private DataFlow :: CallCfgNode sendgridApiSendCall ( ) {
29
+ private API :: CallNode sendgridApiSendCall ( ) {
30
30
result = sendgridApiClient ( ) .getMember ( "send" ) .getACall ( )
31
31
or
32
32
result =
@@ -62,7 +62,7 @@ private module Sendgrid {
62
62
* * `getFrom()`'s result would be `"[email protected] "`.
63
63
* * `getSubject()`'s result would be `"Sending with SendGrid is Fun"`.
64
64
*/
65
- private class SendGridMail extends DataFlow :: CallCfgNode , EmailSender:: Range {
65
+ private class SendGridMail extends API :: CallNode , EmailSender:: Range {
66
66
SendGridMail ( ) { this = sendgridApiSendCall ( ) }
67
67
68
68
private DataFlow:: CallCfgNode getMailCall ( ) {
@@ -118,40 +118,28 @@ private module Sendgrid {
118
118
or
119
119
result = this .sendgridWrite ( "html_content" )
120
120
or
121
- exists ( KeyValuePair content , Dict generalDict , KeyValuePair typePair , KeyValuePair valuePair |
122
- content .getKey ( ) .( StrConst ) .getText ( ) = "content" and
123
- content .getValue ( ) .( List ) .getAnElt ( ) = generalDict and
124
- // declare KeyValuePairs keys and values
125
- typePair .getKey ( ) .( StrConst ) .getText ( ) = "type" and
126
- typePair .getValue ( ) .( StrConst ) .getText ( ) = [ "text/html" , "text/x-amp-html" ] and
127
- valuePair .getKey ( ) .( StrConst ) .getText ( ) = "value" and
128
- result .asExpr ( ) = valuePair .getValue ( ) and
129
- // correlate generalDict with previously set KeyValuePairs
130
- generalDict .getAnItem ( ) in [ typePair , valuePair ] and
131
- [ this .getArg ( 0 ) , this .getArgByName ( "request_body" ) ] .getALocalSource ( ) .asExpr ( ) =
132
- any ( Dict d | d .getAnItem ( ) = content )
121
+ exists ( API:: Node contentElement |
122
+ contentElement =
123
+ this .getKeywordParameter ( "request_body" ) .getSubscript ( "content" ) .getASubscript ( )
124
+ |
125
+ contentElement .getSubscript ( "type" ) .getAValueReachingSink ( ) .asExpr ( ) .( StrConst ) .getText ( ) =
126
+ [ "text/html" , "text/x-amp-html" ] and
127
+ result = contentElement .getSubscript ( "value" ) .getAValueReachingSink ( )
133
128
)
134
129
or
135
- exists ( KeyValuePair footer , Dict generalDict , KeyValuePair enablePair , KeyValuePair htmlPair |
136
- footer .getKey ( ) .( StrConst ) .getText ( ) = [ "footer" , "subscription_tracking" ] and
137
- footer .getValue ( ) = generalDict and
138
- // check footer is enabled
139
- enablePair .getKey ( ) .( StrConst ) .getText ( ) = "enable" and
140
- exists ( enablePair .getValue ( ) .( True ) ) and
141
- // get html content
142
- htmlPair .getKey ( ) .( StrConst ) .getText ( ) = "html" and
143
- result .asExpr ( ) = htmlPair .getValue ( ) and
144
- // correlate generalDict with previously set KeyValuePairs
145
- generalDict .getAnItem ( ) in [ enablePair , htmlPair ] and
146
- exists ( KeyValuePair k |
147
- k .getKey ( ) =
148
- [ this .getArg ( 0 ) , this .getArgByName ( "request_body" ) ]
149
- .getALocalSource ( )
150
- .asExpr ( )
151
- .( Dict )
152
- .getAKey ( ) and
153
- k .getValue ( ) = any ( Dict d | d .getAKey ( ) = footer .getKey ( ) )
154
- )
130
+ exists ( API:: Node html |
131
+ html =
132
+ this .getKeywordParameter ( "request_body" )
133
+ .getSubscript ( "tracking_settings" )
134
+ .getSubscript ( "subscription_tracking" )
135
+ or
136
+ html =
137
+ this .getKeywordParameter ( "request_body" )
138
+ .getSubscript ( "mail_settings" )
139
+ .getSubscript ( "footer" )
140
+ |
141
+ html .getSubscript ( "enable" ) .getAValueReachingSink ( ) .asExpr ( ) instanceof True and
142
+ result = html .getSubscript ( "html" ) .getAValueReachingSink ( )
155
143
)
156
144
}
157
145
0 commit comments