MCPcopy
hub / github.com/borgbackup/borg / assert_no_manifest_replay

Method assert_no_manifest_replay

src/borg/cache.py:169–186  ·  view source on GitHub ↗
(self, manifest, key)

Source from the content-addressed store, hash-verified

167 fd.write(repository_location)
168
169 def assert_no_manifest_replay(self, manifest, key):
170 try:
171 with self.manifest_ts_file.open() as fd:
172 timestamp = fd.read()
173 logger.debug("security: read manifest timestamp %r", timestamp)
174 except FileNotFoundError:
175 logger.debug("security: manifest timestamp file %s not found", self.manifest_ts_file)
176 timestamp = ""
177 except OSError as exc:
178 logger.warning("Could not read previous location file: %s", exc)
179 timestamp = ""
180 logger.debug("security: determined newest manifest timestamp as %s", timestamp)
181 # If repository is older than the cache or security dir something fishy is going on
182 if timestamp and timestamp > manifest.timestamp:
183 if isinstance(key, PlaintextKey):
184 raise Cache.RepositoryIDNotUnique()
185 else:
186 raise Cache.RepositoryReplay()
187
188 def assert_key_type(self, key):
189 # Make sure an encrypted repository has not been swapped for an unencrypted repository

Callers 1

_assert_secureMethod · 0.95

Calls 4

debugMethod · 0.80
warningMethod · 0.80
openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected