Ruby: avoid toString in query warning

This commit is contained in:
Alex Ford
2023-09-07 14:54:50 +01:00
parent 0aee7f6ac6
commit 4a01de13ef
2 changed files with 7 additions and 2 deletions

View File

@@ -31,7 +31,12 @@ module CodeInjection {
/** Flow states used to distinguish whether an attacker controls the entire string. */
class State extends TState {
string toString() {
string toString() { result = this.getStringRepresentation() }
/**
* Gets a canonical string representation of this state.
*/
string getStringRepresentation() {
this = TSubString() and result = "substring"
or
this = TFull() and result = "full"

View File

@@ -29,7 +29,7 @@ where
otherSink) and
otherSink.getNode() = sink.getNode()
|
otherSink order by otherSink.getState().toString()
otherSink order by otherSink.getState().getStringRepresentation()
)
select sink.getNode(), source, sink, "This code execution depends on a $@.", sourceNode,
"user-provided value"