-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: Update legacy MaD models 4 #19948
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
base: main
Are you sure you want to change the base?
Conversation
…r these last few cases).
I think it will be prudent to get the first two/three PRs merged before attempting to address the test failures here. |
The test failures look The relevant bits of code are
I would expect the canonical path to be either This should address the underlying issue #19988 |
I've brought in the fix for |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
- ["futures-util::io::AsyncReadExt::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncReadExt::read", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncReadExt::read_to_end", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncReadExt::read_to_end", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncBufReadExt::read_line", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncBufReadExt::read_line", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncBufReadExt::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncBufReadExt::read_until", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"] | ||
- ["futures-util::io::AsyncBufReadExt::fill_buf", "Argument[self]", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "taint", "manual"] | ||
- ["futures-util::io::AsyncBufReadExt::lines", "Argument[self]", "ReturnValue", "taint", "manual"] |
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 think this should be futures_util
.
- ["futures-util::io::AsyncReadExt::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncReadExt::read", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncReadExt::read_to_end", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncReadExt::read_to_end", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncBufReadExt::read_line", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncBufReadExt::read_line", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncBufReadExt::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncBufReadExt::read_until", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"] | |
- ["futures-util::io::AsyncBufReadExt::fill_buf", "Argument[self]", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "taint", "manual"] | |
- ["futures-util::io::AsyncBufReadExt::lines", "Argument[self]", "ReturnValue", "taint", "manual"] | |
- ["futures_util::io::AsyncReadExt::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncReadExt::read", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncReadExt::read_to_end", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncReadExt::read_to_end", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncBufReadExt::read_line", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncBufReadExt::read_line", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncBufReadExt::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncBufReadExt::read_until", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"] | |
- ["futures_util::io::AsyncBufReadExt::fill_buf", "Argument[self]", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "taint", "manual"] | |
- ["futures_util::io::AsyncBufReadExt::lines", "Argument[self]", "ReturnValue", "taint", "manual"] |
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.
Actually might need to be <_ as futures_util::io::AsyncReadExt>::read
etc.
@@ -61,16 +61,16 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> { | |||
let mut cx = Context::from_waker(futures::task::noop_waker_ref()); | |||
let buffer = pinned.poll_fill_buf(&mut cx); | |||
if let Poll::Ready(Ok(buf)) = buffer { | |||
sink(&buffer); // $ hasTaintFlow=url | |||
sink(&buffer); // $ MISSING: hasTaintFlow=url |
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.
Currently the computed canonical path for this function is <core::pin::Pin as tokio::io::async_buf_read::AsyncBufRead>::poll_fill_buf
which makes very little sense. I guess we should implement some auto-unpinning or something @hvitved , what do you think?
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.
Hmm the impl<P> AsyncBufRead for Pin<P>
actually exists in futures-io
so that canonical path is perhaps fine. Although rust-analyzer resolves the call to impl<R: AsyncRead> AsyncBufRead for BufReader<R>
from futures-util
. Not sure which one is best. I guess if the Pin
version is in scope then it would make sense, if not, then rust-analyzer is probably right and we should have auto-unpinned somehow.
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 think all the MISSING
annotations can be fixed by updating the models to match the actual canonical paths. The following queries can come in handy to investigate what the computed canonical paths are:
query predicate resolvedPaths2(CallExprBase e, string path, Addressable target) {
toBeTested(e) and
target = e.getStaticTarget() and
path = concat(target.getCanonicalPath())
}
query predicate resolvedPaths3( Addressable target, string path) { path = target.getCanonicalPath() }
Final update of legacy MaD models to the new model format (continues from #19946 and should be independent of that).
There's a lot of guesswork involved in this last set of changes - i.e. cases where I couldn't find a real
getCanonicalPath
. There should be tests for most of them though so we will find out if we're way off.