primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,70 @@
# PHP-TUF dependency information
## Production PHP dependencies
### Paragon IE sodium_compat
- **Repository:** https://github.com/paragonie/sodium_compat
- **Release cycle:** No formal policy documented. Follows semver. Old major
and minor versions appear to receive support after new versions are released.
- **Security policies:**
[Paragon security
policy](https://github.com/paragonie/random_compat/security/policy)
*(NB: **Full disclosure**)*
- **Security issue reporting:** `scott@paragonie.com`
- **Contacts:** ?
- **Additional dependencies:** [random_compat](https://github.com/paragonie/random_compat)
(Same policies.)
### Guzzle PHP HTTP client
- **Repository:** https://github.com/guzzle/guzzle
- **Release cycle:** https://github.com/guzzle/guzzle/releases
- **Security policies:** https://github.com/guzzle/guzzle/security/policy
- **Security issue reporting:** security@guzzlephp.org
- **Contacts:** N/A
- **Additional dependencies:** Guzzle dependencies include php, ext-json, psr/http-client. It has additional dev dependencies.
### Symfony Validator
- **Repository:** https://github.com/symfony/validator
- **Release cycle:** https://github.com/symfony/validator/releases
- **Security policies:** https://github.com/symfony/validator/security/policy
- **Security issue reporting:** security@symfony.com
- **Contacts:** N/A
- **Additional dependencies:** The majority of dependencies are other Symfony packages. Dev dependencies include doctrine/annotations, doctrine/cache, and egulias/email-validator.
### DeepCopy
- **Repository:** https://github.com/myclabs/DeepCopy
- **Release cycle:** https://github.com/myclabs/DeepCopy/releases
- **Security policies:** There's no security policy on the Git repo.
- **Security issue reporting:** ?
- **Contacts:** N/A
- **Additional dependencies:** Only php. There are additional dev dependencies.
## Development PHP dependencies
### PHPUnit
- **Repository:** https://github.com/sebastianbergmann/phpunit
- **Release cycle:** [Supported versions of
PHPUnit](https://phpunit.de/supported-versions.html)
- **Security policies:** PHPUnit maintainers consider the package a
development tool that should not be used in production; therefore, they do
not have a security release process.
- **Security issue reporting:** N/A
- **Contacts:** N/A
- **Additional dependencies:** PHPUnit adds numerous additional dependencies
to dev builds. The majority are other packages maintained by PHPUnit or its
author.
### Symfony PHPUnit Bridge
- **Repository:** https://github.com/symfony/phpunit-bridge
- **Release cycle:** [Symfony releases](https://symfony.com/releases)
(Scheduled releases, continuous upgrade path, overlapping major and minor
support, and long-term support versions.)
- **Security policies:** [Symfony security
policy](https://symfony.com/doc/master/contributing/code/security.html)
- **Security issue reporting:** `security [at] symfony.com`
- **Contacts:** fabpot, michaelcullum
- **Additional dependencies:** None
## Development Python dependencies
@todo Document dependencies here. https://github.com/php-tuf/php-tuf/issues/159

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 PHP-TUF
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,28 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
certifi = "==2022.12.7"
cffi = "==1.15.1"
chardet = "==5.1.0"
colorama = "==0.4.6"
cryptography = "==39.0.1"
idna = "==3.4"
iso8601 = "==1.1.0"
pycparser = "==2.21"
python-dateutil = "==2.8.2"
requests = "==2.28.1"
securesystemslib = "==0.25.0"
six = "==1.16.0"
tuf = "==0.19.0"
urllib3 = "==1.26.13"
PyNaCl = "==1.5.0"
flake8 = "*"
dirhash = "*"
[requires]
python_version = "3.9"

300
libraries/vendor/php-tuf/php-tuf/Pipfile.lock generated vendored Normal file
View File

@ -0,0 +1,300 @@
{
"_meta": {
"hash": {
"sha256": "ec8d4d48f44c10edfc737b53d0ec5a9bf1d28a22e2b08bb398c4fbbd0edca5a0"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.9"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"attrs": {
"hashes": [
"sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836",
"sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"
],
"markers": "python_version >= '3.6'",
"version": "==22.2.0"
},
"certifi": {
"hashes": [
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
"sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"
],
"index": "pypi",
"version": "==2022.12.7"
},
"cffi": {
"hashes": [
"sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5",
"sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef",
"sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104",
"sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426",
"sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405",
"sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375",
"sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a",
"sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e",
"sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc",
"sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf",
"sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185",
"sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497",
"sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3",
"sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35",
"sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c",
"sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83",
"sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21",
"sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca",
"sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984",
"sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac",
"sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd",
"sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee",
"sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a",
"sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2",
"sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192",
"sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7",
"sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585",
"sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f",
"sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e",
"sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27",
"sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b",
"sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e",
"sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e",
"sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d",
"sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c",
"sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415",
"sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82",
"sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02",
"sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314",
"sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325",
"sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c",
"sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3",
"sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914",
"sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045",
"sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d",
"sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9",
"sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5",
"sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2",
"sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c",
"sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3",
"sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2",
"sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8",
"sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d",
"sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d",
"sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9",
"sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162",
"sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76",
"sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4",
"sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e",
"sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9",
"sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6",
"sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b",
"sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01",
"sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0"
],
"index": "pypi",
"version": "==1.15.1"
},
"chardet": {
"hashes": [
"sha256:0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5",
"sha256:362777fb014af596ad31334fde1e8c327dfdb076e1960d1694662d46a6917ab9"
],
"index": "pypi",
"version": "==5.1.0"
},
"charset-normalizer": {
"hashes": [
"sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
"sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
],
"markers": "python_version >= '3.6'",
"version": "==2.1.1"
},
"colorama": {
"hashes": [
"sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44",
"sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"
],
"index": "pypi",
"version": "==0.4.6"
},
"cryptography": {
"hashes": [
"sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4",
"sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f",
"sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502",
"sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41",
"sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965",
"sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e",
"sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc",
"sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad",
"sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505",
"sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388",
"sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6",
"sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2",
"sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac",
"sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695",
"sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6",
"sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336",
"sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0",
"sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c",
"sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106",
"sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a",
"sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8"
],
"index": "pypi",
"version": "==39.0.1"
},
"dirhash": {
"hashes": [
"sha256:31bf8192fbb6e09a2a7ff4de31b9eb127c58545af22125ca1fa67c91c8e2d898",
"sha256:b77ef0407e9fdb4fe63631601cb6732183131c5e5d805942c37ae19455b9d25c"
],
"index": "pypi",
"version": "==0.2.1"
},
"flake8": {
"hashes": [
"sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7",
"sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181"
],
"index": "pypi",
"version": "==6.0.0"
},
"idna": {
"hashes": [
"sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4",
"sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"
],
"index": "pypi",
"version": "==3.4"
},
"iso8601": {
"hashes": [
"sha256:32811e7b81deee2063ea6d2e94f8819a86d1f3811e49d23623a41fa832bef03f",
"sha256:8400e90141bf792bce2634df533dc57e3bee19ea120a87bebcd3da89a58ad73f"
],
"index": "pypi",
"version": "==1.1.0"
},
"mccabe": {
"hashes": [
"sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325",
"sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"
],
"markers": "python_version >= '3.6'",
"version": "==0.7.0"
},
"pathspec": {
"hashes": [
"sha256:3a66eb970cbac598f9e5ccb5b2cf58930cd8e3ed86d393d541eaf2d8b1705229",
"sha256:64d338d4e0914e91c1792321e6907b5a593f1ab1851de7fc269557a21b30ebbc"
],
"markers": "python_version >= '3.7'",
"version": "==0.11.0"
},
"pycodestyle": {
"hashes": [
"sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053",
"sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"
],
"markers": "python_version >= '3.6'",
"version": "==2.10.0"
},
"pycparser": {
"hashes": [
"sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9",
"sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"
],
"index": "pypi",
"version": "==2.21"
},
"pyflakes": {
"hashes": [
"sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf",
"sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd"
],
"markers": "python_version >= '3.6'",
"version": "==3.0.1"
},
"pynacl": {
"hashes": [
"sha256:06b8f6fa7f5de8d5d2f7573fe8c863c051225a27b61e6860fd047b1775807858",
"sha256:0c84947a22519e013607c9be43706dd42513f9e6ae5d39d3613ca1e142fba44d",
"sha256:20f42270d27e1b6a29f54032090b972d97f0a1b0948cc52392041ef7831fee93",
"sha256:401002a4aaa07c9414132aaed7f6836ff98f59277a234704ff66878c2ee4a0d1",
"sha256:52cb72a79269189d4e0dc537556f4740f7f0a9ec41c1322598799b0bdad4ef92",
"sha256:61f642bf2378713e2c2e1de73444a3778e5f0a38be6fee0fe532fe30060282ff",
"sha256:8ac7448f09ab85811607bdd21ec2464495ac8b7c66d146bf545b0f08fb9220ba",
"sha256:a36d4a9dda1f19ce6e03c9a784a2921a4b726b02e1c736600ca9c22029474394",
"sha256:a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b",
"sha256:e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543"
],
"index": "pypi",
"version": "==1.5.0"
},
"python-dateutil": {
"hashes": [
"sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86",
"sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"
],
"index": "pypi",
"version": "==2.8.2"
},
"requests": {
"hashes": [
"sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
"sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
],
"index": "pypi",
"version": "==2.28.1"
},
"scantree": {
"hashes": [
"sha256:2a8b163de0e4b2f9e4f37f8caf3f0b265172bbf174111e1bebc7955581895b39"
],
"version": "==0.0.1"
},
"securesystemslib": {
"hashes": [
"sha256:04bc11593edd68405939d3dfc318080bfb31f1ebb5d81c7911914b42dfd4bf2f",
"sha256:10d5a066e70cb87704c9bf2cef1ef6d8a06fab5ef7602dd59c26d06251317a11"
],
"index": "pypi",
"version": "==0.25.0"
},
"six": {
"hashes": [
"sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
"sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
],
"index": "pypi",
"version": "==1.16.0"
},
"tuf": {
"hashes": [
"sha256:3c436468fb5f211411fdd2f3dbcf33fa7a3025c0d00cbe671014f0d010883345",
"sha256:c6facc75af3e315c901af03654eea6b5fc2ad0efc47b3290cc564b20c69449f5"
],
"index": "pypi",
"version": "==0.19.0"
},
"urllib3": {
"hashes": [
"sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc",
"sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"
],
"index": "pypi",
"version": "==1.26.13"
}
},
"develop": {}
}

View File

@ -0,0 +1,22 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
import shutil
def build():
builder = ConsistencyVariantFixtureBuilder('AttackRollback')\
.create_target('testtarget.txt')\
.publish(with_client=True)
for fixture in builder.fixtures:
server_dir = fixture._server_dir
backup_dir = server_dir + '_backup'
shutil.copytree(server_dir, backup_dir, dirs_exist_ok=True)
fixture.create_target('testtarget2.txt')\
.publish(with_client=True)
shutil.rmtree(server_dir + '/')
# Reset the client to previous state to simulate a rollback attack.
shutil.copytree(backup_dir, server_dir, dirs_exist_ok=True)
shutil.rmtree(backup_dir + '/')

View File

@ -0,0 +1,4 @@
root = 2
timestamp = 2
snapshot = 2
targets = 2

View File

@ -0,0 +1 @@
eaf33481bd1805f6eade8d8741450e68d766b5403b486c70872492a711f354b0

View File

@ -0,0 +1,4 @@
root = 2
timestamp = 2
snapshot = 2
targets = 2

View File

@ -0,0 +1 @@
5153690437cea16079390e524e35970eacc16ff2f88f7fc7f04407b2b825f7f6

View File

@ -0,0 +1,21 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
fixture = ConsistencyVariantFixtureBuilder('Delegated', { 'use_timestamp_length': False })\
.create_target('testtarget.txt')\
.publish(with_client=True)\
.delegate('unclaimed', ['level_1_*.txt'])\
.create_target('level_1_target.txt', signing_role='unclaimed')\
.publish(with_client=True)
# === Point of No Return ===
# Past this point, we don't re-export the client. This supports testing the
# client's own ability to pick up and trust new data from the repository.
fixture.add_key('targets')\
.add_key('snapshot')\
.invalidate()\
.publish()\
.revoke_key('targets')\
.revoke_key('snapshot')\
.invalidate()\
.publish()

View File

@ -0,0 +1,5 @@
root = 2
timestamp = 2
snapshot = 2
targets = 2
unclaimed = 1

View File

@ -0,0 +1 @@
ca9b890f808a19ba88805f71a52330e15938ca7001a9c93193d2ae71fa917542

View File

@ -0,0 +1,5 @@
root = 1
timestamp = 2
snapshot = 2
targets = 2
unclaimed = 1

View File

@ -0,0 +1 @@
36b1d01fe8019bdb8302f46966f838cc38b4b020cd7f0e5b5d0df67685433395

View File

@ -0,0 +1,44 @@
# This fixture creates targets named a.txt through z.txt, and
# distributes them across 8 hashed bin delegations. This uses
# the "classic" (i.e., not succinct) form of hashed bins.
import string
from fixtures.builder import FixtureBuilder
from tuf import roledb
def build():
builder = FixtureBuilder('HashedBins', { 'use_snapshot_length': True })\
.publish(with_client=True)
list_of_targets = []
for c in list(string.ascii_lowercase):
name = c + '.txt'
builder.create_target(name, signing_role=None)
list_of_targets.append(name)
# We need at least one key that will sign the targets in the hashed bins.
public_key, private_key = builder._import_key()
# Create the hashed bins.
builder.repository.targets.delegate_hashed_bins(list_of_targets, [public_key], 8)
# Assign the targets we've created to those hashed bins. TUF determines which
# target goes in which bin.
for name in list_of_targets:
builder.repository.targets.add_target_to_bin(name, 8)
# Ensure the delegated roles that manage the hashed bins can actually be signed.
# It's weird, but for some reason this is not done by delegate_hashed_bins().
for role in builder.repository.targets.get_delegated_rolenames():
builder.repository.targets(role).load_signing_key(private_key)
# Make all the delegated roles terminating.
targets_role_info = roledb.get_roleinfo('targets', 'HashedBins')
for i in range(len(targets_role_info['delegations']['roles'])):
targets_role_info['delegations']['roles'][i]['terminating'] = True
roledb.update_roleinfo('targets', targets_role_info, repository_name='HashedBins')
# Publish these changes on the server side.
builder.invalidate()
builder.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
1a7e21755d8807517bd367ae8655fb013d1d529c8e5265f67e630b1a368bbb79

View File

@ -0,0 +1,47 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
fixture = ConsistencyVariantFixtureBuilder('NestedDelegated')\
.create_target('testtarget.txt')\
.publish(with_client=True)\
.delegate('unclaimed', ['level_1_*.txt'])\
.create_target('level_1_target.txt', signing_role='unclaimed')\
.publish(with_client=True)
# === Point of No Return ===
# Past this point, we don't re-export the client. This supports testing the
# client's own ability to pick up and trust new data from the repository.
fixture.add_key('targets')\
.add_key('snapshot')\
.invalidate()\
.publish()\
.revoke_key('targets')\
.revoke_key('snapshot')\
.invalidate()\
.publish()
# Delegate from level_1_delegation to level_2
fixture.delegate('level_2', ['level_1_2_*.txt'], parent='unclaimed')\
.create_target('level_1_2_target.txt', signing_role='level_2')
# Create a terminating delegation
fixture.delegate('level_2_terminating', ['level_1_2_terminating_*.txt'], parent='unclaimed', terminating=True)\
.create_target('level_1_2_terminating_findable.txt', signing_role='level_2_terminating')
# Create a delegation under non-terminating 'level_2' delegation.
fixture.delegate('level_3', ['level_1_2_3_*.txt'], parent='level_2')\
.create_target('level_1_2_3_below_non_terminating_target.txt', signing_role='level_3')
# Add a delegation below the 'level_2_terminating' role.
# Delegations from a terminating role are evaluated but delegations after a terminating delegation
# are not.
# See NestedDelegatedErrors
fixture.delegate('level_3_below_terminated', ['level_1_2_terminating_3_*.txt'], parent='level_2_terminating')\
.create_target('level_1_2_terminating_3_target.txt', signing_role='level_3_below_terminated')
# Add a delegation after level_2_terminating, but the path does not match level_2_terminating,
# which WILL be evaluated.
fixture.delegate('level_2_after_terminating_not_match_terminating_path', ['level_1_2a_terminating_plus_1_more_*.txt'], parent='unclaimed')\
.create_target('level_1_2a_terminating_plus_1_more_findable.txt', signing_role='level_2_after_terminating_not_match_terminating_path')
fixture.publish()

View File

@ -0,0 +1,7 @@
root = 2
timestamp = 2
snapshot = 2
targets = 2
unclaimed = 1
level_2 = null
level_3 = null

View File

@ -0,0 +1 @@
8d6c7e7ff65ebef095af44116a2b257636a1af0fdcd84880c67d39d15bca6a67

View File

@ -0,0 +1,5 @@
root = 1
timestamp = 2
snapshot = 2
targets = 2
unclaimed = 1

View File

@ -0,0 +1 @@
a20007c313455750977f5b763f29e12d9fea9d98bc9e09625436838a7064a66a

View File

@ -0,0 +1,54 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
fixture = ConsistencyVariantFixtureBuilder('NestedDelegatedErrors')\
.create_target('testtarget.txt')\
.publish(with_client=True)\
.delegate('unclaimed', ['level_1_*.txt'])\
.create_target('level_1_target.txt', signing_role='unclaimed')\
.publish(with_client=True)
# === Point of No Return ===
# Past this point, we don't re-export the client. This supports testing the
# client's own ability to pick up and trust new data from the repository.
fixture.add_key('targets')\
.add_key('snapshot')\
.invalidate()\
.publish()\
.revoke_key('targets')\
.revoke_key('snapshot')\
.invalidate()\
.publish()
# Delegate from level_1_delegation to level_2
fixture.delegate('level_2', ['level_1_2_*.txt'], parent='unclaimed')\
.create_target('level_1_2_target.txt', signing_role='level_2')
# Create a terminating delegation
fixture.delegate('level_2_terminating', ['level_1_2_terminating_*.txt'], parent='unclaimed', terminating=True)\
.create_target('level_1_2_terminating_findable.txt', signing_role='level_2_terminating')
# Create a delegation under non-terminating 'level_2' delegation.
fixture.delegate('level_3', ['level_1_2_3_*.txt'], parent='level_2')\
.create_target('level_1_2_3_below_non_terminating_target.txt', signing_role='level_3')
# Add a delegation below the 'level_2_terminating' role.
# Delegations from a terminating role are evaluated but delegations after a terminating delegation
# are not.
# See NestedDelegatedErrors
fixture.delegate('level_3_below_terminated', ['level_1_2_terminating_3_*.txt'], parent='level_2_terminating')\
.create_target('level_1_2_terminating_3_target.txt', signing_role='level_3_below_terminated')
fixture.publish()
# Add a target that does not match the path for the delegation.
fixture.create_target('level_a.txt', signing_role='unclaimed')
# Add a target that matches the path parent delegation but not the current delegation.
fixture.create_target('level_1_3_target.txt', signing_role='level_2')
# Add a target that does not match the delegation's paths.
fixture.create_target('level_2_unfindable.txt', signing_role='level_2_terminating')
# Add a delegation after level_2_terminating which will not be evaluated.
fixture.delegate('level_2_after_terminating_match_terminating_path', ['level_1_2_terminating_plus_1_more_*.txt'], parent='unclaimed')\
.create_target('level_1_2_terminating_plus_1_more_unfindable.txt', signing_role='level_2_after_terminating_match_terminating_path')\
.publish()

View File

@ -0,0 +1,5 @@
root = 2
timestamp = 2
snapshot = 2
targets = 2
unclaimed = 1

View File

@ -0,0 +1 @@
b43062caaee432f84d4568c75683f812143ebe27fb6c2f9c289d6dc7cbe5dbe1

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 2
snapshot = 2
targets = 2

View File

@ -0,0 +1 @@
e188106dea1b82ac02c41e0e9ca4a311ae6e522806ff1cc7bb9a0219e3b2ea21

View File

@ -0,0 +1,30 @@
# Delegation tree
#
# Targets
# / \
# a d
# / \
# b c
#
# b is the only terminating delegation
#
# Roles should be evaluated in the order:
# Targets > a > b
#
# Roles c and d should not be evaluated.
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
ConsistencyVariantFixtureBuilder('NestedTerminatingNonDelegatingDelegation')\
.publish(with_client=True)\
.create_target('targets.txt')\
.delegate('a', ['*.txt'])\
.create_target('a.txt', signing_role='a')\
.delegate('b', ['*.txt'], parent='a', terminating=True) \
.create_target('b.txt', signing_role='b') \
.delegate('c', ['*.txt'], parent='a') \
.create_target('c.txt', signing_role='c') \
.delegate('d', ['*.txt']) \
.create_target('d.txt', signing_role='d') \
.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
8db732a666742d0958cf0d71483fd6d2acac69f07d1c8c58c5132986809a9962

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
c44a38a43088922b9c119b1c45c2fa6138d6de7a76b093c3eacbdd33d1b99da8

View File

@ -0,0 +1,21 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build(rotate_keys=None):
"""
Generates a TUF test fixture that publishes twice -- once on the client,
and twice on the server -- and, in between those two publications, can
optionally rotate the keys of a given role.
"""
name = 'PublishedTwice'
if rotate_keys is not None:
name += 'WithRotatedKeys_' + rotate_keys
fixture = ConsistencyVariantFixtureBuilder(name, { 'use_snapshot_hashes': True, 'use_snapshot_length': True, 'use_timestamp_hashes': True, 'use_timestamp_length': True })\
.publish(with_client=True)
fixture.create_target('test.txt')
if rotate_keys is not None:
fixture.add_key(rotate_keys)\
.revoke_key(rotate_keys, key_index=0)
fixture.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
8eb39b3f52950fd6fa3a15ed6ac368cbd6693eaa4a048323023945cf77c3ff0b

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
57de938403bda4b554d60ffd807bfbd31fd1f439f20aad045f56d97f8d54d7c9

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
ea8f976e80de787f3befcb10f1c8dc44bfb3d7b6f5ce580c801f5ca3fc48ae5d

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
0347255ba2d4d46982e4873308d17091f4c26563eed8aed5658b8443f2c0db92

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
b87efbdf4b37845e5a543f9b7af4070268fde99e5b3ab7bb04c396e4844ec4e7

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
32c57510ceb54c809e31595c3c814a8e622886ee241c7ca9fb82799ac23bcc4d

View File

@ -0,0 +1,7 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
ConsistencyVariantFixtureBuilder('Simple', { 'use_snapshot_hashes': True })\
.create_target('testtarget.txt')\
.publish(with_client=True)

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
c3fe00348987f44abed6da709b79fad573d6599e06305d58f1f0abed613679f6

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
8eb970962c9df384f60f8c118511e4600f73404bb8b268e8449d2a785b9c590f

View File

@ -0,0 +1,12 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
"""
Generates a TUF test fixture that publishes twice -- once on the client,
and twice on the server -- with targets length information, but no
snapshot length information.
"""
ConsistencyVariantFixtureBuilder('TargetsLengthNoSnapshotLength', { 'use_timestamp_length': False, 'use_snapshot_length': True })\
.publish(with_client=True)\
.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
3fc4f767c946a44b68af07913a3b97392da051245620da5aa027d6fa73e79f1e

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
06b7e9237763c3337c9d238345573ed8bb8f7d12301e54389255b66ffb2392ae

View File

@ -0,0 +1,36 @@
# Delegation tree
#
# Targets
# / \
# a f
# / \
# b e
# / \
# c d
#
# b is the only terminating delegation
#
# Roles should be evaluated in the order:
# Targets > a > b > c > d
#
# Roles e and d should not be evaluated.
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
ConsistencyVariantFixtureBuilder('TerminatingDelegation')\
.publish(with_client=True)\
.create_target('targets.txt')\
.delegate('a', ['*.txt'])\
.create_target('a.txt', signing_role='a')\
.delegate('b', ['*.txt'], parent='a', terminating=True) \
.create_target('b.txt', signing_role='b') \
.delegate('c', ['*.txt'], parent='b') \
.create_target('c.txt', signing_role='c') \
.delegate('d', ['*.txt'], parent='b') \
.create_target('d.txt', signing_role='d') \
.delegate('e', ['*.txt'], parent='a') \
.create_target('e.txt', signing_role='e') \
.delegate('f', ['*.txt']) \
.create_target('f.txt', signing_role='f') \
.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
22a6b8614fb2b4dc41ed5eabb01153611593b4352c001a7c2cf155caf2eb1886

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
9bf78636e3a861e00dd31fab2e638eea03ee027962900b5e601a6655fcee8b12

View File

@ -0,0 +1,35 @@
# Delegation tree
#
# Targets
# / \
# a f
# / \
# b e
# / \
# c d
#
# No terminating delegations.
#
# Roles should be evaluated in the order:
# Targets > a > b > c > d > e > f
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
ConsistencyVariantFixtureBuilder('ThreeLevelDelegation')\
.publish(with_client=True)\
.create_target('targets.txt')\
.delegate('a', ['*.txt'])\
.create_target('a.txt', signing_role='a')\
.delegate('b', ['*.txt'], parent='a') \
.create_target('b.txt', signing_role='b') \
.delegate('c', ['*.txt'], parent='b') \
.create_target('c.txt', signing_role='c') \
.delegate('d', ['*.txt'], parent='b') \
.create_target('d.txt', signing_role='d') \
.delegate('e', ['*.txt'], parent='a') \
.create_target('e.txt', signing_role='e') \
.delegate('f', ['*.txt']) \
.create_target('f.txt', signing_role='f') \
.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
f88c6b154505dbc1601855b8b0d92e164b1d8ab7175f16b65cde0d1e1547b805

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
262f72305874801378f63ae09f75f9ee506516b6b9a531165f531c37d5d25991

View File

@ -0,0 +1,10 @@
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
builder = ConsistencyVariantFixtureBuilder('ThresholdTwo')\
.add_key('timestamp')
for fixture in builder.fixtures:
fixture._role('timestamp').threshold = 2
fixture.repository.mark_dirty(['timestamp'])
builder.publish(with_client=True)

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
4778d5e66b3cde5069392fc369ee237d34c0d98a95d5f1e4988931bf81969efc

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
146aa22f094090d8dba0ae24fc2a76eef4eea7429a8b6ee6cac943a8279a899e

View File

@ -0,0 +1,45 @@
from fixtures.builder import FixtureBuilder
import os
def build():
_build(True)
_build(False)
def _build(consistent):
if consistent is True:
suffix = 'consistent'
else:
suffix = 'inconsistent'
name = os.path.join('ThresholdTwoAttack', suffix)
fixture = FixtureBuilder(name)\
.add_key('timestamp')
fixture._role('timestamp').threshold = 2
fixture.repository.mark_dirty(['timestamp'])
fixture.publish(with_client=True, consistent=consistent)
fixture.repository.mark_dirty(['timestamp'])
fixture.publish(with_client=True, consistent=consistent)
# By exporting the repo but not the client, this gives us a new revision
# that's ready to alter. If we alter a version the client is already
# aware of, it may not pick up this new, altered version.
fixture.repository.mark_dirty(['timestamp'])
fixture.publish(consistent=consistent)
fixture.add_key('timestamp')
timestamp = fixture.read('timestamp.json')
timestamp["signatures"][1] = {
'keyid': fixture._keys['timestamp']['public'][2]['keyid'],
# This is the SHA-512 hash of the sentence "This is just a random string".
'sig': 'd1f9ee4f5861ad7b8be61c0c00f3cd4353cee60e70db7d6fbeab81b75e6a5e3871276239caf93d09e9cd406ba764c31abe00e95f2553a3cb543874cb6e7d1545'
}
fixture.write('timestamp.json', timestamp)
# We could also alter the versioned (N.timestamp.json), but the spec
# considers these as optional, so we can expect this alteration to be
# sufficient.

View File

@ -0,0 +1 @@
ab3a72734f9e0e4dba4c77d0fce617e30a5e6e4babf5061c2ecb5150ff37b24c

View File

@ -0,0 +1 @@
681f46921f5862ae422af94cda5faaf4f331200f767ef42d2d41faa503adbc33

View File

@ -0,0 +1,24 @@
# Delegation tree
#
# Targets
# / \
# a b
#
# a is the only terminating delegation
#
# Roles should be evaluated in the order:
# Targets > a
#
# Role b should not be evaluated.
from fixtures.builder import ConsistencyVariantFixtureBuilder
def build():
ConsistencyVariantFixtureBuilder('TopLevelTerminating')\
.publish(with_client=True)\
.create_target('targets.txt')\
.delegate('a', ['*.txt'], terminating=True)\
.create_target('a.txt', signing_role='a')\
.delegate('b', ['*.txt'])\
.create_target('b.txt', signing_role='b')\
.publish()

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
d9d6f4ed9294a9a5b00c6916f7d66b85f49e8d5ce60d6ac25fa71e7552dafec8

View File

@ -0,0 +1,4 @@
root = 1
timestamp = 1
snapshot = 1
targets = 1

View File

@ -0,0 +1 @@
1a5e6842eaa266c22eff7aa8afc3bffebf5e6f7e55e3c8b02deee951e874798d

View File

@ -0,0 +1,253 @@
"""
Contains a class to help build fixtures programmatically.
"""
from securesystemslib import formats, signer
from tuf import repository_tool, roledb
import json
import os
import shutil
from dirhash import dirhash
class FixtureBuilder:
def __init__(self, name, tuf_arguments={ 'use_snapshot_length': False }):
self.dir = os.path.join(os.path.dirname(__file__), name)
# The index of the next key pair (in the keys/ directory) to use when initializing
# a role.
self._key_index = 0
# The keychain, containing all public and private keys. The dictionary
# keys are role names, and each item is a dictionary with 'public' and
# 'private' members, which are lists of public and private keys.
self._keys = {}
# The directory of server-side metadata (and targets).
self._server_dir = os.path.join(self.dir, 'server')
# If a directory of server-side metadata already exists, remove it.
if os.path.isdir(self._server_dir):
shutil.rmtree(self._server_dir)
self.repository = repository_tool.create_new_repository(self._server_dir, name, **tuf_arguments)
self.repository.status()
# Initialize the basic TUF roles.
self.add_key('root')
self.add_key('targets')
self.add_key('snapshot')
self.add_key('timestamp')
self.repository.status()
def __del__(self):
# Create a hash for the generated fixture.
with open(self.dir + "/hash.txt", "w") as hash_file:
hash_file.write(dirhash(self.dir, 'sha256', ignore=["__init__.py", "client_versions.ini", "hash.txt"]))
def _role(self, name):
"""Loads a role object for a specific role."""
try:
return getattr(self.repository, name)
except AttributeError:
return self.repository.targets(name)
def delegate(self, role_name, paths, parent='targets', path_hash_prefixes=None, terminating=False):
"""Creates a delegated role."""
self._role(parent).delegate(role_name, [], paths, path_hash_prefixes=path_hash_prefixes, terminating=terminating)
self.add_key(role_name)
return self
def add_key(self, role_name):
"""Loads a key pair from disk and assigns it to a given role."""
(public_key, private_key) = self._import_key()
role = self._role(role_name)
role.add_verification_key(public_key)
role.load_signing_key(private_key)
if role_name not in self._keys:
self._keys[role_name] = {'public': [], 'private': []}
self._keys[role_name]['public'].append(public_key)
self._keys[role_name]['private'].append(private_key)
self._mark_dirty(role_name)
return self
def revoke_key(self, role_name, key_index=0):
"""Revokes a key pair from a given role."""
public_key = self._keys[role_name]['public'].pop(key_index)
self._role(role_name).remove_verification_key(public_key)
self._keys[role_name]['private'].pop(key_index)
self._mark_dirty(role_name)
return self
def _mark_dirty(self, role_name):
"""Marks a role as dirty, along with its parent role."""
self.repository.mark_dirty([role_name])
if role_name in roledb.TOP_LEVEL_ROLES:
self.repository.mark_dirty(['root'])
else:
self.repository.mark_dirty(['targets'])
def _import_key(self):
"""Loads a key pair from the keys/ directory."""
keys_dir = os.path.join(os.path.dirname(__file__), 'keys')
private_key = os.path.join(keys_dir, str(self._key_index)) + '_key'
public_key = '{}.pub'.format(private_key)
self._key_index = self._key_index + 1
return (
repository_tool.import_ed25519_publickey_from_file(public_key),
repository_tool.import_ed25519_privatekey_from_file(private_key, password='pw')
)
def invalidate(self):
"""Marks the four top-level TUF roles as dirty."""
self.repository.mark_dirty(roledb.TOP_LEVEL_ROLES)
return self
def add_target(self, filename, signing_role='targets'):
"""Adds an existing target file and signs it."""
# @todo Just use add_target or add_targets consistently. This is only
# here while fixtures are being ported to FixtureBuilder, to maintain
# consistency with previously generated fixtures.
if signing_role == 'targets':
self._role('targets').add_targets([filename])
else:
self._role(signing_role).add_target(filename)
self.repository.mark_dirty(['snapshot', 'targets', 'timestamp', signing_role])
return self
def create_target(self, filename, contents=None, signing_role='targets'):
"""Creates a signed target file with arbitrary contents."""
if contents is None:
contents = 'Contents: ' + filename
path = os.path.join(self._server_dir, 'targets', filename)
with open(path, 'w') as f:
f.write(contents)
if signing_role is not None:
self.add_target(filename, signing_role)
return self
def publish(self, with_client=False, consistent=True):
"""Writes the TUF metadata to disk."""
self.repository.writeall(consistent_snapshot=consistent)
staging_dir = os.path.join(self._server_dir, 'metadata.staged')
live_dir = os.path.join(self._server_dir, 'metadata')
shutil.copytree(staging_dir, live_dir, dirs_exist_ok=True)
if with_client:
client_dir = os.path.join(self.dir, 'client')
# If a directory of client-side metadata already exists, remove it.
if os.path.isdir(client_dir):
shutil.rmtree(client_dir)
repository_tool.create_tuf_client_directory(self._server_dir, client_dir)
return self
def read(self, filename):
"""Returns the parsed contents of an existing metadata file."""
path = os.path.join(self._server_dir, 'metadata', filename)
with open(path, 'r') as f:
return json.load(f)
def write(self, filename, data):
path = os.path.join(self._server_dir, 'metadata', filename)
with open(path, 'w') as f:
json.dump(data, f, indent=1, separators=(',', ': '), sort_keys=True)
def write_signed(self, filename, data, signing_role):
"""Writes arbitrary metadata, signed with a given role's keys, to a file."""
self.write(filename, {
'signatures': self._sign(data, signing_role),
'signed': data
})
def _sign(self, data, signing_role):
"""Signs arbitrary data using a given role's keys."""
signatures = []
# Encode the data to canonical JSON, which is what we will actually sign.
data = str.encode(formats.encode_canonical(data))
# Loop through the signing role's private keys and use each one to sign
# the canonical JSON representation of the data.
for key in self._keys[signing_role]['private']:
signature = signer.SSlibSigner(key).sign(data)
signatures.append(signature.to_dict())
return signatures
class ConsistencyVariantFixtureBuilder:
def __init__(self, name, tuf_arguments={ 'use_snapshot_length': False }):
self.fixtures = [
FixtureBuilder(os.path.join(name, 'consistent'), tuf_arguments),
FixtureBuilder(os.path.join(name, 'inconsistent'), tuf_arguments)
]
def delegate(self, role_name, paths, parent='targets', path_hash_prefixes=None, terminating=False):
for fixture in self.fixtures:
fixture.delegate(role_name, paths, parent, path_hash_prefixes, terminating)
return self
def add_key(self, role_name):
for fixture in self.fixtures:
fixture.add_key(role_name)
return self
def revoke_key(self, role_name, key_index=0):
for fixture in self.fixtures:
fixture.revoke_key(role_name, key_index)
return self
def invalidate(self):
for fixture in self.fixtures:
fixture.invalidate()
return self
def add_target(self, filename, signing_role='targets'):
for fixture in self.fixtures:
fixture.add_target(filename, signing_role)
return self
def create_target(self, filename, contents=None, signing_role='targets'):
for fixture in self.fixtures:
fixture.create_target(filename, contents, signing_role)
return self
def publish(self, with_client=False):
self.fixtures[0].publish(with_client, consistent=True)
self.fixtures[1].publish(with_client, consistent=False)
return self
def read(self, filename):
return [
self.fixtures[0].read(filename),
self.fixtures[1].read(filename)
]
def write(self, filename, data):
for fixture in self.fixtures:
fixture.write(filename, data)
def write_signed(self, filename, data, signing_role):
for fixture in self.fixtures:
fixture.write_signed(filename, data, signing_role)

View File

@ -0,0 +1,12 @@
{
"a": {},
"b": {
"b1": {"b1a": "bing", "b1b": "bang", "b1c": "boom"},
"b2": [3,1,2]
},
"c": {
"c1": 1,
"c2": 2,
"c3": 3
}
}

View File

@ -0,0 +1,12 @@
{
"b": {
"b1": {"b1b": "bang", "b1a": "bing", "b1c": "boom"},
"b2": [3,1,2]
},
"a": {},
"c": {
"c2": 2,
"c1": 1,
"c3": 3
}
}

View File

@ -0,0 +1 @@
2a56071cdc567ebf897df1bf21f00d2a@@@@100000@@@@6dbc945dd60f2a924116e48887c457b17da412f32d6529b770a3f95daaeedd83@@@@bf607649a08aaabe0764b5e53b7211e1@@@@f2f0717d46b2a8b49411553df1d4aae8e2e6ffaca6bd5090f2d3fe5bfa6447267eb13c1a76d55a1001d30efba9db1f7c51b854362618d14a5dd7a55f4faa4f1f8244d1094211106fa9da53daf6146d82cf0b6e42c357c01cbe0fddb6fa4d8a93134f5231a1204ae4da8a623018867a250ca4c03a619971d92dce28c5d276b292209bdb990c1f30684053da70460b898386afcf0b34dd9ae810e111ec4761306a0fb520c4d28099c8806330051584e7fa8ad1c9901c99c41ce4b63f1e4cb57b1d2e9810d80e523a7912291624bb2c95d2d49601dd3e79b1612c924755ff3a362d35b10a03c489a6ce47045200cb1ea9d9a75141f13a8bf7be05453ddb13eb64bc0bfa5c6873d2b410e2d90d60e6bce6b403e4cbcb7bc874dfde114dba8376b1a4d3c1d788952300a29c6e6c9d70faadb2a88467c47e0abbab6d073b7e42b9389162c2526b3964e55e40c07be160c0ce4a

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089"}}

View File

@ -0,0 +1 @@
5b13ee7f3720895230732b155aaf2332@@@@100000@@@@80c3b42585e084443ab63bcfeebf52e270de626a23c95af6fa0fd546610df59f@@@@d123189cccc3e68aaf0b20363fcdb205@@@@72b3cf564c96ceed9e71b46bd6209d6029d6a30a177152a40bd6e8d38fb2e119f61d8e8426577fa20c7494f27b435a9a2b68664a84628d6818278c37ec6cb456dcc308345384ee0a1bce7c91a21234d5274fda69c276480a75672719abb0e1b8802fa00f107672b91379f9c2ccc74976f506a94524d4f1957a26d8c29af3fae7d916e8b045d3a0d8f1460ec5416ba408ee22169431cf7feb75f50148b839caf536bf728702ebb5073614040cf65c6aaf0bec893c223ce9959230d0079d9f729817c6ff56e74545e0989b7d811c2861d1ae1eb616ba1e72e15115a2bb036912aaaf19339a77bce30eaf15afdda4d250277553a36c1019669c71d4b0e090b7cf1d92c596df1f50391459606aa92c43e659fad5b290604b09691d6fe2d76a2c9da6394b6ab64f111646811603c32bc84fd80d54c61290abcb3a8aada49e10abedb63c790f7641c67b947eb36e35368df3b6

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "f6b299bcfb4e15ef652c80e9e3dda995acbb4bf71dce889a82ba70228e45a8bf"}}

View File

@ -0,0 +1 @@
b8320e3d8175793d728f1e54c22e45f9@@@@100000@@@@f2e672c3dda1e4909f62de107632bd13f7dc719aacbed626655f672b4c4c0535@@@@2aa94b4a337dd550dac957de0de5839f@@@@85a14a4cbfe466e8b5f7306db4357fe5b1b852f5057d95ee374f271483e6ba02a38501c9e4d482fc2a764fa25361298cec7cb857a2371778e8273c58e24eace75aa5e17dbbb3deb2f0f076cc510153825c4e5e14bfb4cce9b6d1fda19888a6b45ab9853e0abf4d4d87f2e12b44250b6228dbd93998365acd647504beffc12800d691a118bbd73e572aece4159947a97f51a28e5474377d694a990546936bb8f2bfed74988f2af1f280a78e4155dfbc88438ff9203be0de4c91d91bf6145124189685610a599cead73e591e9d9f45cf212c3208ef8305b476a0c0543c486410dc55f1781877cc6cbaee8dd7a1ea778a13f2b7df52be64e2dbd247f7ea2e4b7afaf5bc0b7d62da7f96220f7d12d92884d3e6b81db182747d857fb4cce8e95072fff7d14f1d8dd3f0331182fc694ae906f91f517ec71a7b14940aa89ab8ab78b5b65a38bd9319d118a86f8eccd090ffc7c6

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "9b1db36a5cad80284b5f40b040621e0e444f25ee09efa5c1fd6da4499c711bd5"}}

View File

@ -0,0 +1 @@
4ede56ed77003cf7bf97f706bf303e21@@@@100000@@@@c628c83f3619e0a70f69cb1db7dcbfc5d99219b933ff9d92b60a4c5250993d5f@@@@db063853cfc0caa060b69e4b78a1cc5f@@@@8881ba6d39297f89d796e1bd1636d0bd7b938dfd47d837ca7da0c95c001a3e59741d01f56fae02a1254fc17bb6293492ff103d5c5a5e16ca1ad2519f5af7860694f41cf9f1a9a3b6902652198de490b42501b66faa62b173926b0533d938c91454adc856de076aa9aea340655ab67a4e17a814ecb8902bf53bc9b4a0e03a984b14aa09bc3f1f44ab6d014394dacb1e6012b78a3a413b5b0f16b2912ae029dacb7924320282c181d76ce217de02e235ba60ce17b40e7513de451d699ce3dae013ed034eceabd3568d51f8bd7949377947bf419defbbef4827e5ed603fd17f4d07e0a08d83ac06b261c066ba568f17a3b1441806ba8ef2a7336fc90bc9cd50ecf590f44418b567937a47885f939919ef196bc3b95d138f3933af8a3d9f4f0bd49c4506529be49d238595a0a5a32e5db61ee2c591cac895a30586ca622172a8bb8a2f09e78af1181d63ea0796e5065b3f7a

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "4cda5fbefc48b179e3ccd630affc0190e8dd0a391f3f50c834c8851183d12c3c"}}

