Skip to content

Java/C++/C# DataFlow: Add support for in/out barriers on sources and sinks.#1639

Merged
yh-semmle merged 7 commits intogithub:masterfrom
aschackmull:java/in-out-barriers
Aug 7, 2019
Merged

Java/C++/C# DataFlow: Add support for in/out barriers on sources and sinks.#1639
yh-semmle merged 7 commits intogithub:masterfrom
aschackmull:java/in-out-barriers

Conversation

@aschackmull
Copy link
Contributor

@aschackmull aschackmull commented Jul 26, 2019

This replaces the isBarrierEdge functionality with in/out barriers on sources and sinks.

Previously, any source or sink that was also a barrier would be disregarded, but now that is instead interpreted as an in-barrier on a source and an out-barrier on a sink. This allows e.g. for configurations that stop flow on a sink even if that particular data-flow node can reach a subsequent sink and vice-versa for sources. The concept of barrier edges was only ever supported for local edges, required intimate knowledge of the actual step relation used internally by the library, and its main use case was exactly in/out barriers on sources and sinks, which should be handled a lot better now.

This feature also makes it easy to extend the configuration interface with general in/out barriers on any node if that's something we want. <-- That doesn't make sense anyway, a non-source in-barrier is equivalent to a full barrier.

Update:
Having in/out barriers be implicitly specified turned out to be problematic when e.g. specifying a variable access as a barrier because it was guarded and that variable access then occurred in a sink position, as that created a non-intuitive dependence between isSink and isBarrier. So the better solution is simply to keep the semantics of isBarrier as-is and add two new predicates to configurations to specify in/out barriers.

@aschackmull
Copy link
Contributor Author

Hmm.. this does not seem like the right approach, as it becomes too easy for something that was intended to be a full barrier to become an out barrier. E.g. if a guarded variable access occurs in a sink position.

@aschackmull
Copy link
Contributor Author

Changed to keep semantics of isBarrier as-is.

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't vouch for the correctness of all the new places where inBarrier or outBarrier are used, but the API and implementation structure LGTM.

@@ -57,8 +57,14 @@ abstract class Configuration extends string {
/** Holds if data flow through `node` is prohibited. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The QLDoc on isBarrier uses terminology that isn't easy to relate to the two new predicates. I suggest changing "through" to "into or out of".

Same thing with isSanitizer.

hvitved
hvitved previously approved these changes Aug 5, 2019
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks plausible to me.

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs changes LGTM now

@yh-semmle yh-semmle merged commit 033879f into github:master Aug 7, 2019
@aschackmull aschackmull deleted the java/in-out-barriers branch August 7, 2019 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants