forked from in-toto/go-witness
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: calculate subjects on demand always
We encountered errors with `witness verify` failing unexpectedly despite having the appropriate attestations available. The issue laid with some backrefs not being able to be calculated appropriately, which the policy engine then was unable to build the graph of attestations to satisfy the policy. The root cause of the issue wound up being that in some attestors subjects were calculated in the `Attest` function and stored for later use in the `Subjects` function. However, this causes issues when we are reading attestations from a source and in a context where `Attest` would have never been run on the attestor being inspected. The solution I implemented is to calculate subjects (and by extenstion backrefs) on demand from the unexported fields on the attestor structs. This way when we unmarshal them from json we will always be able to re-calculate the subjects. However, since in many cases we were using the AttestationContext's Hashes functions to decide which hashing functions to use while calculating the subjects, I am currently hard-coding in the hashes instead for the time being.
- Loading branch information
1 parent
77252cf
commit 31e6790
Showing
8 changed files
with
151 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.