View File

@ -0,0 +1 @@
19cad0ad18a08c8ee6eb2ef73707beff@@@@100000@@@@d9192082dc67e8e8a83b1157601b648dc44887f6bb2f9571be8bc26f1569729b@@@@ed071f66afb29126740b51a63257bc4e@@@@a2e6a15613f9f1a6fe4100866c544c29bd78bdf87f281fe5d74ab726348211208d49293806f465b3bea9fd020bd42f2656dbd1bdef73da156e72031eb66a20d07ef3c00460337e9c78a8a92e01bb718fa3e79d9595658b011d5c71d3158d0ababd5988a321374054894a36f2cea1be884093abfec5dc38cf16b266e3bfdcdbf5b05f35b78f8e33ac66795415f915f720b2c6457c2e3a282ae71afce97193f46ba87a0451a02a4ac821b39c4eba1e46c633d49eb8ef6c8098d6e697758807782e346684a82e32215d895480ce807761a7c793bccf9408ff752e74d755d313a752267b6c485dbf40d7499c386a3af08726557f60e541780d7e160ff8a9963fc226cc75e06619472f648ba3eacb8cadabba688d9c084039ee4cbebe53ec52f3810b2424f9e99bee10c292f571ae9e392b069b6291216a2a23f453fcb0c4048ad104b2270100a66c360dc5481617b6fe373e

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "0e0af300cf77cad9451b2ccda9965695fd6d4f7b7095b7dd201f3ac6e1f38c3e"}}

