From dbeb1c0474216ef3d36a12dd2a52a6ad621af338 Mon Sep 17 00:00:00 2001 From: jlanson Date: Mon, 9 Dec 2024 08:18:22 -0500 Subject: [PATCH] feat: manifest xtask updates download manifests in the website source files Signed-off-by: jlanson --- Cargo.lock | 10 +- site/static/dl/plugin/mitre/activity.kdl | 32 ++--- site/static/dl/plugin/mitre/affiliation.kdl | 32 ++--- site/static/dl/plugin/mitre/binary.kdl | 32 ++--- site/static/dl/plugin/mitre/churn.kdl | 32 ++--- site/static/dl/plugin/mitre/entropy.kdl | 32 ++--- site/static/dl/plugin/mitre/fuzz.kdl | 64 +++++----- site/static/dl/plugin/mitre/git.kdl | 32 ++--- site/static/dl/plugin/mitre/github.kdl | 32 ++--- site/static/dl/plugin/mitre/identity.kdl | 32 ++--- site/static/dl/plugin/mitre/linguist.kdl | 32 ++--- site/static/dl/plugin/mitre/npm.kdl | 32 ++--- site/static/dl/plugin/mitre/review.kdl | 32 ++--- site/static/dl/plugin/mitre/typo.kdl | 32 ++--- xtask/src/task/manifest/download_manifest.rs | 128 ++++++++++++++++++- xtask/src/task/manifest/kdl.rs | 6 +- xtask/src/task/manifest/local.rs | 68 ++++++++++ xtask/src/task/manifest/mod.rs | 33 ++++- xtask/src/task/manifest/remote.rs | 7 +- 19 files changed, 457 insertions(+), 243 deletions(-) create mode 100644 xtask/src/task/manifest/local.rs diff --git a/Cargo.lock b/Cargo.lock index 891cb9f0..841910d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2874,21 +2874,21 @@ dependencies = [ [[package]] name = "miette" -version = "7.4.0" +version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317f146e2eb7021892722af37cf1b971f0a70c8406f487e24952667616192c64" +checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ - "cfg-if", "miette-derive", + "once_cell", "thiserror 1.0.69", "unicode-width 0.1.11", ] [[package]] name = "miette-derive" -version = "7.4.0" +version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c9b935fbe1d6cbd1dac857b54a688145e2d93f48db36010514d0f612d0ad67" +checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", diff --git a/site/static/dl/plugin/mitre/activity.kdl b/site/static/dl/plugin/mitre/activity.kdl index 1c749aa1..0965289f 100644 --- a/site/static/dl/plugin/mitre/activity.kdl +++ b/site/static/dl/plugin/mitre/activity.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="5089ef5d6e7307adc1793cbfc8dde8f53d407d8a9c6e77dcad0703c4d2431f2f" - compress format="tar.xz" - size bytes=1_096_284 + url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="5089ef5d6e7307adc1793cbfc8dde8f53d407d8a9c6e77dcad0703c4d2431f2f" + compress format="tar.xz" + size bytes=1096284 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="0138af7120977be6a0f44309345a9a79a0d4d1ba3cd77dd02635450ac0ab1a11" - compress format="tar.xz" - size bytes=1_185_456 + url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="0138af7120977be6a0f44309345a9a79a0d4d1ba3cd77dd02635450ac0ab1a11" + compress format="tar.xz" + size bytes=1185456 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="791c1051179966f59f9c1e14ccd21fedfa58458a83bda7d570acfcca7a647761" - compress format="zip" - size bytes=3_989_179 + url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="791c1051179966f59f9c1e14ccd21fedfa58458a83bda7d570acfcca7a647761" + compress format="zip" + size bytes=3989179 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="83db1e17115fc5b8c71a06ca79ffa10cf972288001bc11ec5252ac301897f091" - compress format="tar.xz" - size bytes=1_275_520 + url "https://github.com/mitre/hipcheck/releases/download/activity-v0.1.0/activity-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="83db1e17115fc5b8c71a06ca79ffa10cf972288001bc11ec5252ac301897f091" + compress format="tar.xz" + size bytes=1275520 } diff --git a/site/static/dl/plugin/mitre/affiliation.kdl b/site/static/dl/plugin/mitre/affiliation.kdl index 70a7562c..aedd5e0f 100644 --- a/site/static/dl/plugin/mitre/affiliation.kdl +++ b/site/static/dl/plugin/mitre/affiliation.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="31672ec1e7cbde637c9c1a7a890d40fefb44d2e47205fb21d8ab812092bf3208" - compress format="tar.xz" - size bytes=1_143_068 + url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="31672ec1e7cbde637c9c1a7a890d40fefb44d2e47205fb21d8ab812092bf3208" + compress format="tar.xz" + size bytes=1143068 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="1303425c8cde0236f7f80da3bb227f01d222e38f0c0da1329563243401d045e7" - compress format="tar.xz" - size bytes=1_242_800 + url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="1303425c8cde0236f7f80da3bb227f01d222e38f0c0da1329563243401d045e7" + compress format="tar.xz" + size bytes=1242800 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="d6745e07807c7bb195f822be4a3416a2ed2b2080cb9f9379c7fc7743a652ed19" - compress format="zip" - size bytes=4_139_728 + url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="d6745e07807c7bb195f822be4a3416a2ed2b2080cb9f9379c7fc7743a652ed19" + compress format="zip" + size bytes=4139728 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="f2ec3958e00e7f877b4efde246f8596e502b1f2240914e22b28e58840f3fdf3b" - compress format="tar.xz" - size bytes=1_332_908 + url "https://github.com/mitre/hipcheck/releases/download/affiliation-v0.1.0/affiliation-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="f2ec3958e00e7f877b4efde246f8596e502b1f2240914e22b28e58840f3fdf3b" + compress format="tar.xz" + size bytes=1332908 } diff --git a/site/static/dl/plugin/mitre/binary.kdl b/site/static/dl/plugin/mitre/binary.kdl index 9e452962..8c404d08 100644 --- a/site/static/dl/plugin/mitre/binary.kdl +++ b/site/static/dl/plugin/mitre/binary.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="66ece652f44ff47ad8f5ab45d4de1cde9f35fdc15c7c43b89aebb7203d277e8e" - compress format="tar.xz" - size bytes=1_183_768 + url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="66ece652f44ff47ad8f5ab45d4de1cde9f35fdc15c7c43b89aebb7203d277e8e" + compress format="tar.xz" + size bytes=1183768 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="b3c7e463c701988bdb568bf520f71ef7e6fa21b5c5bc68449a53a42e59b575ab" - compress format="tar.xz" - size bytes=1_289_520 + url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="b3c7e463c701988bdb568bf520f71ef7e6fa21b5c5bc68449a53a42e59b575ab" + compress format="tar.xz" + size bytes=1289520 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="aea41cd5b91c79432baf0b00b5f85fef33ecaefcc2dfe24028b5d7dbf6e0365c" - compress format="zip" - size bytes=4_322_356 + url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="aea41cd5b91c79432baf0b00b5f85fef33ecaefcc2dfe24028b5d7dbf6e0365c" + compress format="zip" + size bytes=4322356 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="dfe3f12d5c4b8c9397f69aad40db27978f5777dd16440380e8f35c6ddf65f485" - compress format="tar.xz" - size bytes=1_382_112 + url "https://github.com/mitre/hipcheck/releases/download/binary-v0.1.0/binary-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="dfe3f12d5c4b8c9397f69aad40db27978f5777dd16440380e8f35c6ddf65f485" + compress format="tar.xz" + size bytes=1382112 } diff --git a/site/static/dl/plugin/mitre/churn.kdl b/site/static/dl/plugin/mitre/churn.kdl index 6630a2c5..930ca83e 100644 --- a/site/static/dl/plugin/mitre/churn.kdl +++ b/site/static/dl/plugin/mitre/churn.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="37ade41aadb25db06d49ddd3e87839cf81f454334239b08195c8a03041a62714" - compress format="tar.xz" - size bytes=1_240_268 + url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="37ade41aadb25db06d49ddd3e87839cf81f454334239b08195c8a03041a62714" + compress format="tar.xz" + size bytes=1240268 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="8cc59a50f877e7d28c60a4c4914acc4a09a7b0fee49509fb2abf4842bb2f4060" - compress format="tar.xz" - size bytes=1_347_532 + url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="8cc59a50f877e7d28c60a4c4914acc4a09a7b0fee49509fb2abf4842bb2f4060" + compress format="tar.xz" + size bytes=1347532 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="dfae4f6ab9a5632274c65ab89e63d44bd35a459f22f875e5844aefd58df45351" - compress format="zip" - size bytes=4_578_470 + url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="dfae4f6ab9a5632274c65ab89e63d44bd35a459f22f875e5844aefd58df45351" + compress format="zip" + size bytes=4578470 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="2b45370f46212f8b6186618291b02e14b91b0df30051b5b21eb3ae09acd0fee3" - compress format="tar.xz" - size bytes=1_443_640 + url "https://github.com/mitre/hipcheck/releases/download/churn-v0.1.0/churn-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="2b45370f46212f8b6186618291b02e14b91b0df30051b5b21eb3ae09acd0fee3" + compress format="tar.xz" + size bytes=1443640 } diff --git a/site/static/dl/plugin/mitre/entropy.kdl b/site/static/dl/plugin/mitre/entropy.kdl index ed3b520a..790670ce 100644 --- a/site/static/dl/plugin/mitre/entropy.kdl +++ b/site/static/dl/plugin/mitre/entropy.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="a68265eabb994f65aa01ead6747421000f47051960dd10a195f01a1741c84687" - compress format="tar.xz" - size bytes=1_332_104 + url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="a68265eabb994f65aa01ead6747421000f47051960dd10a195f01a1741c84687" + compress format="tar.xz" + size bytes=1332104 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="81a5962e3819b82d2999f1a5a575894aab451cc69485b65cba581c28f5b305ff" - compress format="tar.xz" - size bytes=1_446_056 + url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="81a5962e3819b82d2999f1a5a575894aab451cc69485b65cba581c28f5b305ff" + compress format="tar.xz" + size bytes=1446056 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="794c72b0793de206d2d99c59d3bfbf079ab13d39a59b012ae50535d57e119586" - compress format="zip" - size bytes=4_889_780 + url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="794c72b0793de206d2d99c59d3bfbf079ab13d39a59b012ae50535d57e119586" + compress format="zip" + size bytes=4889780 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="fb23a8df4904e188e130ecba17ca1d8f9795ee3d788ccee103b11d45d8590dac" - compress format="tar.xz" - size bytes=1_543_064 + url "https://github.com/mitre/hipcheck/releases/download/entropy-v0.1.0/entropy-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="fb23a8df4904e188e130ecba17ca1d8f9795ee3d788ccee103b11d45d8590dac" + compress format="tar.xz" + size bytes=1543064 } diff --git a/site/static/dl/plugin/mitre/fuzz.kdl b/site/static/dl/plugin/mitre/fuzz.kdl index 048d00e0..60c4c984 100644 --- a/site/static/dl/plugin/mitre/fuzz.kdl +++ b/site/static/dl/plugin/mitre/fuzz.kdl @@ -1,56 +1,56 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="774811c01d0c351c2c1b8e60b6b1f89773d4ab73cbb4b83c229357bf6778fa17" - compress format="tar.xz" - size bytes=1_066_152 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="774811c01d0c351c2c1b8e60b6b1f89773d4ab73cbb4b83c229357bf6778fa17" + compress format="tar.xz" + size bytes=1066152 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="429314ada27f2f0230f9eb7f0109481dea211218bda1eaa1e9282413836923cb" - compress format="tar.xz" - size bytes=1_157_248 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="429314ada27f2f0230f9eb7f0109481dea211218bda1eaa1e9282413836923cb" + compress format="tar.xz" + size bytes=1157248 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="e9b6b8e7066fc860610b2408cd3180e114108d7c8d8ee3e87e5b1a320dbe7822" - compress format="zip" - size bytes=3_883_154 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="e9b6b8e7066fc860610b2408cd3180e114108d7c8d8ee3e87e5b1a320dbe7822" + compress format="zip" + size bytes=3883154 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="769a55b18246d273eae538ba19f9cbeaba3c787358c5017aa5b65ce376d596c9" - compress format="tar.xz" - size bytes=1_243_404 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.0/fuzz-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="769a55b18246d273eae538ba19f9cbeaba3c787358c5017aa5b65ce376d596c9" + compress format="tar.xz" + size bytes=1243404 } plugin version="0.1.1" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="de84c4161212a8930c00a05c78673bac3514c0a2357a70475616e73ed6747cd6" - compress format="tar.xz" - size bytes=1_067_600 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="de84c4161212a8930c00a05c78673bac3514c0a2357a70475616e73ed6747cd6" + compress format="tar.xz" + size bytes=1067600 } plugin version="0.1.1" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="5f788de2351d385e1d8fbb1eba3042997f1ca30111bb060888a6b44e2429b6b3" - compress format="tar.xz" - size bytes=1_157_660 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="5f788de2351d385e1d8fbb1eba3042997f1ca30111bb060888a6b44e2429b6b3" + compress format="tar.xz" + size bytes=1157660 } plugin version="0.1.1" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="1d1511a320b84567cbb49354e60a7f445d87956baed331a1ebef7dc08eac2414" - compress format="zip" - size bytes=3_883_173 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="1d1511a320b84567cbb49354e60a7f445d87956baed331a1ebef7dc08eac2414" + compress format="zip" + size bytes=3883173 } plugin version="0.1.1" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="cffdda1499eedda20b374df71790acfd29ca2da02106efdf06999cca29611c89" - compress format="tar.xz" - size bytes=1_243_712 + url "https://github.com/mitre/hipcheck/releases/download/fuzz-v0.1.1/fuzz-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="cffdda1499eedda20b374df71790acfd29ca2da02106efdf06999cca29611c89" + compress format="tar.xz" + size bytes=1243712 } diff --git a/site/static/dl/plugin/mitre/git.kdl b/site/static/dl/plugin/mitre/git.kdl index 370687bb..2aa2f515 100644 --- a/site/static/dl/plugin/mitre/git.kdl +++ b/site/static/dl/plugin/mitre/git.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="e419092d9caef566ef1903c417f66ecb155917cc50e278e8b2c5de127baf51c7" - compress format="tar.xz" - size bytes=1_081_808 + url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="e419092d9caef566ef1903c417f66ecb155917cc50e278e8b2c5de127baf51c7" + compress format="tar.xz" + size bytes=1081808 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="e0bc850db7fdd14b3386656d9076b55cc6ba1f9cdab91b764378449f95e9cf6b" - compress format="tar.xz" - size bytes=1_177_464 + url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="e0bc850db7fdd14b3386656d9076b55cc6ba1f9cdab91b764378449f95e9cf6b" + compress format="tar.xz" + size bytes=1177464 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="b9ab124af4b22df0b68e57f1e036ac5127d391e1745527bfec86c79f2a9e49b3" - compress format="zip" - size bytes=4_085_279 + url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="b9ab124af4b22df0b68e57f1e036ac5127d391e1745527bfec86c79f2a9e49b3" + compress format="zip" + size bytes=4085279 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="df3660353b36b4fe95544fe2411c6a90283002628409997fe7e9313aa01170d3" - compress format="tar.xz" - size bytes=1_270_216 + url "https://github.com/mitre/hipcheck/releases/download/git-v0.1.0/git-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="df3660353b36b4fe95544fe2411c6a90283002628409997fe7e9313aa01170d3" + compress format="tar.xz" + size bytes=1270216 } diff --git a/site/static/dl/plugin/mitre/github.kdl b/site/static/dl/plugin/mitre/github.kdl index f2cf785c..f4d505e7 100644 --- a/site/static/dl/plugin/mitre/github.kdl +++ b/site/static/dl/plugin/mitre/github.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="c26f375f4c899b316281759193b21c382f97d49d59ca8bffe6225f5f06d723b4" - compress format="tar.xz" - size bytes=1_734_932 + url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="c26f375f4c899b316281759193b21c382f97d49d59ca8bffe6225f5f06d723b4" + compress format="tar.xz" + size bytes=1734932 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="d3538a11379f6ac00c71b78a31ac87aa15e0613f352603922eb0e6f58ff9f056" - compress format="tar.xz" - size bytes=1_893_876 + url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="d3538a11379f6ac00c71b78a31ac87aa15e0613f352603922eb0e6f58ff9f056" + compress format="tar.xz" + size bytes=1893876 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="e44d51e608dec66ebbca59a5d53dd13894ed41247771d2d472360b5b8b0e880d" - compress format="zip" - size bytes=5_822_004 + url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="e44d51e608dec66ebbca59a5d53dd13894ed41247771d2d472360b5b8b0e880d" + compress format="zip" + size bytes=5822004 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="69380bb7c1548a07e29bb9959b8f774eebfd3b70f3c3b30ee2808904416ddece" - compress format="tar.xz" - size bytes=2_029_200 + url "https://github.com/mitre/hipcheck/releases/download/github-v0.1.0/github-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="69380bb7c1548a07e29bb9959b8f774eebfd3b70f3c3b30ee2808904416ddece" + compress format="tar.xz" + size bytes=2029200 } diff --git a/site/static/dl/plugin/mitre/identity.kdl b/site/static/dl/plugin/mitre/identity.kdl index a305cd4c..091f500c 100644 --- a/site/static/dl/plugin/mitre/identity.kdl +++ b/site/static/dl/plugin/mitre/identity.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="29743e3af0c58d89aae7609463b268548b13d1f0ebc3380be3bb47406206b877" - compress format="tar.xz" - size bytes=1_083_808 + url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="29743e3af0c58d89aae7609463b268548b13d1f0ebc3380be3bb47406206b877" + compress format="tar.xz" + size bytes=1083808 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="6b6ba8985c8a5c1a322d211c451040d9d2166cb4943284c8321fecfcd8f70190" - compress format="tar.xz" - size bytes=1_174_092 + url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="6b6ba8985c8a5c1a322d211c451040d9d2166cb4943284c8321fecfcd8f70190" + compress format="tar.xz" + size bytes=1174092 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="ceea8f1003efaf712c42987a04a61ce5d0c7c7331b9098fa70f2d16a85effbcb" - compress format="zip" - size bytes=3_961_541 + url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="ceea8f1003efaf712c42987a04a61ce5d0c7c7331b9098fa70f2d16a85effbcb" + compress format="zip" + size bytes=3961541 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="81087950da4be880f1cf7900f2f105f6a26a7d625365f3e027b475b076dfd820" - compress format="tar.xz" - size bytes=1_261_408 + url "https://github.com/mitre/hipcheck/releases/download/identity-v0.1.0/identity-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="81087950da4be880f1cf7900f2f105f6a26a7d625365f3e027b475b076dfd820" + compress format="tar.xz" + size bytes=1261408 } diff --git a/site/static/dl/plugin/mitre/linguist.kdl b/site/static/dl/plugin/mitre/linguist.kdl index c05a5c04..47d1c8d8 100644 --- a/site/static/dl/plugin/mitre/linguist.kdl +++ b/site/static/dl/plugin/mitre/linguist.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="0f07051f7b1e68b532eb674b90b7e8df5d27ce889c81e05404e63b611ddffa7e" - compress format="tar.xz" - size bytes=1_061_228 + url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="0f07051f7b1e68b532eb674b90b7e8df5d27ce889c81e05404e63b611ddffa7e" + compress format="tar.xz" + size bytes=1061228 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="f6dd7c23f63d571bedbde7c827658aab563e24939e3cc100196689809545ec9d" - compress format="tar.xz" - size bytes=1_154_760 + url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="f6dd7c23f63d571bedbde7c827658aab563e24939e3cc100196689809545ec9d" + compress format="tar.xz" + size bytes=1154760 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="4e8d4e03578b3957fc7937ffe5a6986e50f81b631ef685552396d05ca3d16ba5" - compress format="zip" - size bytes=3_813_954 + url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="4e8d4e03578b3957fc7937ffe5a6986e50f81b631ef685552396d05ca3d16ba5" + compress format="zip" + size bytes=3813954 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="b747a227e976f15b36ceffd2bee932d28631b0d90014868693d8ba5aded15a33" - compress format="tar.xz" - size bytes=1_242_572 + url "https://github.com/mitre/hipcheck/releases/download/linguist-v0.1.0/linguist-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="b747a227e976f15b36ceffd2bee932d28631b0d90014868693d8ba5aded15a33" + compress format="tar.xz" + size bytes=1242572 } diff --git a/site/static/dl/plugin/mitre/npm.kdl b/site/static/dl/plugin/mitre/npm.kdl index 33414c0a..171cca1b 100644 --- a/site/static/dl/plugin/mitre/npm.kdl +++ b/site/static/dl/plugin/mitre/npm.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="844d46b0dcf40d8d936a225bc2b3e05770328d0f999f3d140e770006cde26b6b" - compress format="tar.xz" - size bytes=1_372_136 + url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="844d46b0dcf40d8d936a225bc2b3e05770328d0f999f3d140e770006cde26b6b" + compress format="tar.xz" + size bytes=1372136 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="8df805599f507ab2cb4a1f5290b3c7fe32ce2725998640b94e91140d0550f9dc" - compress format="tar.xz" - size bytes=1_516_548 + url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="8df805599f507ab2cb4a1f5290b3c7fe32ce2725998640b94e91140d0550f9dc" + compress format="tar.xz" + size bytes=1516548 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="3bad07bf00da8420704431c8a5038b997243404427d2a405c8adc2a8d4162647" - compress format="zip" - size bytes=5_334_047 + url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="3bad07bf00da8420704431c8a5038b997243404427d2a405c8adc2a8d4162647" + compress format="zip" + size bytes=5334047 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="1a18e92ab219dfb846d6c781fe97d6c37c6892b22db51c36de05912b21fee231" - compress format="tar.xz" - size bytes=1_654_852 + url "https://github.com/mitre/hipcheck/releases/download/npm-v0.1.0/npm-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="1a18e92ab219dfb846d6c781fe97d6c37c6892b22db51c36de05912b21fee231" + compress format="tar.xz" + size bytes=1654852 } diff --git a/site/static/dl/plugin/mitre/review.kdl b/site/static/dl/plugin/mitre/review.kdl index 2d0e2b22..6005531c 100644 --- a/site/static/dl/plugin/mitre/review.kdl +++ b/site/static/dl/plugin/mitre/review.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="8a8326468ea9a0f7e29696426a82c5366512b45659d7a3cc8761bf8ad6b0c861" - compress format="tar.xz" - size bytes=1_077_628 + url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="8a8326468ea9a0f7e29696426a82c5366512b45659d7a3cc8761bf8ad6b0c861" + compress format="tar.xz" + size bytes=1077628 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="a8103dd97d1b8438e3c30d0f164dea57834e42d51bb41f92a10fd68f0fadb08c" - compress format="tar.xz" - size bytes=1_168_736 + url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="a8103dd97d1b8438e3c30d0f164dea57834e42d51bb41f92a10fd68f0fadb08c" + compress format="tar.xz" + size bytes=1168736 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="ae0cbc0dadace695a99aff433a48be6d4d55f1312460c81897ea5fbf821d452c" - compress format="zip" - size bytes=3_920_051 + url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="ae0cbc0dadace695a99aff433a48be6d4d55f1312460c81897ea5fbf821d452c" + compress format="zip" + size bytes=3920051 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="254615fdd57ab3f949bbcbe5bbe0c1c457430de991515daeafc15cb5a3e612d8" - compress format="tar.xz" - size bytes=1_257_140 + url "https://github.com/mitre/hipcheck/releases/download/review-v0.1.0/review-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="254615fdd57ab3f949bbcbe5bbe0c1c457430de991515daeafc15cb5a3e612d8" + compress format="tar.xz" + size bytes=1257140 } diff --git a/site/static/dl/plugin/mitre/typo.kdl b/site/static/dl/plugin/mitre/typo.kdl index 8426a53b..ee687003 100644 --- a/site/static/dl/plugin/mitre/typo.kdl +++ b/site/static/dl/plugin/mitre/typo.kdl @@ -1,28 +1,28 @@ plugin version="0.1.0" arch="aarch64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-aarch64-apple-darwin.tar.xz" - hash alg="SHA256" digest="9107c6c16db5ffc5dc539c491ea68b2a65ed146488b2eb7abb4bdb055d04ecc5" - compress format="tar.xz" - size bytes=1_193_744 + url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-aarch64-apple-darwin.tar.xz" + hash alg="SHA256" digest="9107c6c16db5ffc5dc539c491ea68b2a65ed146488b2eb7abb4bdb055d04ecc5" + compress format="tar.xz" + size bytes=1193744 } plugin version="0.1.0" arch="x86_64-apple-darwin" { - url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-x86_64-apple-darwin.tar.xz" - hash alg="SHA256" digest="b3cd10abe658448484503b215aa06e65a28c29c3d533279d0bece53ab6143762" - compress format="tar.xz" - size bytes=1_298_664 + url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-x86_64-apple-darwin.tar.xz" + hash alg="SHA256" digest="b3cd10abe658448484503b215aa06e65a28c29c3d533279d0bece53ab6143762" + compress format="tar.xz" + size bytes=1298664 } plugin version="0.1.0" arch="x86_64-pc-windows-msvc" { - url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-x86_64-pc-windows-msvc.zip" - hash alg="SHA256" digest="68af2b1c0109dc336fbd2e7ef12a7862af74e47f926dc031df93e79d4cb3a331" - compress format="zip" - size bytes=4_370_591 + url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-x86_64-pc-windows-msvc.zip" + hash alg="SHA256" digest="68af2b1c0109dc336fbd2e7ef12a7862af74e47f926dc031df93e79d4cb3a331" + compress format="zip" + size bytes=4370591 } plugin version="0.1.0" arch="x86_64-unknown-linux-gnu" { - url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-x86_64-unknown-linux-gnu.tar.xz" - hash alg="SHA256" digest="8d11ef7f23c438dfcc4c9a84a774e9a86aa5467430fca896d4954da1b3d56be9" - compress format="tar.xz" - size bytes=1_392_500 + url "https://github.com/mitre/hipcheck/releases/download/typo-v0.1.0/typo-x86_64-unknown-linux-gnu.tar.xz" + hash alg="SHA256" digest="8d11ef7f23c438dfcc4c9a84a774e9a86aa5467430fca896d4954da1b3d56be9" + compress format="tar.xz" + size bytes=1392500 } diff --git a/xtask/src/task/manifest/download_manifest.rs b/xtask/src/task/manifest/download_manifest.rs index 3c577f7a..e42c83d5 100644 --- a/xtask/src/task/manifest/download_manifest.rs +++ b/xtask/src/task/manifest/download_manifest.rs @@ -7,10 +7,16 @@ use crate::{ util::agent, }, }; -use anyhow::anyhow; +use anyhow::{anyhow, Result}; use kdl::{KdlDocument, KdlNode, KdlValue}; use regex::Regex; -use std::{fmt::Display, str::FromStr, sync::LazyLock}; +use std::{ + cmp::Ordering, + fmt::Display, + hash::{Hash, Hasher}, + str::FromStr, + sync::LazyLock, +}; static VERSION_REGEX: LazyLock = LazyLock::new(|| Regex::new("[v]?([0-9]+).([0-9]+).([0-9]+)").unwrap()); @@ -25,7 +31,7 @@ pub fn parse_plugin_version(version_str: &str) -> Option { }) } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)] pub struct PluginVersion(pub u8, pub u8, pub u8); impl ParseKdlNode for PluginVersion { @@ -39,7 +45,13 @@ impl ParseKdlNode for PluginVersion { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +impl Display for PluginVersion { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{}.{}.{}", self.0, self.1, self.2) + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Arch(pub String); string_newtype_parse_kdl_node!(Arch, "arch"); @@ -270,7 +282,7 @@ impl ParseKdlNode for Size { /// size bytes=2_869_896 ///} ///``` -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Eq)] pub struct DownloadManifestEntry { // TODO: make this a SemVer type? /// A `SemVer` version of the plugin. Not a version requirement as in the plugin manifest file, @@ -291,6 +303,35 @@ pub struct DownloadManifestEntry { pub size: Size, } +impl PartialEq for DownloadManifestEntry { + fn eq(&self, other: &Self) -> bool { + self.arch == other.arch && self.version == other.version + } +} + +impl Ord for DownloadManifestEntry { + fn cmp(&self, other: &Self) -> Ordering { + match self.version.cmp(&other.version) { + Ordering::Equal => self.arch.cmp(&other.arch), + o => o, + } + } +} + +impl PartialOrd for DownloadManifestEntry { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +// Makes it so we can HashSet and enforce unique (version, arch) pairs +impl Hash for DownloadManifestEntry { + fn hash(&self, state: &mut H) { + self.version.hash(state); + self.arch.hash(state); + } +} + impl ParseKdlNode for DownloadManifestEntry { fn kdl_key() -> &'static str { "plugin" @@ -326,6 +367,38 @@ impl ParseKdlNode for DownloadManifestEntry { } } +impl ToKdlNode for DownloadManifestEntry { + fn to_kdl_node(&self) -> Result { + let mut parent = KdlNode::new("plugin"); + parent.insert("version", self.version.to_string()); + parent.insert("arch", self.arch.0.clone()); + + let mut children = KdlDocument::new(); + let children_nodes = children.nodes_mut(); + + let mut url = KdlNode::new("url"); + url.insert(0, self.url.to_string()); + children_nodes.push(url); + + let mut hash = KdlNode::new("hash"); + hash.insert("alg", self.hash.hash_algorithm.to_string()); + let resolved_hash = self.hash.digest.clone().resolve()?; + hash.insert("digest", resolved_hash); + children_nodes.push(hash); + + let mut compress = KdlNode::new("compress"); + compress.insert("format", self.compress.format.to_string()); + children_nodes.push(compress); + + let mut size = KdlNode::new("size"); + size.insert("bytes", self.size.bytes as i64); + children_nodes.push(size); + + parent.set_children(children); + Ok(parent) + } +} + #[derive(Debug, Clone, PartialEq, Eq)] pub struct DownloadManifest { pub entries: Vec, @@ -538,4 +611,49 @@ plugin version="0.1.0" arch="x86_64-apple-darwin" { entries_iter.next().unwrap() ); } + + #[test] + fn entry_ordering() { + let a = DownloadManifestEntry { + version: PluginVersion(0, 1, 0), + arch: Arch("x86_64-apple-darwin".to_owned()), + url: Url::parse("https://github.com/mitre/hipcheck/releases/download/hipcheck-v3.4.0/hipcheck-x86_64-apple-darwin.tar.xz").unwrap(), + hash: HashWithDigest::new(HashAlgorithm::Sha256, "ddb8c6d26dd9a91e11c99b3bd7ee2b9585aedac6e6df614190f1ba2bfe86dc19".to_owned().into()), + compress: Compress::new(ArchiveFormat::TarXz), + size: Size::new(3_183_768) + }; + let b =DownloadManifestEntry { + version: PluginVersion(0, 2, 0), + arch: Arch("aarch64-apple-darwin".to_owned()), + url: Url::parse("https://github.com/mitre/hipcheck/releases/download/hipcheck-v3.4.0/hipcheck-aarch64-apple-darwin.tar.xz").unwrap(), + hash: HashWithDigest::new(HashAlgorithm::Sha256, "b8e111e7817c4a1eb40ed50712d04e15b369546c4748be1aa8893b553f4e756b".to_owned().into()), + compress: Compress::new(ArchiveFormat::TarXz), + size: Size { + bytes: 2_869_896 + } + }; + let c = DownloadManifestEntry { + version: PluginVersion(1, 1, 0), + arch: Arch("x86_64-apple-darwin".to_owned()), + url: Url::parse("https://github.com/mitre/hipcheck/releases/download/hipcheck-v3.4.0/hipcheck-x86_64-apple-darwin.tar.xz").unwrap(), + hash: HashWithDigest::new(HashAlgorithm::Sha256, "ddb8c6d26dd9a91e11c99b3bd7ee2b9585aedac6e6df614190f1ba2bfe86dc19".to_owned().into()), + compress: Compress::new(ArchiveFormat::TarXz), + size: Size::new(3_183_768) + }; + let d = DownloadManifestEntry { + version: PluginVersion(1, 1, 0), + arch: Arch("aarch64-apple-darwin".to_owned()), + url: Url::parse("https://github.com/mitre/hipcheck/releases/download/hipcheck-v3.4.0/hipcheck-aarch64-apple-darwin.tar.xz").unwrap(), + hash: HashWithDigest::new(HashAlgorithm::Sha256, "b8e111e7817c4a1eb40ed50712d04e15b369546c4748be1aa8893b553f4e756b".to_owned().into()), + compress: Compress::new(ArchiveFormat::TarXz), + size: Size { + bytes: 2_869_896 + } + }; + let mut raw_vec = vec![&d, &c, &b, &a]; + // smallest version, then arch used as tiebreaker + let exp_vec = vec![&a, &b, &d, &c]; + raw_vec.sort(); + assert_eq!(raw_vec, exp_vec); + } } diff --git a/xtask/src/task/manifest/kdl.rs b/xtask/src/task/manifest/kdl.rs index bc785b49..b2b0d415 100644 --- a/xtask/src/task/manifest/kdl.rs +++ b/xtask/src/task/manifest/kdl.rs @@ -19,7 +19,7 @@ where pub trait ToKdlNode { /// convert self to a KdlNode #[allow(unused)] - fn to_kdl_node(&self) -> KdlNode; + fn to_kdl_node(&self) -> Result; } /// Returns the first successful node that can be parsed into T, if there is one @@ -85,10 +85,10 @@ macro_rules! string_newtype_parse_kdl_node { impl ToKdlNode for $type { #[allow(unused)] - fn to_kdl_node(&self) -> KdlNode { + fn to_kdl_node(&self) -> Result { let mut node = KdlNode::new(Self::kdl_key()); node.insert(0, self.0.clone()); - node + Ok(node) } } }; diff --git a/xtask/src/task/manifest/local.rs b/xtask/src/task/manifest/local.rs new file mode 100644 index 00000000..fda7ebdb --- /dev/null +++ b/xtask/src/task/manifest/local.rs @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: Apache-2.0 + +use anyhow::Result; +use pathbuf::pathbuf; +use std::{ + fs::OpenOptions, + io::Write, + path::{Path, PathBuf}, + str::FromStr, +}; + +use crate::task::manifest::{ + download_manifest::{DownloadManifest, DownloadManifestEntry}, + kdl::ToKdlNode, +}; + +/// Get the root of where download manifests live in the site dir of the local Hipcheck repo +pub fn site_plugins_dir() -> Result { + let root = crate::workspace::root()?; + Ok(pathbuf![&root, "site/static/dl/plugin"]) +} + +pub fn get_download_manifest_path(publisher: &str, plugin: &str) -> Result { + let file_name = format!("{}.kdl", plugin); + Ok(pathbuf![&site_plugins_dir()?, publisher, &file_name]) +} + +pub fn try_parse_download_manifest>(path: P) -> Result> { + fn inner(path: &Path) -> Result> { + if !path.exists() { + return Ok(vec![]); + } + let raw = std::fs::read_to_string(path)?; + let manifest = DownloadManifest::from_str(&raw)?; + Ok(manifest.entries) + } + inner(path.as_ref()) +} + +pub fn append_entries_to_file<'a, P: AsRef, T>(path: P, iter: T) -> Result<()> +where + T: Iterator, +{ + fn inner(path: &Path, mut vec: Vec<&DownloadManifestEntry>) -> Result<()> { + if vec.is_empty() { + return Ok(()); + } + // Sort so smallest version number is first + vec.sort(); + let kdl_nodes = vec + .into_iter() + .map(ToKdlNode::to_kdl_node) + .collect::>>()?; + + let mut out_string = "".to_owned(); + for node in kdl_nodes { + let node_str = format!("\n{}\n", node); + out_string.push_str(&node_str); + } + + // If file exists, open in append mode, otherwise create new + let mut f = OpenOptions::new().append(true).create(true).open(path)?; + write!(f, "{}", out_string)?; + + Ok(()) + } + inner(path.as_ref(), iter.collect()) +} diff --git a/xtask/src/task/manifest/mod.rs b/xtask/src/task/manifest/mod.rs index daff8de8..4e7c4bda 100644 --- a/xtask/src/task/manifest/mod.rs +++ b/xtask/src/task/manifest/mod.rs @@ -1,18 +1,41 @@ // SPDX-License-Identifier: Apache-2.0 -pub mod download_manifest; +mod download_manifest; mod kdl; -pub mod remote; +mod local; +mod remote; mod util; +use download_manifest::DownloadManifestEntry; + use anyhow::Result; +use std::collections::HashSet; pub fn run() -> Result<()> { let api_token = std::env::var("HC_GITHUB_TOKEN")?; - let releases = remote::get_hipcheck_releases(&api_token)?; + let releases = remote::get_hipcheck_plugin_releases(&api_token)?; + + for (name, remote_entries) in releases.0 { + // We know all releases off the hipcheck github repo are mitre-published + let local_manifest_path = local::get_download_manifest_path("mitre", &name)?; + let local_entries = local::try_parse_download_manifest(&local_manifest_path)?; + + let remote_set = HashSet::::from_iter(remote_entries.into_iter()); + let local_set = HashSet::::from_iter(local_entries.into_iter()); + + let diff = remote_set.difference(&local_set); + let diff_vec = diff.collect::>(); + + if diff_vec.is_empty() { + continue; + } + log::info!( + "Updating download manifest for '{}' with {} new entries", + name, + diff_vec.len() + ); - for (name, release) in releases.0 { - println!("{name}: {release:?}"); + local::append_entries_to_file(local_manifest_path, diff_vec.into_iter())?; } Ok(()) diff --git a/xtask/src/task/manifest/remote.rs b/xtask/src/task/manifest/remote.rs index a320df83..d61f9462 100644 --- a/xtask/src/task/manifest/remote.rs +++ b/xtask/src/task/manifest/remote.rs @@ -38,6 +38,11 @@ impl TryFrom> for ReleaseDigest { // For each RawReleaseDigest, for release in value { + // @Todo - come up with a better way to distinguish plugin releases + if release.name.starts_with("hipcheck") { + continue; + } + // Attempt to split out the name and version string from the raw name, // this should fail for non-plugins because they follow a different release // naming convention @@ -119,7 +124,7 @@ impl TryFrom> for ReleaseDigest { } } -pub fn get_hipcheck_releases(github_api_token: &str) -> Result { +pub fn get_hipcheck_plugin_releases(github_api_token: &str) -> Result { let auth_agent = util::authenticated_agent::AuthenticatedAgent::new(github_api_token); let raw_rel_json = auth_agent .get("https://api.github.com/repos/mitre/hipcheck/releases")