-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Kotlin: Add taint step for String.valueOf(Editable) #9319
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
Kotlin: Add taint step for String.valueOf(Editable) #9319
Conversation
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.
Changes look reasonable; curious to know why the result is still tagged MISSING
sink(t.toString()); // $ hasTaintFlow | ||
|
||
val t2 : Any? = source() | ||
sink(t2.toString()); // $ MISSING: hasTaintFlow |
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.
Why does it still fail?
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.
t2
's type is Object
because of the Any?
declaration. So the taint step works for Editable?
but not for Any?
.
This is also causing other issues, e.g. toString
's declaring type is Any
in both cases, which interferes with our Method::override
logic.
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 believe that's consistent with the Java extractor -- if the receiver type doesn't supply an override then MethodAccess.getMethod() points to the inherited method.
Kotlin inlines expr.toString() as String.valueOf(expr) when expr is nullable
3d6cfcf
to
78fcdd2
Compare
Tests are now green after #9405. |
Kotlin inlines
expr.toString()
asString.valueOf(expr)
whenexpr
is nullable.This PR extends #8872 by adding a taint step to handle the above when
expr
is anEditable
.