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
Taint can't be transmitted through numerics nor bool #6993
Conversation
Thx, I also continued a bit on this topic (still having limited knowledge about many details in Psalm internals...):
|
Probably we might use some |
No need for traits, we have a Union class that can carry this kind of methods isVectorForTaints would be good I think :) The hard part will be listing every type and thinking about whether it can transmit any type of taint or not ! |
It's easy with There's also 'Code' button in the top right corner of PR web interface, that, once clicked, show alternative methods: |
Sorry, I didn't know you were going to work on it, I'd have let you do it instead :) |
Thanks! Will try it next time! |
I'm merging that, feel free to improve onto it if needed :) |
No problem at all & I should have mentioned that I'd continue. Anyways, we both were digging into the topic to get it resolved. That's the important part & thanks for that! 👍
I was thinking about adding |
@ohader
This was on purpose and I described it in the previous PR:
It's a slight risk, but not much considering all the checks Psalm does |
Ideally, we should consider every type inside an Union. You can take |
This will fix #6991 and fix #6992 (sorry, I'm not sure how to contribute to a previously made PR, so I just stole the tests :D)
We could improve this PR in the future: It's the second time I list int, bool and float for taint purpose. We could create a method on Union that would take a type and return if it can be a vector for taints (for example, we can exclude bool, int, float, probably numeric and numeric-string. Other are more unclear: what about resource? callable-string? etc...). It would also allow checking union types...
Once again, I was surprised, once I fixed the parameter type, the cast solved itself and it did not allow taint to pass anymore. I'm not completely sure what's going on here.