-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Rust: Add support for MaD sources and sinks with access paths #18298
Open
hvitved
wants to merge
2
commits into
github:main
Choose a base branch
from
hvitved:rust/mad-source-sink
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
Rust
Pull requests that update Rust code
DataFlow Library
labels
Dec 16, 2024
hvitved
force-pushed
the
rust/mad-source-sink
branch
from
December 17, 2024 14:05
cb85b26
to
707bebb
Compare
@@ -175,6 +175,53 @@ | |||
sink(t.1); // $ hasValueFlow=11 | |||
} | |||
|
|||
impl MyFieldEnum { | |||
// has a source model | |||
fn source(&self, i: i64) -> MyFieldEnum { |
Check notice
Code scanning / CodeQL
Unused variable Note test
Variable 'i' is not used.
} | ||
|
||
// has a sink model | ||
fn enum_sink(e: MyFieldEnum) {} |
Check notice
Code scanning / CodeQL
Unused variable Note test
Variable 'e' is not used.
hvitved
force-pushed
the
rust/mad-source-sink
branch
from
December 17, 2024 14:52
707bebb
to
efbbea1
Compare
hvitved
force-pushed
the
rust/mad-source-sink
branch
from
December 18, 2024 09:46
efbbea1
to
67f7387
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C#
C++
DataFlow Library
Go
Java
no-change-note-required
This PR does not need a change note
Python
Ruby
Rust
Pull requests that update Rust code
Swift
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds support for defining flow sources/sinks for Rust with non-trivial access paths. For example, one may define
which models calls to
crate::my_option_source
as flow sources of kindtest-source
, but where the origin of tainted data is not directly the result of the call, but rather stored insideOption::Some
in the result of the call.Similarly, one may define a sink restricted to data stored inside
Option::Some
:Implementation
The implementation piggy-backs on the existing
FlowSummaryImpl
library, which already has functionality for specifying flow summaries with non-trivial input/output access paths. For a flow source likemy_option_source
above, we synthesize a store step from synthetic source nodes to actual calls tomy_option_source
, and dually for sinks likemy_option_sink
, we synthesize read steps from arguments to synthetic sink nodes.The functionality is currently limited to Rust, but other languages should be able to adopt relatively easily.