Debian Codegraph @

metadata/updater/updater_top_level_update_test.go

raw symbols SCIP
1 // Copyright 2024 The Update Framework Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License
14 //
15 // SPDX-License-Identifier: Apache-2.0
16 //
17
18 package updaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/
19
20 import (
21 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
22 "log/slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/"
23 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
24 "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/"
25 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
26 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
27
28 "github.com/sigstore/sigstore/pkg/signaturescip-go gomod github.com/sigstore/sigstore v1.10.6 `github.com/sigstore/sigstore/pkg/signature`/"
29 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
30
31 "github.com/theupdateframework/go-tuf/v2/internal/testutilsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils`/"
32 "github.com/theupdateframework/go-tuf/v2/internal/testutils/simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/"
33 "github.com/theupdateframework/go-tuf/v2/metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/"
34 "github.com/theupdateframework/go-tuf/v2/metadata/configscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/"
35 )
36
37 func TestMainscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestMain().(m *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Mscip-go gomod github.com/golang/go/src go1.25.0 testing/M#) {
38 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
39 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime. = timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().UTCscip-go gomod github.com/golang/go/src go1.25.0 time/Time#UTC().().Truncatescip-go gomod github.com/golang/go/src go1.25.0 time/Time#Truncate().(24 * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour.).Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(-5 * 24 * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour.)
40
41 if err != nil {
42 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.RepositoryCleanupscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositoryCleanup().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir.)
43 slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Errorscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Error().("Failed to load TrustedRootMetadata", "err", err)
44 osscip-go gomod github.com/golang/go/src go1.25.0 os/.Exitscip-go gomod github.com/golang/go/src go1.25.0 os/Exit().(1)
45 }
46
47 defer simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.RepositoryCleanupscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositoryCleanup().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir.)
48 m.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/M#Run().()
49 }
50
51 func loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().() error {
52 // TODO: This should be a t.Helper() function
53 var err error
54
55 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim., simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., testutilsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils`/.TargetsDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils`/TargetsDir., err = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.InitMetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/InitMetadataDir().()
56 if err != nil {
57 slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Errorscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Error().("Failed to initialize metadata dir", "err", err)
58 return err
59 }
60
61 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.RootBytesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RootBytes., err = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.GetRootBytesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/GetRootBytes().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir.)
62 if err != nil {
63 slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Errorscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Error().("Failed to load root bytes", "err", err)
64 return err
65 }
66
67 return nil
68 }
69
70 func loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().() (*configscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/.UpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#, error) {
71 updaterConfig, err := configscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/.Newscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/New().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.RootBytesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RootBytes.)
72 updaterConfig.Fetcherscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#Fetcher. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim.
73 updaterConfig.LocalMetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#LocalMetadataDir. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir.
74 updaterConfig.LocalTargetsDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#LocalTargetsDir. = testutilsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils`/.TargetsDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils`/TargetsDir.
75 return updaterConfig, err
76 }
77
78 func loadUnsafeUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUnsafeUpdaterConfig().() (*configscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/.UpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#, error) {
79 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
80 if err != nil {
81 return nil, err
82 }
83 updaterConfig.UnsafeLocalModescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#UnsafeLocalMode. = true
84
85 return updaterConfig, nil
86 }
87
88 // runRefresh creates new Updater instance and runs Refresh
89 func runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig *configscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/.UpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#, moveInTime timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#) (Updaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#, error) {
90 if len(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..DumpDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#DumpDir.) > 0 {
91 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Writescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Write().()
92 }
93
94 updater, err := Newscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/New().(updaterConfig)
95 if err != nil {
96 slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Errorscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Error().("Failed to create new updater config", "err", err)
97 return Updaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#{}, err
98 }
99
100 if moveInTime != timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().() {
101 updater.UnsafeSetRefTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#UnsafeSetRefTime().(moveInTime)
102 }
103
104 return *updater, updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
105 }
106
107 func initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig *configscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/.UpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#) *Updaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater# {
108 if len(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..DumpDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#DumpDir.) > 0 {
109 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Writescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Write().()
110 }
111
112 updater, err := Newscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/New().(updaterConfig)
113 if err != nil {
114 slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Errorscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Error().("Failed to create new updater config", "err", err)
115 }
116
117 return updater
118 }
119
120 // Asserts that local metadata files exist for 'roles'
121 func assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, roles []string) {
122 expectedFiles := []string{}
123
124 for _, role := range roles {
125 expectedFiles = append(expectedFiles, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.json", role))
126 }
127 localMetadataFiles, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadDirscip-go gomod github.com/golang/go/src go1.25.0 os/ReadDir().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir.)
128 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
129
130 actual := []string{}
131 for _, file := range localMetadataFiles {
132 actual = append(actual, file.Namescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#Name().())
133 }
134
135 for _, file := range expectedFiles {
136 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, actual, file)
137 }
138 }
139
140 func assertFilesExactscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExact().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, roles []string) {
141 expectedFiles := []string{}
142
143 for _, role := range roles {
144 expectedFiles = append(expectedFiles, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.json", role))
145 }
146 localMetadataFiles, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadDirscip-go gomod github.com/golang/go/src go1.25.0 os/ReadDir().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir.)
147 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
148
149 actual := []string{}
150 for _, file := range localMetadataFiles {
151 actual = append(actual, file.Namescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#Name().())
152 }
153
154 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ElementsMatchscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ElementsMatch().(t, actual, expectedFiles)
155 }
156
157 // Asserts that local file content is the expected
158 func assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, role string, version *int) {
159 expectedContent, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..FetchMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#FetchMetadata().(role, version)
160 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
161
162 content, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.0 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.json", role)))
163 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
164 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, string(expectedContent), string(content))
165 }
166
167 func assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, role string, expectedVersion int64) {
168 path := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.json", role))
169 switch role {
170 case metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.:
171 md, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(path)
172 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
173 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, md.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version., expectedVersion)
174 case metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TARGETSscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TARGETS.:
175 md, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(path)
176 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
177 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, md.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version., expectedVersion)
178 case metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP.:
179 md, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(path)
180 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
181 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, md.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version., expectedVersion)
182 case metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.:
183 md, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(path)
184 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
185 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, md.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version., expectedVersion)
186 }
187 }
188
189 func TestLoadTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestLoadTrustedRootMetadata().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
190 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
191 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
192
193 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
194 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
195 updater, err := Newscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/New().(updaterConfig)
196 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
197
198 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
199 if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, updater) {
200 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Typescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Type.)
201 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SPECIFICATION_VERSIONscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SPECIFICATION_VERSION., updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..SpecVersionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#SpecVersion.)
202 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..ConsistentSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#ConsistentSnapshot.)
203 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, int64(1), updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version.)
204 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Snapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Snapshot.)
205 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Timestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Timestamp.)
206 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Empty().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Targetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Targets.)
207 }
208 }
209
210 func TestUnsafeLoadTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestUnsafeLoadTrustedRootMetadata().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
211 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
212 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
213
214 updaterConfig, err := loadUnsafeUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUnsafeUpdaterConfig().()
215 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
216 updater, err := Newscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/New().(updaterConfig)
217 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
218
219 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
220 if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, updater) {
221 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Typescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Type.)
222 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SPECIFICATION_VERSIONscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SPECIFICATION_VERSION., updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..SpecVersionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#SpecVersion.)
223 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..ConsistentSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#ConsistentSnapshot.)
224 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, int64(1), updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version.)
225 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Snapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Snapshot.)
226 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Timestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Timestamp.)
227 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Empty().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Targetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Targets.)
228 }
229 }
230
231 func TestFirstTimeRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestFirstTimeRefresh().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
232 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
233 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
234
235 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
236 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
237 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
238
239 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
240 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
241 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
242 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
243 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES.[:])
244
245 for _, role := range metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES. {
246 var version int
247 if role == metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT. {
248 version = 2
249 }
250 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, role, &version)
251 }
252 }
253
254 func TestFirstUnsafeTimeRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestFirstUnsafeTimeRefresh().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
255 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
256 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
257
258 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
259 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
260 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
261
262 updaterConfig, err := loadUnsafeUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUnsafeUpdaterConfig().()
263 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
264 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
265 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, err)
266 // As no update was made only the root file should be present
267 assertFilesExactscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExact().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
268 }
269
270 func TestUnsafeRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestUnsafeRefresh().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
271 // First run a "real" refresh
272 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
273 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
274
275 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
276 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
277 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
278
279 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
280 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
281 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
282 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
283 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES.[:])
284
285 // Create a new unsafe updater, verify content is still valid
286 updaterConfig, err = loadUnsafeUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUnsafeUpdaterConfig().()
287 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
288 updater, err := runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
289 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, updater)
290 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
291 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES.[:])
292
293 for _, role := range metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES. {
294 var version int
295 if role == metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT. {
296 // The root file is written when the updater is
297 // created, so the version is reset.
298 version = 1
299 }
300 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, role, &version)
301 }
302
303 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Typescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Type.)
304 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SPECIFICATION_VERSIONscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SPECIFICATION_VERSION., updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..SpecVersionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#SpecVersion.)
305 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..ConsistentSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#ConsistentSnapshot.)
306 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, int64(1), updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Rootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Root..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version.)
307 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Snapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Snapshot.)
308 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Timestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Timestamp.)
309 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(updater.trustedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#trusted..Targetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/trustedmetadata`/TrustedMetadata#Targets.))
310 }
311
312 func TestTrustedRootMissingscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestTrustedRootMissing().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
313 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
314 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
315
316 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
317 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
318 localTrusedRoot := updaterConfig.LocalTrustedRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#LocalTrustedRoot.
319 updaterConfig.LocalTrustedRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#LocalTrustedRoot. = []byte{}
320 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
321 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorContains().(t, err, "no initial trusted root metadata or remote URL provided")
322 updaterConfig.LocalTrustedRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#LocalTrustedRoot. = localTrusedRoot
323 }
324
325 func TestTrustedRootExpiredscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestTrustedRootExpired().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
326 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
327 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
328
329 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime.
330 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
331 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
332
333 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
334 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
335 updater := initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
336 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
337 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrExpiredMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#Msg.: "final root.json is expired"})
338
339 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
340 version := 2
341 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
342
343 updater = initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
344
345 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..SafeExpiryscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#SafeExpiry.
346 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
347 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
348 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
349 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
350
351 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES.[:])
352 version = 3
353 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
354 }
355
356 func TestTrustedRootUnsignedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestTrustedRootUnsigned().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
357 // Local trusted root is not signed
358
359 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
360 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
361
362 rootPath := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.json", metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.))
363 mdRoot, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(rootPath)
364 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
365
366 mdRoot.ClearSignaturesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#ClearSignatures().()
367 err = mdRoot.ToFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#ToFile().(rootPath, true)
368 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
369 newRootBytes, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.0 os/ReadFile().(rootPath)
370 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
371 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.RootBytesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RootBytes. = newRootBytes
372
373 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
374 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
375 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
376 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrUnsignedMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#Msg.: "Verifying root failed, not enough signatures, got 0, want 1"})
377
378 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
379 mdRootAfter, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(rootPath)
380 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
381 expected, err := mdRoot.ToBytesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#ToBytes().(false)
382 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
383 actual, err := mdRootAfter.ToBytesscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#ToBytes().(false)
384 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
385
386 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, actual)
387 }
388
389 func TestMaxRootRotationsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestMaxRootRotations().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
390 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
391 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
392
393 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
394 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
395 updater := initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
396 updater.cfgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#cfg..MaxRootRotationsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#MaxRootRotations. = 3
397
398 for simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. < updater.cfgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#cfg..MaxRootRotationsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#MaxRootRotations.+3 {
399 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
400 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
401 }
402
403 rootPath := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.json", metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.))
404 mdRoot, err := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(rootPath)
405 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
406 initialRootVersion := mdRoot.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version.
407
408 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
409 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
410
411 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., initialRootVersion+updaterConfig.MaxRootRotationsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#MaxRootRotations.)
412 }
413
414 func TestIntermediateRootInclorrectlySignedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestIntermediateRootInclorrectlySigned().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
415 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
416 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
417
418 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
419 rootSigners := make(map[string]*signaturescip-go gomod github.com/sigstore/sigstore v1.10.6 `github.com/sigstore/sigstore/pkg/signature`/.Signerscip-go gomod github.com/sigstore/sigstore v1.10.6 `github.com/sigstore/sigstore/pkg/signature`/Signer#)
420 for k, v := range simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Signersscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Signers.[metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.] {
421 rootSigners[k] = v
422 }
423 for k := range simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Signersscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Signers.[metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.] {
424 delete(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Signersscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Signers.[metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.], k)
425 }
426 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
427
428 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
429 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
430 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
431 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrUnsignedMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#Msg.: "Verifying root failed, not enough signatures, got 0, want 1"})
432
433 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
434 version := 1
435 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
436 }
437
438 func TestIntermediateRootExpiredscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestIntermediateRootExpired().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
439 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
440 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
441
442 // The expiration of the new (intermediate) root metadata file
443 // does not matter yet
444
445 // Intermediate root v2 is expired
446 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime.
447 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
448 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
449
450 // Final root v3 is up to date
451 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..SafeExpiryscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#SafeExpiry.
452 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
453 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
454
455 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
456 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
457 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
458 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
459
460 // Successfully updated to root v3
461 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TOP_LEVEL_ROLE_NAMESscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TOP_LEVEL_ROLE_NAMES.[:])
462 version := 3
463 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
464 }
465
466 func TestNewRootSameVersionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewRootSameVersion().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
467 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
468 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
469
470 // Check for a rollback_attack
471 // Repository serves a root file with the same version as previous
472 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
473
474 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
475 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
476 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
477 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "bad version number, expected 2, got 1"})
478
479 // The update failed, latest root version is v1
480 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
481 version := 1
482 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
483 }
484
485 func TestNewRootNonconsecutiveVersionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewRootNonconsecutiveVersion().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
486 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
487 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
488
489 // Repository serves non-consecutive root version
490 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 2
491 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
492
493 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
494 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
495 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
496 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "bad version number, expected 2, got 3"})
497
498 // The update failed, latest root version is v1
499 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
500 version := 1
501 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
502 }
503
504 func TestFinalRootExpiredscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestFinalRootExpired().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
505 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
506 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
507
508 // Check for a freeze attack
509 // Final root is expired
510 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime.
511 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
512 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
513
514 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
515 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
516 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
517 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrExpiredMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#Msg.: "final root.json is expired"})
518
519 // The update failed but final root is persisted on the file system
520 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
521 version := 2
522 assertContentEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertContentEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., &version)
523 }
524
525 func TestNewTimestampUnsignedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTimestampUnsigned().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
526 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
527 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
528
529 // Check for an arbitrary software attack
530 delete(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Signersscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Signers., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP.)
531
532 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
533 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
534 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
535 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrUnsignedMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#Msg.: "Verifying timestamp failed, not enough signatures, got 0, want 1"})
536
537 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
538 }
539
540 func TestExpiredTimestampVersionRollbackscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestExpiredTimestampVersionRollback().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
541 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
542 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
543
544 // Verifies that local timestamp is used in rollback checks even if it is expired.
545 // The timestamp updates and rollback checks are performed
546 // with the following timing:
547 // - Timestamp v1 expiry set to day 7
548 // - First updater refresh performed on day 0
549 // - Repository publishes timestamp v2 on day 0
550 // - Timestamp v2 expiry set to day 21
551 // - Second updater refresh performed on day 18:
552 // assert that rollback check uses expired timestamp v1
553
554 now := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().()
555 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Expires. = now.Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 7 * 24)
556 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. = 2
557
558 // Make a successful update of valid metadata which stores it in cache
559 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
560 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
561 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
562 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
563
564 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Expires. = now.Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 21 * 24)
565 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. = 1
566
567 // Check that a rollback protection is performed even if
568 // local timestamp has expired
569 moveInTime := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 18 * 24)
570 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, moveInTime)
571 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "new timestamp version 1 must be >= 2"})
572 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 2)
573 }
574
575 func TestNewTimestampVersionRollbackscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTimestampVersionRollback().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
576 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
577 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
578
579 // Check for a rollback attack
580 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. = 2
581 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
582 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
583 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
584 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
585
586 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. = 1
587 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
588 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "new timestamp version 1 must be >= 2"})
589 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 2)
590 }
591
592 func TestNewTimestampSnapshotRollbackscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTimestampSnapshotRollback().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
593 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
594 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
595
596 // Check for a rollback attack.
597 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. = 2
598 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().() // timestamp v2
599 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
600 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
601 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
602 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
603
604 // Snapshot meta version is smaller than previous
605 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Metascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Meta.["snapshot.json"].Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/MetaFiles#Version. = 1
606 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. += 1 // timestamp v3
607 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
608 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "new snapshot version 1 must be >= 2"})
609 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 2)
610 }
611
612 func TestNewTimestampExpiredscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTimestampExpired().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
613 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
614 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
615
616 // Check for a freeze attack
617 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime.
618 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().()
619 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
620 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
621 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
622 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrExpiredMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#Msg.: "timestamp.json is expired"})
623 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
624 }
625
626 func TestNewTimestampFastForwardRecoveryscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTimestampFastForwardRecovery().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
627 //Test timestamp fast-forward recovery using key rotation.
628
629 // The timestamp recovery is made by the following steps
630 // - Remove the timestamp key
631 // - Create and add a new key for timestamp
632 // - Bump and publish root
633 // - Rollback the timestamp version
634
635 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
636 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
637
638 // attacker updates to a higher version
639 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. = 99999
640
641 // client refreshes the metadata and see the new timestamp version
642 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
643 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
644 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
645 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
646 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 99999)
647
648 // repository rotates timestamp keys, rolls back timestamp version
649 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..RotateKeysscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#RotateKeys().(metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP.)
650 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
651 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
652 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. = 1
653
654 // client refresh the metadata and see the initial timestamp version
655 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
656 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
657 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 1)
658 }
659
660 func TestNewSnapshotHashMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewSnapshotHashMismatch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
661 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
662 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
663
664 // Check against timestamp role’s snapshot hash
665
666 // Update timestamp with snapshot's hashes
667 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..ComputeMetafileHashesAndLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#ComputeMetafileHashesAndLength. = true
668 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().() // timestamp v2
669 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
670 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
671 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
672 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
673
674 // Modify snapshot contents without updating
675 // timestamp's snapshot hash
676 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Expires..Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 24)
677 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. += 1 // snapshot v2
678 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Metascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Meta.["snapshot.json"].Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/MetaFiles#Version. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version.
679 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version. += 1 // timestamp v3
680
681 // Hash mismatch error
682 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
683 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrLengthOrHashMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrLengthOrHashMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrLengthOrHashMismatch#Msg.: "hash verification failed - mismatch for algorithm sha256"})
684 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 3)
685 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 1)
686 }
687
688 func TestNewSnapshotUnsignedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewSnapshotUnsigned().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
689 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
690 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
691
692 // Check for an arbitrary software attack
693 delete(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Signersscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Signers., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.)
694 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
695 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
696 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
697 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrUnsignedMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#Msg.: "Verifying snapshot failed, not enough signatures, got 0, want 1"})
698
699 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP.})
700 }
701
702 func TestNewSnapshotVersionMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewSnapshotVersionMismatch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
703 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
704 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
705
706 // Check against timestamp role’s snapshot version
707
708 // Increase snapshot version without updating timestamp
709 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. += 1
710
711 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
712 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
713 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
714 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "expected 1, got 2"})
715
716 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP.})
717 }
718
719 func TestNewSnapshotVersionRollbackscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewSnapshotVersionRollback().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
720 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
721 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
722
723 // Check for a rollback attack
724 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. = 2
725 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().()
726 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
727 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
728 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
729 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
730
731 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. = 1
732 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().()
733 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
734 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "new snapshot version 1 must be >= 2"})
735
736 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 2)
737 }
738
739 func TestNewSnapshotFastForwardRecoveryscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewSnapshotFastForwardRecovery().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
740 // Test snapshot fast-forward recovery using key rotation.
741
742 // The snapshot recovery requires the snapshot and timestamp key rotation.
743 // It is made by the following steps:
744 // - Remove the snapshot and timestamp keys
745 // - Create and add a new key for snapshot and timestamp
746 // - Rollback snapshot version
747 // - Bump and publish root
748 // - Bump the timestamp
749
750 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
751 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
752
753 // attacker updates to a higher version (bumping timestamp is required)
754 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. = 99999
755 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().()
756
757 // client refreshes the metadata and see the new snapshot version
758 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
759 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
760 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
761 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
762 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 99999)
763
764 // repository rotates snapshot & timestamp keys, rolls back snapshot
765 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..RotateKeysscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#RotateKeys().(metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.)
766 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..RotateKeysscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#RotateKeys().(metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP.)
767 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
768 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
769
770 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. = 1
771 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().()
772
773 // client refresh the metadata and see the initial snapshot version
774 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
775 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
776 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 1)
777 }
778
779 func TestNewSnapshotExpiredscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewSnapshotExpired().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
780 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
781 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
782
783 // Check for a freeze attack
784 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime.
785 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
786
787 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
788 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
789 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
790 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrExpiredMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#Msg.: "snapshot.json is expired"})
791
792 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT.})
793 }
794
795 func TestNewTargetsHashMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTargetsHashMismatch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
796 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
797 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
798
799 // Check against snapshot role’s targets hashes
800 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..ComputeMetafileHashesAndLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#ComputeMetafileHashesAndLength. = true
801 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
802 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
803 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
804 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
805 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
806
807 // Modify targets contents without updating
808 // snapshot's targets hashes
809 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. += 1
810 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Metascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Meta.["targets.json"].Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/MetaFiles#Version. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version.
811 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDSnapshot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version. += 1
812 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateTimestamp().()
813
814 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
815 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrLengthOrHashMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrLengthOrHashMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrLengthOrHashMismatch#Msg.: "hash verification failed - mismatch for algorithm sha256"})
816
817 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 3)
818 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TARGETSscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TARGETS., 1)
819 }
820
821 func TestNewTargetsUnsignedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTargetsUnsigned().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
822 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
823 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
824
825 // Check for an arbitrary software attack
826 delete(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..Signersscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#Signers., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TARGETSscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TARGETS.)
827
828 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
829 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
830 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
831 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrUnsignedMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrUnsignedMetadata#Msg.: "Verifying targets failed, not enough signatures, got 0, want 1"})
832
833 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.})
834 }
835
836 func TestNewTargetsVersionMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTargetsVersionMismatch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
837 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
838 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
839
840 // Check against snapshot role’s targets version
841
842 // Increase targets version without updating snapshot
843 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. += 1
844 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
845 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
846 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
847 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "expected targets version 1, got 2"})
848
849 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.})
850 }
851
852 func TestNewTargetsExpiredscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTargetsExpired().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
853 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
854 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
855
856 // Check for a freeze attack.
857 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Expires. = simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.PastDateTimescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/PastDateTime.
858 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
859
860 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
861 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
862 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
863 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrExpiredMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrExpiredMetadata#Msg.: "new targets is expired"})
864
865 assertFilesExistscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertFilesExist().(t, []string{metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ROOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ROOT., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.})
866 }
867
868 func TestComputeMetafileHashesLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestComputeMetafileHashesLength().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
869 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
870 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
871
872 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..ComputeMetafileHashesAndLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#ComputeMetafileHashesAndLength. = true
873 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
874 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
875 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
876 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
877 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
878
879 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 2)
880 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 2)
881
882 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..ComputeMetafileHashesAndLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#ComputeMetafileHashesAndLength. = false
883 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
884 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
885 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
886
887 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TIMESTAMPscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TIMESTAMP., 3)
888 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT., 3)
889 }
890
891 func TestNewTargetsFastForwardRecoveryscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestNewTargetsFastForwardRecovery().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
892 //Test targets fast-forward recovery using key rotation.
893
894 // The targets recovery is made by issuing new Snapshot keys, by following
895 // steps:
896 // - Remove the snapshot key
897 // - Create and add a new key for snapshot
898 // - Bump and publish root
899 // - Rollback the target version
900
901 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
902 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
903
904 // attacker updates to a higher version
905 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. = 99999
906 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
907
908 // client refreshes the metadata and see the new targets version
909 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
910 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
911 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
912 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
913 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TARGETSscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TARGETS., 99999)
914
915 // repository rotates snapshot keys, rolls back targets version
916 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..RotateKeysscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#RotateKeys().(metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.SNAPSHOTscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SNAPSHOT.)
917 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
918 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
919
920 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. = 1
921 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
922
923 // client refreshes the metadata version and see initial targets version
924 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
925 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
926 assertVersionEqualsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/assertVersionEquals().(t, metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.TARGETSscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TARGETS., 1)
927 }
928
929 func TestSnapshotRollbackWithLocalSnapshotHashMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestSnapshotRollbackWithLocalSnapshotHashMismatch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
930 // Test triggering snapshot rollback check on a newly downloaded snapshot
931 // when the local snapshot is loaded even when there is a hash mismatch
932 // with timestamp.snapshot_meta.
933
934 // By raising this flag on timestamp update the simulator would:
935 // 1) compute the hash of the new modified version of snapshot
936 // 2) assign the hash to timestamp.snapshot_meta
937 // The purpose is to create a hash mismatch between timestamp.meta and
938 // the local snapshot, but to have hash match between timestamp.meta and
939 // the next snapshot version.
940
941 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
942 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
943
944 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..ComputeMetafileHashesAndLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#ComputeMetafileHashesAndLength. = true
945
946 // Initialize all metadata and assign targets version higher than 1.
947 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. = 2
948 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
949
950 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
951 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
952 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
953 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
954
955 // The new targets must have a lower version than the local trusted one.
956 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. = 1
957 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
958
959 // During the snapshot update, the local snapshot will be loaded even if
960 // there is a hash mismatch with timestamp snapshot meta, because it will
961 // be considered as trusted.
962 // Should fail as a new version of snapshot will be fetched which lowers
963 // the snapshot meta "targets.json" version by 1 and throws an error.
964 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
965 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrBadVersionNumberscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrBadVersionNumber#Msg.: "expected targets.json version 1, got 2"})
966 }
967
968 func TestExpiredMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestExpiredMetadata().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
969 // Verifies that expired local timestamp/snapshot can be used for
970 // updating from remote.
971
972 // The updates and verifications are performed with the following timing:
973 // - Timestamp v1 expiry set to day 7
974 // - First updater refresh performed on day 0
975 // - Repository bumps snapshot and targets to v2 on day 0
976 // - Timestamp v2 expiry set to day 21
977 // - Second updater refresh performed on day 18,
978 // it is successful and timestamp/snaphot final versions are v2"
979
980 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
981 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
982
983 now := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().()
984 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Expires. = now.Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 7 * 24)
985
986 // Make a successful update of valid metadata which stores it in cache
987 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
988 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
989 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
990 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
991
992 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTargetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTargets..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version. += 1
993 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..UpdateSnapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#UpdateSnapshot().()
994 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Expiresscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Expires. = now.Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 21 * 24)
995
996 // Mocking time so that local timestam has expired
997 // but the new timestamp has not
998 moveInTime := now.Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour. * 18 * 24)
999 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, moveInTime)
1000 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1001
1002 // Assert that the final version of timestamp/snapshot is version 2
1003 // which means a successful refresh is performed
1004 // with expired local metadata
1005
1006 mdTimestamp, err := metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.Timestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Timestamp().().FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., "timestamp.json"))
1007 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1008 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, int64(2), mdTimestamp.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Version.)
1009
1010 mdSnapshot, err := metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.Snapshotscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Snapshot().().FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., "snapshot.json"))
1011 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1012 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, int64(2), mdSnapshot.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/SnapshotType#Version.)
1013
1014 mdTargets, err := metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.Targetsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Targets().().FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir., "targets.json"))
1015 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1016 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, int64(2), mdTargets.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TargetsType#Version.)
1017 }
1018
1019 func TestMaxMetadataLengthsscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestMaxMetadataLengths().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
1020 // Test that clients configured max metadata lengths are respected
1021
1022 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
1023 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1024
1025 // client has root v1 already: create a new one available for download
1026 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDRoot..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/RootType#Version. += 1
1027 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..PublishRootscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#PublishRoot().()
1028
1029 // make sure going over any length limit raises DownloadLengthMismatchError
1030 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
1031 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1032 updater := initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
1033 updater.cfgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#cfg..RootMaxLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#RootMaxLength. = 100
1034 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
1035 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrDownloadLengthMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#Msg.: "Downloaded 1567 bytes exceeding the maximum allowed length of 100"})
1036
1037 updater = initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
1038 updater.cfgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#cfg..TimestampMaxLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#TimestampMaxLength. = 100
1039 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
1040 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrDownloadLengthMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#Msg.: "Downloaded 1567 bytes exceeding the maximum allowed length of 100"})
1041
1042 updater = initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
1043 updater.cfgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#cfg..SnapshotMaxLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#SnapshotMaxLength. = 100
1044 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
1045 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrDownloadLengthMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#Msg.: "Downloaded 1567 bytes exceeding the maximum allowed length of 100"})
1046
1047 updater = initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
1048 updater.cfgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#cfg..TargetsMaxLengthscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/config`/UpdaterConfig#TargetsMaxLength. = 100
1049 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
1050 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrDownloadLengthMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#Msg.: "Downloaded 1567 bytes exceeding the maximum allowed length of 100"})
1051
1052 // All good with normal length limits
1053 updater = initUpdaterscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/initUpdater().(updaterConfig)
1054 err = updater.Refreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/Updater#Refresh().()
1055 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorIs().(t, err, &metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.ErrDownloadLengthMismatchscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#{Msgscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/ErrDownloadLengthMismatch#Msg.: "Downloaded 1567 bytes exceeding the maximum allowed length of 100"})
1056 }
1057
1058 func TestTimestampEqVersionsCheckscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/TestTimestampEqVersionsCheck().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
1059 // Test that a modified timestamp with different content, but the same
1060 // version doesn't replace the valid locally stored one.
1061
1062 err := loadOrResetTrustedRootMetadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadOrResetTrustedRootMetadata().()
1063 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1064
1065 // Make a successful update of valid metadata which stores it in cache
1066 updaterConfig, err := loadUpdaterConfigscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/loadUpdaterConfig().()
1067 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1068 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
1069 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1070
1071 initialTimestampMetadataVer := simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Metascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Meta.["snapshot.json"].Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/MetaFiles#Version.
1072 // Change timestamp without bumping its version in order to test if a new
1073 // timestamp with the same version will be persisted.
1074 simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.Simscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/Sim..MDTimestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/RepositorySimulator#MDTimestamp..Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Metascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Meta.["snapshot.json"].Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/MetaFiles#Version. = 100
1075 _, err = runRefreshscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata/updater`/runRefresh().(updaterConfig, timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().())
1076 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1077
1078 // If the local timestamp md file has the same snapshot_meta.version as
1079 // the initial one, then the new modified timestamp has not been stored.
1080 timestamp, err := metadatascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/.Timestampscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Timestamp().().FromFilescip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#FromFile().(simulatorscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/.MetadataDirscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator`/MetadataDir. + "/timestamp.json")
1081 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
1082 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, initialTimestampMetadataVer, timestamp.Signedscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/Metadata#Signed..Metascip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/TimestampType#Meta.["snapshot.json"].Versionscip-go gomod github.com/theupdateframework/go-tuf/v2 . `github.com/theupdateframework/go-tuf/v2/metadata`/MetaFiles#Version.)
1083 }