View File

@ -0,0 +1 @@
c5221bea5272555d66b064911cd040bb@@@@100000@@@@50f150cb65889084b7f7c550eb66862ad1d002fca8eee4050c79a12907392419@@@@4271dc7da1655540cc576ba946dd7ce3@@@@a0ada2a75625de515da190523f98e5323407a4546712b65091747667c0856602cceb7df4dab3282f2da7cc02bda6a0016535e103676e7cf2ad808565ff0ab7e417364218ce92c8800e2837b239703df295c9f026e22855a6c640dd3576d90f6d57dec3d5508732dbd80b35cc536b06b35f535e70b3f03680a4bb948cf23bbad17b12602bcbe0184ece3ba70ed8680784ed734e0ebd689a90e240ffa6dc7fd9278a94409b2ec6087eba0f87161a40091c5f6bb0ecd34debb667aaa7ddc07c032c429e9ce4cbe5cd5c518a68b566c08faba90ff4638e667481f5871c24b17cd786f31433c7b4ba021a76937cb28f16be9fbb78e081d16fd535b08928302a0f027b7c2a32fade93483f53c915b6b0d5d3fec4ce5bf48fd9bf54610537fb23dfec6e75703edc6564f0b8275a19d7831ffa8c86b5b15c654304efcaee1f232e1e86809c5954a6a97fff4d16c9f387bafec4ee

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "b344623fb077df4ba6f4456ff0b3cc67e233d4586e13731135efb79d7a19d4a2"}}

