Skip to content

Remove mostly unused util.py #773

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

Merged
merged 1 commit into from
Apr 15, 2024
Merged

Conversation

lukpueh
Copy link
Member

@lukpueh lukpueh commented Apr 10, 2024

  • addresses part of #731
  • blocks on #772 (commits are included in this PR)

closes #245


The util.py module provides a mix of minimal functions related to local files and directories. These functions are mostly unused, exceptions are (according to sourcegraph.com):

It seems feasible to reimplement the desired functionality downstream.

The benefits of removing util.py are:

  • minimizes the API surface
  • removes one dependent of the about to be removed schema.py (#183)
  • makes unittest_toolbox obsolete

@adityasaky
Copy link
Member

scai-demos can maybe use the API provided in in-toto's runlib to calculate file hashes? cc @marcelamelara

I'm not involved in taf atm but tagging @patzielinski in addition to Renata.

@lukpueh
Copy link
Member Author

lukpueh commented Apr 10, 2024

scai-demos can maybe use the API provided in in-toto's runlib to calculate file hashes? cc @marcelamelara

Happy to help!

I'm not involved in taf atm but tagging @patzielinski in addition to Renata.

taf at least shouldn't be disrupted, as they pin an older version of securesystemslib.

@renatav
Copy link

renatav commented Apr 10, 2024

In TAF, load_json_file is used in one (very old) test and we can easily use our own implementation of that functionality instead. I see no problems with implementing get_file_details in TAF too. We still have version pinned to 0.25.*". Thanks for the heads up!

@marcelamelara
Copy link

marcelamelara commented Apr 12, 2024

scai-demos can maybe use the API provided in in-toto's runlib to calculate file hashes? cc @marcelamelara

Took a look at this, and I think that the digest_filename function from securesystemslib.hash may be a better fit. I'll have to convert the hash object into a dict, but that should be relatively trivial.

The util.py module provides a mix of minimal functions related to local files
and directories. These functions are mostly unused, exceptions are
(according to sourcegraph.com):

- persist_temp_file in python-tuf (cc @jku)
- get_file_hashes in scai-demos (cc @marcelamelara, @adityasaky)
- get_file_details, load_json_file in taf (cc @renatav, @adityasaky)

It seems feasible to reimplement the desired functionality downstream.

The benefits of removing util.py are:

- minimizes the API surface
- removes one dependent of the about to be removed schema.py (secure-systems-lab#183)
- makes unittest_toolbox obsolete

Signed-off-by: Lukas Puehringer <[email protected]>
@lukpueh lukpueh marked this pull request as ready for review April 15, 2024 13:44
@lukpueh lukpueh requested a review from jku April 15, 2024 13:45
@lukpueh lukpueh merged commit 36a06bc into secure-systems-lab:main Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove util.file_in_confined_directories
5 participants