Repository navigation
Conversation
Signed-off-by: Jack Leightcap <[email protected]>
| path = self._updater.download_target(target_info) | ||
| with open(path, "rb") as f: | ||
| data.append(f.read()) | ||
| target_hash = f.read() |
There was a problem hiding this comment.
Where does the target_hash variable name come from? If I'm reading this right this variable actually holds the TUF targets' raw contents, not a hash.
There was a problem hiding this comment.
From #368,
[...] TrustUpdater to log the hash (and maybe even the cached file location)
Yeah, this should be called target_cert or something. Is there an additional field on the target I'm not aware of here that the issue is referring to -- as far as I can tell this is all the actual data flow being logged.
There was a problem hiding this comment.
If you refer to my idea in the original issue:
the simplest thing might be for the TrustUpdater to log the hash (and maybe even the cached file location) of the artifacts
If that seems like a good idea, then you can just access target_info: it is of type TargetFile -- maybe something like f"Updated {target_info.path}: {target_info.hashes}" would work as a log line?
There was a problem hiding this comment.
Thanks for the docs. link, @jku 😄
Logging the whole cert is verbose, at one log level lower logging the sha256 then at debug the whole cert:
INFO:sigstore._internal.tuf:TUF cache target Fulcio ['Active', 'Expired']: fulcio_v1.crt.pem sha256 f989aa23def87c549404eadba767768d2a3c8d6d30a8b793f9f518a8eafd2cf5
DEBUG:sigstore._internal.tuf:TUF cache target fulcio_v1.crt.pem:
-----BEGIN CERTIFICATE-----
MIIB9zCCAXygAwIBAgIUALZNAPFdxHPwjeDloDwyYChAO/4wCgYIKoZIzj0EAwMw
KjEVMBMGA1UEChMMc2lnc3RvcmUuZGV2MREwDwYDVQQDEwhzaWdzdG9yZTAeFw0y
MTEwMDcxMzU2NTlaFw0zMTEwMDUxMzU2NThaMCoxFTATBgNVBAoTDHNpZ3N0b3Jl
LmRldjERMA8GA1UEAxMIc2lnc3RvcmUwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAT7
XeFT4rb3PQGwS4IajtLk3/OlnpgangaBclYpsYBr5i+4ynB07ceb3LP0OIOZdxex
X69c5iVuyJRQ+Hz05yi+UF3uBWAlHpiS5sh0+H2GHE7SXrk1EC5m1Tr19L9gg92j
YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRY
wB5fkUWlZql6zJChkyLQKsXF+jAfBgNVHSMEGDAWgBRYwB5fkUWlZql6zJChkyLQ
KsXF+jAKBggqhkjOPQQDAwNpADBmAjEAj1nHeXZp+13NWBNa+EDsDP8G1WWg1tCM
WP/WHPqpaVo0jhsweNFZgSs0eE7wYI4qAjEA2WB9ot98sIkoF3vZYdd3/VtWB5b9
TNMea7Ix/stJ5TfcLLeABLE4BNJOsQ4vnBHJ
-----END CERTIFICATE-----
does that make sense?
There was a problem hiding this comment.
LGTM -- although I don't remember if all targets are text files... if they are not, then the decode may fail
There was a problem hiding this comment.
I believe they all are, although maybe that's a bad future-looking assumption for us to make. Maybe we should limit debug logging to targets that should always be text?
There was a problem hiding this comment.
Not being very familiar with the targets, does checking the target type and:
- logging the contents, if a file (which we believe them all to be, for the moment)
- log the type of the target, otherwise
make sense?
There was a problem hiding this comment.
Yeah, all TUF targets are (conceptually) "files": a target is just a name and an associated bag of bytes.
The real underlying issue here (I think) is that not all TUF targets are guaranteed to be text; some might be binary instead. But that shouldn't be an issue with anything we currently attempt to retrieve for Sigstore purposes.
Signed-off-by: Jack Leightcap <[email protected]>
Signed-off-by: Jack Leightcap <[email protected]>
|
/gcbrun |
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: Jack Leightcap <[email protected]>
Stripping down prior branch to just one
logger.debugcall inTrustUpdater. Here, just log each of the cache items and their contained key.Closes #368
Example:
SIGSTORE_LOGLEVEL="debug" make run ARGS="verify ..."