View File

@ -0,0 +1 @@
56955d4230b845cce7db5744757a29cb@@@@100000@@@@f95dfac4e8ed775f9be29909a5151108cebf7d0d2f8b7033e0a9c46dbdb74c56@@@@98f1206687b5d4392daba519dd897580@@@@2be86c837bbc22c0b75b57f8e41cc82d2b92e5499060606375f754f0149e466a32b3364dc3d688e76be2b43f2718590da5720c334320ddc0e1ad23a9946d9932137aa6ec6ec347210c222d945ad8d19d12dc3ca1a564466312bfe54ed9b2f1e389c000e5c68cecab95945a11e09584d96fe44eab3088038bd3819b9a9e26416036430f5bb2bd1e87cd7a72d7d2f641835b0aa5ccc1ad8a51b458201b609c87b44b1e834fa0bd50e11686b942b2a53379a6aea747d9d7f3d72a634a84b97cdf02e1108303cae4dd3e535f23ebbe3f1d01c46826da4920598b8a09a069769cc694912eaaaf0289df7696d636b59e84b56d7e6175bf3dc44cdb5a47d327ee90fe70a033006d1b975942e57aee9586d57ce27865b58abba7294a4fd4a75c1902deda2ba04563361c66d7a191c3ddc550f9b375bcab6d5c8a763dde202032ad128a1bcc84a04651873ec4303695a174e0f5b1

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "91f20c58b14fe80a6e1d25c9365a81bdf52b590f9233affc61d97b4818d7fcb2"}}

