Skip to content
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

Removes unused and TUF-specific content from securesystemslib #165

Merged
merged 10 commits into from
Sep 6, 2019

Conversation

awwad
Copy link
Contributor

@awwad awwad commented Apr 3, 2019

This PR carves out lots of unnecessary content in securesystemslib. It:

  • removes schemas that were unused across securesystemslib, TUF, and in-toto
  • removes some functions that were unused across ssl/tuf/in-toto
  • removes schemas that are specific to TUF (requires changes in TUF that will already be made in TUF PR 846)
  • marks for future removal a function that is specific to TUF (get_targets_hash)
  • marks for future removal two compression-related functions and a compression-related exception that are currently unused across ssl/tuf/in-toto
  • removes some exceptions unused across ssl/tuf/in-toto
  • removes many exceptions that were TUF-specific (requires changes in TUF, already made in TUF PR 855)
  • removes RELPATH_SCHEMA and RELPATHS_SCHEMA, which were unnecessary/misleading and are replaced by the existing PATH_SCHEMA and PATHS_SCHEMA (appears not to require changes in in-toto; requires changes in TUF that will already be made in TUF PR 846)

It also removes or corrects relevant tests.

This largely resolves Issue #161, especially given the prior merge of PR #162.

@awwad awwad changed the title WIP: Removes TUF-specific formats from formats.py Removes TUF-specific formats from formats.py Apr 16, 2019
@awwad awwad changed the title Removes TUF-specific formats from formats.py Removes unused and TUF-specific content from securesystemslib Apr 16, 2019
@awwad awwad requested a review from lukpueh April 16, 2019 20:03
@awwad
Copy link
Contributor Author

awwad commented Apr 16, 2019

@lukpueh
I believe this is ready for review now. Should be very basic. Aside from whatever you spot, I'm curious to know if it affects in-toto. Also LMK if any of the 3 remaining, TODO-marked functions in util.py are of use to you.

awwad added a commit to theupdateframework/python-tuf that referenced this pull request Apr 16, 2019
Removal of securesystemslib exceptions that are TUF-specific
occurs in securesystemslib PR #165
secure-systems-lab/securesystemslib#165

This commit adapts to those changes.  Exceptions that are specific
to TUF should be in TUF and not in securesystemslib.  This commit
uses those already-existing TUF exceptions instead of pointing to
securesystemslib exceptions that will be removed.

For example, securesystemslib has no notion of repositories, so
it's ridiculous to have a RepositoryError in securesystemslib and
ridiculous for TUF to use
securesystemslib.exceptions.RepositoryError.

Signed-off-by: Sebastien Awwad <[email protected]>
@lukpueh
Copy link
Member

lukpueh commented Aug 14, 2019

Also closes #75

Copy link
Member

@lukpueh lukpueh left a comment

Choose a reason for hiding this comment

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

Apologies for the late review. This slipped under my radar. It mostly looks good. I'd like to double check a few more things before merging and update a few others (see TODO below).

  • Confirming that *Error classes removed from exceptions.py are obsolete or TUF-specific and in the latter case already exist in TUF.
  • Confirming that *_SCHEMA definitions removed from formats.py are obsolete or TUF-specific and in the latter case already exist in TUF. Except for the following, which are not defined but used in TUF (tip of develop branch):
    • KEYDB_SCHEMA
    • SIGNATURESTATUS_SCHEMA
    • SIGNATURES_SCHEMA
    • VERSIONINFO_SCHEMA
  • Confirming that the functions removed from util.py are obsolete.

TODO:

Largely resolves Issue #161, especially given the merge of
PR #162.

See GitHub:
#161
#162

Signed-off-by: Sebastien Awwad <[email protected]>
The following functions in securesystemslib.util are not used
anywhere, not in securesystemslib, not in TUF, and not in
in-toto:

- find_delegated_roles
- ensure_all_targets_allowed
- paths_are_consistent_with_hash_prefixes

In addition, the first two are also clearly TUF-specific (and the
third is a close call).

So I'm removing them all.  This commit also removes their tests.

Signed-off-by: Sebastien Awwad <[email protected]>
This follows from the commit with subject:
  "Removes TUF-specific formats from formats.py"

It:
- removes testing for schemas that were removed by that commit
  (TUF-specific or otherwise unnecessary schemas)
- corrects uses of the deleted RELPATH_SCHEMA to PATH_SCHEMA
  and RELPATHS_SCHEMA to PATHS_SCHEMA

Signed-off-by: Sebastien Awwad <[email protected]>
sys and fnmatch are no longer needed due to the removal of unused
functions in prior commits.

Signed-off-by: Sebastien Awwad <[email protected]>
and also marks the DecompressionError exception for possible
future removal (alongside the compression-related functions).

Signed-off-by: Sebastien Awwad <[email protected]>
@coveralls
Copy link

coveralls commented Sep 4, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 4adbc5a on carve_out_tuf_formats into ae8517d on master.

lukpueh added a commit to lukpueh/tuf that referenced this pull request Sep 5, 2019
The function used to last be implemented in securesystemslib
and repository_lib.get_taget_hash only served as wrapper.

secure-systems-lab/securesystemslib#165 drops the function as
TUF-specific.

The used constant `securesystemslib.util.HASH_FUNCTION`
is replaced with `tuf.settings.DEFAULT_HASH_ALGORITHM`, both of
which default to 'sha256'.

NOTE: repository_lib.get_taget_hash might be removed altogether in
the future (see corresponding code comment).

Signed-off-by: Lukas Puehringer <[email protected]>
Also remove now obsolete util.HASH_FUNCTION and corresponding
tests.

The function is added back to tuf in theupdateframework/python-tuf#909.
lukpueh added a commit to lukpueh/tuf that referenced this pull request Sep 5, 2019
Add schemas KEYDB_SCHEMA, SIGNATURESTATUS_SCHEMA and
VERSIONINFO_SCHEMA, removed in
secure-systems-lab/securesystemslib#165 as TUF specific, and adopt
usage accordingly.

NOTE: The usefulness of these schemas may be assessed in a
different PR.
lukpueh added a commit to lukpueh/tuf that referenced this pull request Sep 5, 2019
Add schemas KEYDB_SCHEMA, SIGNATURESTATUS_SCHEMA and
VERSIONINFO_SCHEMA, removed in
secure-systems-lab/securesystemslib#165 as TUF specific, and adopt
usage accordingly.

NOTE: The usefulness of these schemas may be assessed in a
different PR.

Signed-off-by: Lukas Puehringer <[email protected]>
@lukpueh
Copy link
Member

lukpueh commented Sep 5, 2019

@awwad, I reviewed your code and made a couple of minor additions (see #165 (review)).
Do you think you have a minute to review my commits on top of yours?

lukpueh added a commit to lukpueh/tuf that referenced this pull request Sep 5, 2019
Add schemas KEYDB_SCHEMA, SIGNATURESTATUS_SCHEMA and
VERSIONINFO_SCHEMA, removed in
secure-systems-lab/securesystemslib#165 as TUF specific, and adopt
usage accordingly.

NOTE: The usefulness of these schemas may be assessed in a
different PR.

Signed-off-by: Lukas Puehringer <[email protected]>
Copy link
Member

@adityasaky adityasaky left a comment

Choose a reason for hiding this comment

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

Verified *Error, *_SCHEMA, and util.* removed here have been moved to TUF / are no longer used.

Is there conversation around re-adding SIGNATURES_SCHEMA to securesystemslib for clarity?

@lukpueh
Copy link
Member

lukpueh commented Sep 6, 2019

Thanks for the review, @adityasaky. SIGNATURES_SCHEMA is currently still used in TUF (@develop) . Maybe it's being removed in one of the pending TUF PRs (haven't checked in that detail). For the time being, I doesn't hurt to keep it in securesystemslib.

@lukpueh lukpueh merged commit e0dd6c7 into master Sep 6, 2019
@adityasaky
Copy link
Member

Yep, I saw that! I was just wondering because it was removed then added back in. Definitely doesn't hurt to keep it around. :)

@lukpueh lukpueh mentioned this pull request Sep 9, 2019
3 tasks
lukpueh pushed a commit to theupdateframework/python-tuf that referenced this pull request Sep 17, 2019
Removal of securesystemslib exceptions that are TUF-specific
occurs in securesystemslib PR #165
secure-systems-lab/securesystemslib#165

This commit adapts to those changes.  Exceptions that are specific
to TUF should be in TUF and not in securesystemslib.  This commit
uses those already-existing TUF exceptions instead of pointing to
securesystemslib exceptions that will be removed.

For example, securesystemslib has no notion of repositories, so
it's ridiculous to have a RepositoryError in securesystemslib and
ridiculous for TUF to use
securesystemslib.exceptions.RepositoryError.

Signed-off-by: Sebastien Awwad <[email protected]>
lukpueh pushed a commit to theupdateframework/python-tuf that referenced this pull request Sep 17, 2019
Removal of securesystemslib exceptions that are TUF-specific
occurs in securesystemslib PR #165
secure-systems-lab/securesystemslib#165

This commit adapts to those changes.  Exceptions that are specific
to TUF should be in TUF and not in securesystemslib.  This commit
uses those already-existing TUF exceptions instead of pointing to
securesystemslib exceptions that will be removed.

For example, securesystemslib has no notion of repositories, so
it's ridiculous to have a RepositoryError in securesystemslib and
ridiculous for TUF to use
securesystemslib.exceptions.RepositoryError.

Signed-off-by: Sebastien Awwad <[email protected]>
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.

4 participants