restic/internal/restic
Michael Eischer 99e105eeb6 repository: restrict SaveUnpacked and RemoveUnpacked
Those methods now only allow modifying snapshots. Internal data types
used by the repository are now read-only. The repository-internal code
can bypass the restrictions by wrapping the repository in an
`internalRepository` type.

The restriction itself is implemented by using a new datatype
WriteableFileType in the SaveUnpacked and RemoveUnpacked methods. This
statically ensures that code cannot bypass the access restrictions.

The test changes are somewhat noisy as some of them modify repository
internals and therefore require some way to bypass the access
restrictions. This works by capturing an `internalRepository` or
`Backend` when creating the Repository using a test helper function.
2025-01-13 22:39:57 +01:00
..
testdata forget: make oldest snapshot marker more strict 2024-09-07 15:07:23 +05:30
backend_find.go Fix linter errors (except for tests) 2024-02-10 22:58:10 +01:00
backend_find_test.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
blob.go restic: decouple restic.Handle 2023-10-25 22:54:07 +02:00
blob_set.go internal/restic: Return summary from BlobSet.String 2023-08-25 21:41:30 +02:00
blob_set_test.go replace deprecated usages of math/rand 2024-08-10 19:34:49 +02:00
blob_test.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
config.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
config_test.go Use _ as parameter name for unused Context 2023-05-18 21:15:45 +02:00
doc.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
duration.go comment cleanup 2022-08-18 20:15:38 +02:00
duration_test.go forget: Fail test if duration parsing error is missing 2022-08-18 20:14:09 +02:00
find.go add proper constants for node type 2024-08-31 18:20:01 +02:00
find_test.go repository: fix parameter order of LookupBlobSize 2024-05-24 21:33:17 +02:00
id.go Switch back to sha256 from the std library 2024-08-10 19:16:10 +02:00
id_int_test.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
id_test.go internal/restic: Remove unused ID.EqualString 2022-10-14 18:20:11 +02:00
ids.go restic: Clean up restic.IDs type 2022-12-03 12:38:20 +01:00
ids_test.go restic: Clean up restic.IDs type 2022-12-03 12:38:20 +01:00
idset.go internal/restic: Use IDSet.Clone + use maps package 2024-10-03 21:14:29 +02:00
idset_test.go restic: add IDSet.Clone() method 2024-05-24 21:33:17 +02:00
json.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
lister.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
lister_test.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
lock.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
lock_test.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
lock_unix.go lock: Don't copy the lock when checking for process existence 2022-11-11 21:45:55 +01:00
lock_windows.go internal/restic: Fix UID/GID parsing 2022-10-14 18:21:00 +02:00
node.go add proper constants for node type 2024-08-31 18:20:01 +02:00
node_test.go restic: extract Node filesystem code to fs package 2024-08-31 17:37:25 +02:00
node_windows.go fs: move WindowsAttributes definition back to restic package 2024-08-31 18:40:36 +02:00
parallel.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
repository.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
snapshot.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
snapshot_find.go Add more checks for canceled contexts 2024-07-31 19:30:47 +02:00
snapshot_find_test.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
snapshot_group.go forget: refuse deleting the last snapshot in a snapshot group 2024-05-24 20:45:33 +02:00
snapshot_group_test.go Fix typos 2023-12-06 13:11:55 +01:00
snapshot_policy.go forget: make oldest snapshot marker more strict 2024-09-07 15:07:23 +05:30
snapshot_policy_test.go Refactor policy sum calculation & duration parsing 2023-03-14 19:29:08 -07:00
snapshot_test.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
tag_list.go all: Minor cleanups 2022-10-16 10:50:39 +02:00
tag_list_test.go feat(tags): Create Flatten() method 2020-12-29 10:59:46 +01:00
testing.go add proper constants for node type 2024-08-31 18:20:01 +02:00
testing_test.go check: allow tests to only verify pack&index integrity 2024-04-14 13:45:04 +02:00
tree.go restic: add missing space in error message 2024-11-15 17:52:09 +01:00
tree_stream.go repository: fix parameter order of LookupBlobSize 2024-05-24 21:33:17 +02:00
tree_test.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
zeroprefix.go restorer: move zeroPrefixLen to restic package 2022-09-24 21:39:39 +02:00
zeroprefix_test.go restorer: move zeroPrefixLen to restic package 2022-09-24 21:39:39 +02:00