View File

@ -0,0 +1 @@
8f61d689d9257c0dffa9fcfaba2668c3@@@@100000@@@@8c23dd4d12a2b2304bc77c1d371ba4c6c2c85bdd2d58885044ecc54748bdadde@@@@862882260add41f51ba6fa1b0521fcab@@@@523ecaa4b99764240a0563ed06d5babbe70518b9ee7b06be9fee589df299bb8a83c589f4ee4a95a0cbc3dd1a1f020ac42278160bf0a7685a25ed90400e8fef8d50bfed0bebbfead269b914c2e2f3340cf4c0dd640a47c2be4526d796d6a234d566dffd0956f28d86aea26245b5e57fbdc02b2321b866a07e4bb85f3013aea414ce6c54215afa0823511cb6bedc2bd00e8e3bf2aa794f3ed7d8fb82d152ae03dafced780819f241274a63537a44b69692e9a7ef9403136680a09ee9f2992aa27222292ae3b1ba5c383a20cae2848a2de5407d3444aa4453031c9b479c991cfd0c658502402e3681713ace5e08834531de9a8f26267d43a78a322fa63659ce580b93e4ec8c026bd4199db6a1fee132bdfeaee91d08442fe0ab2d74b8dd5d511004edacfad93dc5bbc02b69667a8a3c51236d84c19e749e230972e43286d420a6d30d8f494fe0793137822d1e88434d7d80

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "5b11e1690f25cbc096f7c0cc799c37f1641464cf7769e0729fc47f25b1c46c18"}}

