Skip to content

Commit bc3ee3b

Browse files
refactor(client, add): add detailed error when verified root metadata hash does not match
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
1 parent fc696ad commit bc3ee3b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/pkg/tuf/client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,13 @@ func (c *Client) setup(rootVersion int64, rootSha512 string) error {
135135

136136
rootFileChecksum := util.Sha512Checksum(jsonData)
137137
if rootSha512 != "" && rootFileChecksum != rootSha512 {
138-
return fmt.Errorf("expected hash sum of the root file %q not matched", rootFileChecksum)
138+
return fmt.Errorf(
139+
`expected root metadata hash (%q) does not match the actual one (%q) returned by the server
140+
141+
This may indicate an attempt to use an untrusted TUF repository or arguments mismatched. Please verify the repository URL and other arguments. If the issue persists, contact the vendor or repository maintainer for clarification.`,
142+
rootSha512,
143+
rootFileChecksum,
144+
)
139145
}
140146

141147
if err := os.RemoveAll(c.metaLocalStoreDir); err != nil {

0 commit comments

Comments
 (0)