-
Notifications
You must be signed in to change notification settings - Fork 36
Fix and test the sharded file hasher #465
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
Fix and test the sharded file hasher #465
Conversation
Bring the sharded hasher to the same state as the simple file hasher: - Record ignored files in the predicate's serialization description - Adjust the model name in case it is either empty or '..' Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
cfd6979
to
8a099c7
Compare
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
8a099c7
to
25a8080
Compare
Seeing these non-deterministic errors here:
|
I recommend using unshare --map-root-user --net pytest -v -m "not integration"
~/model-transparency/tests/api_test.py:260:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
~/model-transparency/src/model_signing/signing.py:90: in __init__
self.use_sigstore_signer()
~/model-transparency/src/model_signing/signing.py:147: in use_sigstore_signer
self._signer = sigstore.Signer(
~/model-transparency/src/model_signing/_signing/sign_sigstore.py:93: in __init__
self._signing_context = sigstore_signer.SigningContext.production()
~/.local/share/hatch/env/virtual/model-signing/VsHuyp0T/hatch-test.py3.12/lib/python3.12/site-packages/sigstore/sign.py:334: in production
trusted_root=TrustedRoot.production(),
~/.local/share/hatch/env/virtual/model-signing/VsHuyp0T/hatch-test.py3.12/lib/python3.12/site-packages/sigstore/_internal/trust.py:351: in production
return cls.from_tuf(DEFAULT_TUF_URL, offline)
~/.local/share/hatch/env/virtual/model-signing/VsHuyp0T/hatch-test.py3.12/lib/python3.12/site-packages/sigstore/_internal/trust.py:338: in from_tuf
path = TrustUpdater(url, offline).get_trusted_root_path() Since Sigstore is the default, the TUF fetching code is invoked when the tests call model-transparency/tests/api_test.py Lines 326 to 330 in 25a8080
We have a few options:
I lean towards option 2, @mihaimaruseac may have other thoughts. |
Yeah, let's do option 2. Merged the other PR already. |
I happens very rarely on my development machine and more often in the github actions actually. I got this here: 8000 p>
If feels like this error is related to concurrency and could even show up if someone ran multiple instances of the model_signing library while creating signatures concurrently. If so, the TUF library should probably have a lock/lock-file that prevents concurrency inside this function. |
It sounds like this should be fixed by sigstore-python instead (I'll file an issue):
|
I don't disagree (it's just that implementing lockfiles well is not always trivial) theupdateframework/python-tuf#2836 As a potential fix for the parallel testing use case specifically: The conflict happens because the tuf client writes/reads files in the metadata store and artifact cache. These locations are decided by sigstore-python based on user data dir and user cache dir respectively (with https://github.com/tox-dev/platformdirs). So if you are able to set those to a unique location for each te 7AB4 st, then conflicts will not happen... Unfortunately that probably requires platform-specific shenanigans: setting e.g. $XDG_DATA_HOME is unlikely to do anything on Windows |
Summary
This PR brings the state of the sharded file hasher to that of the simple file hasher and adds a test case for the shareded file hasher derived from the certificate sign+verify test.
Checklist