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.

`delegate_hashed_bins` must hash a target path as it appears in metadata

See original GitHub issue

Description of issue or feature request: Fix in accordance with https://github.com/theupdateframework/tuf/issues/957 (and #963)!!

The repository tool’s delegate_hashed_bins creates hash bins (delegated targets roles) and assigns passed target file paths based on their hash. Later it calls delegate for each bin passing the relevant paths. delegate then might left-strip the targets directory path from each targets path, changing the targets path in a way that it no longer is in the right bin.

Current behavior: delegate_hashed_bins might hash target path based on a different path than the one that will appear in the (delegated) targets metadata.

Expected behavior: delegate_hashed_bins must hash a target path as it appears in metadata.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
lukpuehcommented, Mar 13, 2020

@trishankatdatadog, you were right. The variables in the division were switched plus two other minor issues (see edit history of comment). For my defense I only quickly wrote this up today from some pen and paper notes I took last week. Apologies. 😃 You should be able to copy-paste the updated snippet into your interpreter now and it should show that it works.

1reaction
lukpuehcommented, Mar 13, 2020

Also, as hinted above, this snippet should not be copy-pasted as is. It will need some fleshing out to replace the existing functionality in repository_tool. I just wanted to outline the algorithm I had in mind, for distributing targets in an ordered list of bins, where the index equals the bin size divided by the lower bound of the hash prefix range served by the bin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

While obtaining hash files, some folders and files from the ...
My code was working just fine before adding the hash function. I was getting the list of all folders and files in my...
Read more >
Configuring hash settings - IBM
For metadata based hashes, clear the Compute data object hash checkbox. For creating a hash for email, select what email attributes are considered...
Read more >
Get-FileHash (Microsoft.PowerShell.Utility)
The Get-FileHash cmdlet computes the hash value for a file by using a specified hash algorithm. A hash value is a unique value...
Read more >
What is hashing and how does it work? - TechTarget
A hash table stores key and value pairs in a list that is accessible through its index. Because key and value pairs are...
Read more >
URLs and Hashing | Safe Browsing APIs (v4)
The Safe Browsing lists consist of variable length SHA256 hashes (see List ... The URL must include a path component; that is, it...
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