fix: remove deprecated in-toto-golang dependency#3017
Conversation
|
Hi @funnelfiasco or @jeffmendoza, The main approach was to define lightweight local structs instead of pulling in the deprecated library the guesser now handles both v0.1 and v1 in-toto statement formats through a single struct. All existing tests pass without changes to test logic. Let me know if anything needs to be adjusted. |
247c585 to
bc2eefb
Compare
mlieberman85
left a comment
There was a problem hiding this comment.
Real supply chain win to drop the deprecated dependency, thanks for picking this up. Tests still pass, go.mod cleanup is clean. A few design concerns I'd like to see addressed before merge, none of them blockers individually but together they suggest the cleanup pass would land in a better place.
Structural:
-
ite6Statementis now defined in two files with different shapes: 4 fields inprocessor/guesser/type_ite6.go(handles both v0.1 and v1), 2 fields inprocessor/ite6/ite6.go(only v0.1). Different packages so no compile error, but a maintenance trap. If a v1 statement reachesprocessor/ite6/ite6.go::parseStatement, both fields unmarshal empty and the rest of the pipeline runs on garbage. Either share the struct via an internal package, or document why they intentionally diverge and what a v1 doc does in the second path. -
The merged v0.1+v1 struct in the guesser loses the explicit two-pass clarity of the original. The old code had two separate
Unmarshalcalls into properly-typed statements with explicit conditionals. The new code unmarshals everything into one struct andgetType()/getPredicateType()prefer v0.1 over v1 on ambiguity. Why does the older spec win? A doc populating both_typeandtypeis malformed, the silent preference is a footgun. Either reject mixed formats, or pick a defensible rule (in-toto v1 is the current standard, defaulting to v0.1 feels backwards). -
The local type definitions (
ProvenancePredicateV01/V02,ProvenanceMaterial, etc.) are dropped intoparser_slsa.gomixed with parsing logic. They're really local copies of types you just removed from upstream. Belongs in its own file (e.g.types_legacy.go) with a doc comment explaining why they exist locally and a marker for when SLSA v0.1/v0.2 support could be dropped entirely.
Smaller:
-
Completenessis an inline anonymous struct in bothProvenanceMetadataV01andProvenanceMetadataV02. Works, but you can't reference these types elsewhere and they're hard to inspect. Named types would be cleaner. -
New constants
PredicateSLSAProvenanceV01/V02use uppercase V, the pre-existingPredicateSLSAProvenancev1uses lowercase v. Pick one convention. -
Test coverage: I see updates for
parser_slsa_test.goandsigstore_verifier_test.go, none fortype_ite6.go. The merged-struct guesser logic is the most behavior-changing part of this PR and should have explicit tests for both v0.1 and v1 inputs, plus the ambiguous-fields case. -
sigstore_verifier_test.gonow constructs the statement with hand-rolled local types instead of canonical types. Test still passes, but it's now testing self-defined shapes rather than the format the verifier actually consumes in production. Worth keeping the test types as close to upstream as possible.
None of this is hard to address. Happy to look again.
fd425bf to
9ef7e38
Compare
|
Hi @mlieberman85, |
Signed-off-by: Abhishek <abhishekup082@gmail.com>
Signed-off-by: Abhishek <abhishekup082@gmail.com>
Signed-off-by: Abhishek <abhishekup082@gmail.com>
359c2b5 to
975101e
Compare
|
Hi @mlieberman85, |
Description of the PR
Removes the deprecated
in-toto-golanglibrary from the codebase. The guesser, processor, and parser were still importing types fromin-toto-golangthis PR replaces those with local type definitions.Changes:
type_ite6.go: replacedin_toto.Statement/attestationv1.Statementwith a localite6Statementstruct that handles both v0.1 and v1 in-toto statement formatsite6.go: same swappedattestationv1.Statementfor a local structparser_slsa.go: defined localDigestSet,ProvenanceMaterial,ProvenancePredicateV01/V02types to replacescommon,slsa01,slsa02importsparser_slsa_test.go/sigstore_verifier_test.go: updated to use the new local typesgo.mod: removedin-toto-golangas a direct dependencyFixes #2036
PR Checklist
-sflag togit commit.