redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.86k stars 127 forks source link

Circular dependency cases a `make develop` weirdness. #419

Open ANogin opened 7 months ago

ANogin commented 7 months ago

What is the problem? (Here is where you provide a complete Traceback.)

226 introduced an unfortunate issue (which I discovered using PR #218 - IMHO we really out to land that one, and use in CI) - when the docker build runs make develop, it would first go to ofrak_core, where the new "test": "ofrak_angr~=1.0", "ofrak_capstone~=1.0"] dependency would cause it to download ofrak_angr from PyPI, then it would go into ofrak_angr and then the make develop there would overwrite the downloaded one with the local one (and similar with ofrak_capstone). With #417, this means that not only the ofrak_angr itself is downloaded from PyPI, but also the angr itself and all its dependencies installed in base.Dockerfile are updated to the versions required by the ofrak_angr from PyPI. Then make develop would put them all back.

Please provide some information about your environment. N/A

If you've discovered it, what is the root cause of the problem? See above.

How often does the issue happen? Always.

What are the steps to reproduce the issue? See above.

How would you implement this fix? Ideally, we ought to get rid of the "test": "ofrak_angr~=1.0", "ofrak_capstone~=1.0"] dependency. But no idea what that would take.

Are there any (reasonable) alternative approaches?

Options:

Are you interested in implementing it yourself? Not for the ideal approach - do not know enough. I could implement one of the alternative approaches, but do not know which would be preferred.

ANogin commented 7 months ago

Hm, it seems that simply moving these requirements from ofrak_core/setup.py to ofrak_core/requirements-test.txt would address most of the negative effects of this - this way, the ofrak_angr and ofrak_capstone would still be downloaded from PyPI, but it will happen once in base.Dockerfile, and no further PyPI interaction would happen at the make develop stage. (This would be undoing #294 in that respect - not sure why @EdwardLarson wanted/needed to move these dependencies). That said, if the local ofrak_angr/ofrak_capstone have requirements that are incompatible with the PyPI ones, then they will likely still "fight" during make develop.

@EdwardLarson @whyitfor any thoughts?

[Edited to add: I implemented this approach in #420 and it works there, but when merged with #417, then during make develop, there is indeed a "fight" about the version of angr to install.]

rbs-jacob commented 7 months ago

Chiming in to add that I have raised this internally to @whyitfor, and I second that it needs to be addressed. We did not come to any conclusions in our disucssion about a clear path forward.