View File

@ -0,0 +1 @@
1233adb06f7364b0fe2363f78cf62b4d@@@@100000@@@@bdc9de02f20fb01d0c725ff47f51d963144256e50eef7a7342a091c3054bfe5b@@@@3529ed56edf3b83e06263fe23f99d7da@@@@b4c50cc2e42ac4a07d05035040bbb2cf69f6a79525ab8bbe23ada43c580711858f540abe6b6787e1716b0d2b600f82764b26bc788cfd7e6dc8608c29f8df560132c74c54e4143de6e35444249da5baaf4369b381315257edefd17d88563f44338e5a31f5255ce4390faab938610a030e37ca670253483b5ff67d2f0ecbc45f0387aacdb1a191c5b07751548cab63369e2a9117aaa8ee4d058e43bcaa1399ab4064e5cc085bbf1b56f3833baba102dc91a062cf3f30ba694d0d48473c1557079d43218efc6c7c3bd478a7e590d8a6c2692199d180d4c67df918ad37856e961d0702353d7c76b55cd2b154d557d3cbda1373d83b098e8c083bd890fd3be23bdd9b36915e93f212fe4c7f96798b3e977ce34ab5a0aacad67da74c431ddbdb1c6e42dcfc93ece269c1fdb13e74fb9e2bb268a2df05605ec37c66b83133bce09a3896666b6f1cef29374f075a442c82ee6afc

View File

@ -0,0 +1 @@
{"keytype": "ed25519", "scheme": "ed25519", "keyid_hash_algorithms": ["sha256", "sha512"], "keyval": {"public": "67030d4a002627529ff8c68a026d2e163972a4f4d70dcbc8514df13ef4d998e4"}}

View File

@ -0,0 +1 @@
66e75d90203f1eaf6fdfffd6625f22e6@@@@100000@@@@9a06c601217424b30547ab4b7f907c1824795869425536a733c61621b786393f@@@@6df0eb1ce554b06b017fd563b9299363@@@@d8640b6e40e441bd7d72d51fe3cf13d06de45ca57d677cbcdbb4deef8e553552384a4a2ec28d23d0a3b1de0fa5fb783e90648d78ee71df82480ad6122ec50957c2fff03b7ac1e633125968e3a67f231811482d2b4e5be1c34fca8fc8e601344985641d7b9a801367383040860f59e9e3f2dd2b30ee5a8f8c0f625fc2dd1f8f78a1c4e7102a367c7d66ef42a4f5579d0c587459137f89abf4f36053a369fd86f17b809764dcca472ec6ab85d5a43b4950cccb979408fc6eec8486d3eccd4746b6eb7ed8c34a15d73e704c80c5b7baf1f5039b8b480ad881f8d35a1f20babdb3f25e883d8b5d2aaa641c429a4b4ef5f9c27df84777d026b0dcdde915d6645e890ea42e7487d28cefbf4555f7d595da2bb9d2896fc5f33730ba80911417f62e61fa98ff8b0a03bc54a834b87a6f8cd4ea9807a91426703a09547fcd45558518e4e52518ba22ad65a47dc9a0c52d4f20fe8d

Some files were not shown because too many files have changed in this diff Show More