Skip to content

Ruby: demonstrate data flow not working with instance variables #7447

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeffgran
Copy link
Contributor

@jeffgran jeffgran commented Dec 18, 2021

This branch demonstrates an issue with data flow tracking. If you run this test on this branch you will see a failure, but this should pass.

The new ruby code I added to ActiveRecordInjection.rb shows two identical methods, except one uses a local variable and one uses an instance variable.

The local variable is successfully tracked as the receiver of the DataFlow::CallNode, but the instance variable version is not.

This makes it look to me like instance variables are not tracked properly in the dataflow module(s) yet.

This is catastrophic because instance variables are extremely common in ruby code, and especially for active record instances in rails controllers.

@github-actions github-actions bot added the Ruby label Dec 18, 2021
@jeffgran jeffgran force-pushed the jg/data-flow-instance-variables branch from 8c20927 to bc8d434 Compare December 18, 2021 04:54
@owen-mc owen-mc changed the title demonstrate data flow not working with instance variables Ruby: demonstrate data flow not working with instance variables Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants