Use StrConst.getText() instead of Str_.getS()

This commit is contained in:
jorgectf
2022-02-26 01:19:50 +01:00
parent ede5d412ac
commit 2f2cf2c1f6
2 changed files with 9 additions and 9 deletions

View File

@@ -114,25 +114,25 @@ private module Sendgrid {
result = sendgridWrite("html_content")
or
exists(KeyValuePair content, Dict generalDict, KeyValuePair typePair, KeyValuePair valuePair |
content.getKey().(StrConst).getS() = "content" and
content.getKey().(StrConst).getText() = "content" and
content.getValue().(List).getAnElt() = generalDict and
// declare KeyValuePairs keys and values
typePair.getKey().(StrConst).getS() = "type" and
typePair.getValue().(StrConst).getS() = ["text/html", "text/x-amp-html"] and
valuePair.getKey().(StrConst).getS() = "value" and
typePair.getKey().(StrConst).getText() = "type" and
typePair.getValue().(StrConst).getText() = ["text/html", "text/x-amp-html"] and
valuePair.getKey().(StrConst).getText() = "value" and
result.asExpr() = valuePair.getValue() and
// correlate generalDict with previously set KeyValuePairs
generalDict.getAnItem() in [typePair, valuePair]
)
or
exists(KeyValuePair footer, Dict generalDict, KeyValuePair enablePair, KeyValuePair htmlPair |
footer.getKey().(StrConst).getS() = ["footer", "subscription_tracking"] and
footer.getKey().(StrConst).getText() = ["footer", "subscription_tracking"] and
footer.getValue().(Dict) = generalDict and
// check footer is enabled
enablePair.getKey().(StrConst).getS() = "enable" and
enablePair.getKey().(StrConst).getText() = "enable" and
exists(enablePair.getValue().(True)) and
// get html content
htmlPair.getKey().(StrConst).getS() = "html" and
htmlPair.getKey().(StrConst).getText() = "html" and
result.asExpr() = htmlPair.getValue() and
// correlate generalDict with previously set KeyValuePairs
generalDict.getAnItem() in [enablePair, htmlPair]

View File

@@ -23,7 +23,7 @@ module SmtpLib {
private DataFlow::CallCfgNode mimeText(string mimetype) {
result = smtpMimeTextInstance().getACall() and
[result.getArg(1), result.getArgByName("_subtype")].asExpr().(Str_).getS() = mimetype
[result.getArg(1), result.getArgByName("_subtype")].asExpr().(StrConst).getText() = mimetype
}
/**
@@ -123,7 +123,7 @@ module SmtpLib {
DataFlow::exprNode(sub.getObject()).getALocalSource() =
[sendCall.getArg(2), sendCall.getArg(2).(DataFlow::MethodCallNode).getObject()]
.getALocalSource() and
sub.getIndex().(Str_).getS() = index and
sub.getIndex().(StrConst).getText() = index and
result.asCfgNode() = def.getValue()
)
}