mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-04 13:49:57 -05:00
repos: a clone is owned by a random token, not its URL
The ownership marker held the Repo's URL key, which anyone can write, so a copied clone, an extracted archive or a hand-made `.git` passed the check and was reset and cleaned. Each Repo now has a random clone_token (repository column and repos.yaml, so a Repo restored from the config still owns its clone); the marker holds it, and only a clone holding the Repo's token is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a1d4c42eee
commit
d0ea6ab313
6 changed files with 116 additions and 20 deletions
|
|
@ -16,7 +16,10 @@ async def test_dump_and_import(test_session, test_directory, async_client, test_
|
|||
|
||||
config = lib.get_repos_config()
|
||||
assert config.get_file().is_file()
|
||||
assert config.repos == [
|
||||
# Each Repo's random clone token is kept, so a restored Repo still owns its clone.
|
||||
dumped = [dict(i) for i in config.repos]
|
||||
assert all(len(i.pop('clone_token')) == 32 for i in dumped)
|
||||
assert dumped == [
|
||||
dict(name='b', url='https://github.com/a/b', directory='repos/b', tag_name=None, description=None,
|
||||
mode='snapshot', branch='dev', submodules=False, frequency=DownloadFrequency.weekly),
|
||||
dict(name='kiwix-tools', url='https://github.com/kiwix/kiwix-tools', directory='repos/software/kiwix-tools',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue