-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Sanitizer for sanitizer(x) === true
#11769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dd0eb73
to
24a0836
Compare
class BooleanLiteral extends @boolean_literal, Literal { } | ||
class BooleanLiteral extends @boolean_literal, Literal { | ||
/** Gets the value of this literal. */ | ||
boolean getBoolValue() { if this.getRawValue() = "true" then result = true else result = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe consider naming consistency with TypeInference.qll:
/** Gets the unique Boolean value that this node evaluates to, if any. */
boolean getTheBooleanValue() { ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getBoolValue
is consistent with the predicate in YamlBool
(In YAML.qll
).
So I prefer to keep it as is.
exists(EqualityTest test, BooleanLiteral bool | | ||
this.asExpr() = test and | ||
test.hasOperands(prev.asExpr(), bool) and | ||
polarity = test.getPolarity().booleanXor(bool.getBoolValue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the use of xor
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need polarity
to flip both if test
flips and if bool
flips.
xor
always flips when one of it's inputs flip, that's why I'm using it.
Then I had to figure out whether I had to add a .booleanNot()
to the output or not, and that was just done by testing.
There are some merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #11667
The
appliesTo
change didn't change the result of any tests, but that feels like a lucky coincidence (because the nodes wereinstanceof DataFlow::BarrierGuardNode
anyway).Evaluations were uneventful: