question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support abstract files and directories

See original GitHub issue

So far we built on the assumption that both target files and TUF metadata can be loaded from and written to the local filesystem. This, however, is no necessity. In a large-scale production environment (like e.g. Python warehouse, see PEP 458) the TUF repository management code (most notably repository_tool and its underlying repository_lib) can and is likely to run on a different node than where TUF metadata files or target files reside. To support distributed operation, TUF repository code needs to be updated as outlined below.

metadata files

  • Provide an abstract file interface that supports at least reading and writing files, creating directories and listing files in a directory (implement this in securesystemslib).

  • Provide a file service that implements the abstract file interface and performs said file operations on the local file system to be used below as default file backend (implement this in securesystemslib).

  • Update TUF repository code to create a new or load an existing TUF repository, to obtain hashes and sizes of metadata files, and to persist metadata files, all using a customizable file backend.

    (repository_lib.generate_snapshot_metadata, repository_lib.write_metadata_file, repository_tool.create_new_repository, repository_tool.load_repository (**))

  • Update securesystemslib code that is currently used by TUF repository code for file operations to support the use of a customizable file backend.

    (util.get_file_details, util.load_json_file, util.persist_temp_file, hash.digest_filename(**))

  • Revise file existence checks (os.path.{isfile,isdir,exists}) in TUF repository code, and depending on which seems less invasive, or generally better suited, either

    • switch to a file system agnostic EAFP-style (e.g. catching IOError), or
    • allow TUF to perform these checks using a customizable file backend.

    (repository_lib.generate_targets_metadata, repository_lib.write_metadata_file, repository_lib._check_directory, repository_lib._delete_obsolete_metadata, repository_lib._load_top_level_metadata(**))

(**) (Non-exhaustive list of probably affected functions)

target files

@joshuagl and @sechkova have submitted PRs that decouple abstract targets in TUF metadata from their physical equivalents on disk. This work includes:

  • removal of file existence checks in user functions that add target files to the internal TUF metadata store (#1008),

  • support for a fileinfo argument on add target user functions to pass out-of-band obtained hashes and sizes of files (#1007),

  • support for a use_existing_fileinfo on write metadata user functions, to user prior passed hashes and sizes instead of obtaining them by reading files on disk.

  • Update TUF repository code to obtain hashes and sizes of target files using a customizable file backend. (Note that above PRs suffice to operate TUF with non-local target files, hence this sub-feature request is low-prio.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:27 (26 by maintainers)

github_iconTop GitHub Comments

6reactions
lukpuehcommented, Jun 12, 2020

Thanks to @joshuagl and @sechkova for implementing and adopting this feature!! ❤️ 🎉 💯

2reactions
woodruffwcommented, Apr 8, 2020

That proposed interface looks fantastic, thanks a ton @joshuagl!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Backup Abstract
Moving or altering your files from the Applications Support folder could cause problems when you use Abstract. To back up your Abstract files, ......
Read more >
java - what is the meaning of "abstract representation"?
An abstract representation of file and directory pathnames. User interfaces and operating systems use system-dependent pathname strings to ...
Read more >
2.6. The UNIX File Abstraction
The most basic operations for working with files are creating and opening them. For files that can be identified with named locations in...
Read more >
File (Java Platform SE 8 ) - Oracle Help Center
An abstract representation of file and directory pathnames. User interfaces and operating systems use system-dependent pathname strings to name files and ...
Read more >
Java.io.File Class in Java - GeeksforGeeks
It is an abstract representation of files and directory pathnames. A pathname, whether abstract or in string form can be either absolute or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found