From 3c2b80914e984b5b6c1c5827064e2bb81ab038b7 Mon Sep 17 00:00:00 2001 From: dhimaz0445 Date: Wed, 11 Nov 2026 03:41:55 +0000 Subject: [PATCH] chore: publish IntegraCI build modules a11ec75d3e09 --- .integraci/modules-a11ec75d3e09 | 1 + SHA256SUMS | 125 ++++--- ai-code-review/dagger.json | 2 +- container-paas-deploy/dagger.json | 2 +- contract-test/dagger.json | 2 +- contract-test/go.mod | 36 +- contract-test/go.sum | 185 +++++++--- cosign/README.md | 2 +- cosign/attestation/attestation.go | 2 +- cosign/attestation/attestation_test.go | 4 +- cosign/attestation/platformsign.go | 128 +++++++ cosign/attestation/platformsign_test.go | 121 ++++++ cosign/attestation/verify_test.go | 2 +- cosign/dagger.json | 6 +- cosign/main.go | 15 +- cosign/platform_sign.go | 111 ++++++ dast-scan/dagger.json | 2 +- db-migration/dagger.json | 2 +- db-migration/go.mod | 40 +- db-migration/go.sum | 180 ++++++--- deploy-k8s/dagger.json | 2 +- e2e-test/dagger.json | 2 +- e2e-test/go.mod | 36 +- e2e-test/go.sum | 185 +++++++--- iac-scan/README.md | 2 +- iac-scan/dagger.json | 5 +- iac-scan/main.go | 54 ++- iac-scan/scanofrecord.go | 92 +++++ iac-scan/scanofrecord_test.go | 127 +++++++ license-scan/dagger.json | 6 +- license-scan/main.go | 4 +- license-scan/report.go | 177 +++++++++ license-scan/report_test.go | 25 ++ license-scan/scanofrecord.go | 92 +++++ license-scan/scanofrecord_test.go | 127 +++++++ malware-scan/dagger.json | 2 +- mobile-android/dagger.json | 2 +- mobile-flutter/dagger.json | 2 +- mobile-ios/dagger.json | 2 +- mobile-security-scan/dagger.json | 2 +- model-scan/dagger.json | 2 +- perf-test/dagger.json | 2 +- perf-test/go.mod | 42 +++ perf-test/go.sum | 193 ++++++++++ prebuild-check/dagger.json | 14 + prebuild-check/lockfile.go | 324 ++++++++++++++++ prebuild-check/main.go | 447 +++++++++++++++++++++++ prebuild-check/pinning.go | 142 +++++++ prebuild-check/prebuild_test.go | 120 ++++++ prebuild-check/report.go | 40 ++ release/dagger.json | 2 +- sast-scan/README.md | 39 ++ sast-scan/dagger.json | 6 +- sast-scan/main.go | 206 +++++++++-- sast-scan/record_test.go | 95 +++++ sast-scan/ruleset.go | 94 +++++ sast-scan/ruleset_test.go | 83 +++++ sast-scan/semgrep_args.go | 60 +++ sast-scan/semgrep_args_test.go | 89 +++++ sbom/dagger.json | 2 +- sbom/main.go | 6 +- secret-scan/dagger.json | 5 +- secret-scan/history.go | 195 ++++++++++ secret-scan/history_test.go | 54 +++ security-scan/dagger.json | 5 +- security-scan/main.go | 364 ++++++++++++++---- security-scan/main_test.go | 186 ++++++++++ security-scan/vulndb.go | 22 ++ security-scan/vulndb_test.go | 23 ++ serverless-deploy/dagger.json | 2 +- standard-build/dagger.json | 5 +- standard-build/evidence/evidence_test.go | 2 +- standard-build/main.go | 271 +++++++++++++- standard-build/pushgate/pushgate.go | 201 ++++++++++ standard-build/pushgate/pushgate_test.go | 124 +++++++ static-deploy/dagger.json | 2 +- vm-deploy/dagger.json | 2 +- windows-deploy/dagger.json | 2 +- 78 files changed, 4982 insertions(+), 405 deletions(-) create mode 100644 .integraci/modules-a11ec75d3e09 create mode 100644 cosign/attestation/platformsign.go create mode 100644 cosign/attestation/platformsign_test.go create mode 100644 cosign/platform_sign.go create mode 100644 iac-scan/scanofrecord.go create mode 100644 iac-scan/scanofrecord_test.go create mode 100644 license-scan/report.go create mode 100644 license-scan/report_test.go create mode 100644 license-scan/scanofrecord.go create mode 100644 license-scan/scanofrecord_test.go create mode 100644 prebuild-check/dagger.json create mode 100644 prebuild-check/lockfile.go create mode 100644 prebuild-check/main.go create mode 100644 prebuild-check/pinning.go create mode 100644 prebuild-check/prebuild_test.go create mode 100644 prebuild-check/report.go create mode 100644 sast-scan/record_test.go create mode 100644 sast-scan/ruleset.go create mode 100644 sast-scan/ruleset_test.go create mode 100644 sast-scan/semgrep_args.go create mode 100644 sast-scan/semgrep_args_test.go create mode 100644 secret-scan/history.go create mode 100644 secret-scan/history_test.go create mode 100644 security-scan/main_test.go create mode 100644 security-scan/vulndb.go create mode 100644 security-scan/vulndb_test.go create mode 100644 standard-build/pushgate/pushgate.go create mode 100644 standard-build/pushgate/pushgate_test.go diff --git a/.integraci/modules-a11ec75d3e09 b/.integraci/modules-a11ec75d3e09 new file mode 100644 index 0000000..8aecd3b --- /dev/null +++ b/.integraci/modules-a11ec75d3e09 @@ -0,0 +1 @@ +a11ec75d3e09 \ No newline at end of file diff --git a/SHA256SUMS b/SHA256SUMS index 8d3c7ca..ec310c6 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1,41 +1,44 @@ aa28a5eac1a0c457a2198ff4acae99ccd5d1ac5ea514f0a03e6a2b6b331c4608 README.md d89e6c863cad31273b0fe3ac1d9a3cf867ffcfd8cb87348eff1621e663be7941 ai-code-review/README.md -112df3860cbd14fc8848eb4628e2ebde35c2cadca27df029dc192b9b5301b03a ai-code-review/dagger.json +a74377f89b08eb8cc3d2e2ae721ec2032cb65c2917f2a94a094a92451ee00e48 ai-code-review/dagger.json 0ebb5c0df751c535b0c5488f59206d86281384b5c9013853bbc5be504962aed4 ai-code-review/main.go 953902568316691546842243cae8a109808d7fc211670542f1da4ae5e8cf2694 container-paas-deploy/README.md -56af2fb43a7458d51381f45f45de9b2a461a4fd5469c3a1ad89e2c69a727b68f container-paas-deploy/dagger.json +a3769102b16894ff3d47430d34fd5727b493e6e232a43d9b5be47adeb63c8be2 container-paas-deploy/dagger.json bf2a7cc0471112aeaac0bddd350cbb67bb12fa976cf209c7d9d135319e400650 container-paas-deploy/main.go 115bdb4588a756d0090e73334a6fc5f2dc50a11e5075cf9c382d0a88eca86a24 contract-test/.gitattributes 35f95c7691a2e5e33ec7e3e0f203197cd120af831305add2a218b6c20353db8f contract-test/.gitignore 1ecc9ca9c1a867e7c17483933d24ff92adb81cd8cdd39e9ed977245fdfa7bb11 contract-test/README.md -6ff1cdc32ec7da60377a3005dbb3f03621958d934c3cfab85e161eea858a9b45 contract-test/dagger.json -dbf3655286df516769e36aa7272d10ff0fafdd7a7159d1d54e029eed94256d81 contract-test/go.mod -1e583b017d02bac9507c27d00dc36affc434571bfbfe8867ece775feccfec463 contract-test/go.sum +643fd713d0e651ec6b2774682dc2d888b5aef7f197f236587a8ea70ce28ecbdc contract-test/dagger.json +8384f7eb844429c4bd4e6f23420994b723fb28336ad11c81d28afbbf32ab2a91 contract-test/go.mod +6c6439ee349a3ca0b8285535a71fdabac880a796a29888bd993f81273f011fb8 contract-test/go.sum e97b3de1b6f7261f88d2d79b36d4ef85ee56ef092182fd42c1a5d7e0b5c0bdad contract-test/main.go -fa33a16031ad0ad65d8119981e5768b57164ede5b4db1c44a1c966d71fee4be2 cosign/README.md -d3a754dc3a438984fe4610a7ff79ce373bfd4280d4377d9b2748adddff96b2f2 cosign/attestation/attestation.go -fe0bf12fe19cc164e0ebd03bfbb28ba09d7f5aa7a2af03346b9005f6247b6163 cosign/attestation/attestation_test.go +6c1c291360634da415bcf04d9200b6149f0767451cb6d7d790db20ac30112c8a cosign/README.md +ac92964aa87ea6c6fd0ba9249002d51dfb178f360c60a542cc12fc7ff78c6f17 cosign/attestation/attestation.go +753933a9a4c5bdf9f90a5655fdbc51ac171e1e1f6548cf6dd1e364c1fea07f20 cosign/attestation/attestation_test.go dc476bb7e89af327a748b7295d3cd383633cf6f835e7eaae17fcd51110735157 cosign/attestation/gate.go 9f95de1a60db48bd38cc713a495d2e5045894a331b48ea1126ce8ac82a47be2b cosign/attestation/gate_test.go +c54df14db2bccbedcdfc4a899b092c235e4436f6a0eaa35371412d2eeb92e91b cosign/attestation/platformsign.go +8e9ac620253412be4acab7ac2fb0a32fc7b85cc4e25b4fb85f7c66eb2182f5b9 cosign/attestation/platformsign_test.go 9ab4c5bf3f850f2cdd8ef52efb1b71f07be978480ee39d0d129fc6f506154102 cosign/attestation/tlog.go 72701f946a2ac8b4486ceb845be3ccb588e8cd78b3a6811342d02ba82dd96231 cosign/attestation/tlog_test.go 26be32bc776ba9621cc6a74680c05bbf2c2657680203f03e980a2587c9203fdf cosign/attestation/verify.go -a1ae3a93b0eb28556c012ba18fda0c5c7daa93188f226e14e376d65759fe17c1 cosign/attestation/verify_test.go -962b5076c1b29b6aa95cc4f474d2cac18ee12a7e988aee3ea6b4fb6ff6cc1f2e cosign/dagger.json -570b307aaa8543c3d9dc48922e935027ee2320d87bc4dc31ec37914dd0cf6844 cosign/main.go +cb9be7964dcd1acbde95b9cedc4d2425e1dc94c3e2e2668bebcd2ed9624795c1 cosign/attestation/verify_test.go +181473ba7df06a1db3daee1cf07660efe9c5d997e9f7c9ae4ef8a0ec31cd8932 cosign/dagger.json +7910468e658bc0ca74c563398623dad659ce9e4c5f896380349141920145ea1a cosign/main.go +866063328765c65cd8a5caef012d519499504f95de558b78f305fb9d80fd55f8 cosign/platform_sign.go 901c3ac8cf91649c2bebeaf9abeaf9372ae7c998dc29ef64697058d46ade1051 cosign/policy/attestation_gate.rego 2b69f6a327c02952411943153297a8d2d459dd59d9182bfdaae6b5d2b1dccf24 dast-scan/README.md -968c74fec476a5d372eef77510a899146328fc8396d3e350552c5a7467636585 dast-scan/dagger.json +e65ca2af20d70a03df056f1e35ff8b9f0f79a10724b161fc5a97456bef9da0e2 dast-scan/dagger.json 36fc6e8b38779f524945b68c81b01ebc5572770946712510df5ab8579c24fdfe dast-scan/main.go 115bdb4588a756d0090e73334a6fc5f2dc50a11e5075cf9c382d0a88eca86a24 db-migration/.gitattributes 35f95c7691a2e5e33ec7e3e0f203197cd120af831305add2a218b6c20353db8f db-migration/.gitignore 337f35bd196d4529c4b4019ff5b6d646ebad3567bdd9786166ffeb2f21d4ed93 db-migration/README.md -709c33b07c8a98a9f1f331a0de62f01801ed68c7ef1cb4427ba0dddaff0f6e86 db-migration/dagger.json +0a2a8e654c38a144e04105aa2fec28b3f6e5ef9b7eaf50c391112d7d2d3b764d db-migration/dagger.json dd5b1d4ec8d5b5bd712952442afd30241ef5a6aaa313c577d3ef1e9a3fa1ab45 db-migration/engine/capabilities.json 364beb9ae3d287a7f3ab6be76da158073efdbbe408080c10ab7c73f89d0eb81f db-migration/engine/engine.go c4929c95c9a239edc244a09e12a538c8bed9cc317b57180def9d712f466c544f db-migration/engine/engine_test.go -f8016d0fc25ce29d83eaaeb7d3aff071e6c28c8a3c0b7b0475c6666b18cb152d db-migration/go.mod -f425201947ed2d4a7366b785ce49aa8af415c2d4713c4bf1c074148d0181c056 db-migration/go.sum +e4c0330f57ec238db6f776cacf36bb6630e0b8d97d037c04c4d22ee77420793f db-migration/go.mod +6c6439ee349a3ca0b8285535a71fdabac880a796a29888bd993f81273f011fb8 db-migration/go.sum b308dc787788e830a87fde0eb0e16c52f1b263b3debb509cbd4dcb61dcc0bb41 db-migration/main.go e59d813e03f8f2f31afeeb96fdd9d19b29a1c8f8d1201eada860963d96432319 db-migration/verdict/applied.go f7b837618fe461968315147ecf92c7c6b57f3f6dc144e3c6fa7cd898dd52101a db-migration/verdict/applied_test.go @@ -49,85 +52,109 @@ ae4288677470705fb79f26a05d30469b954272c43d4a81be212d6e05cbc3c91f db-migration/v 865d6de5b5504c9b684cce08a3ea6d6fc07950ed7fda6629140c72b5244ad198 db-migration/verdict/verdict.go e5cc829282064480917cf8a7846fd60de8c6b209df0f62fba978db9efa554872 db-migration/verdict/verdict_test.go 8e0b52db96cadd078cd639f7f0501f8c0ba88d03012e281ab001e23276539d0f deploy-k8s/README.md -4a9b2898f59cab5f2ddd71ff016462aa7134c66b32d17b5b0858703d22a726f1 deploy-k8s/dagger.json +a8172f7447a6a60786c70f0840af1c7e845499ef7db9485c45bc567c806b0b93 deploy-k8s/dagger.json 64bcc13f053ba830d922534279ec45b7fa18ffc2a9bd0df13452d13d39af0815 deploy-k8s/main.go 115bdb4588a756d0090e73334a6fc5f2dc50a11e5075cf9c382d0a88eca86a24 e2e-test/.gitattributes 35f95c7691a2e5e33ec7e3e0f203197cd120af831305add2a218b6c20353db8f e2e-test/.gitignore 19858aace660db871f6a0b40d4a0bc1d1cd977d0fca44ae2388a8e407bb32490 e2e-test/README.md -b614e9bdef898f34d7aa9bf82d5b8809f6fe4274cd059aaddf2a5af5de085410 e2e-test/dagger.json -df34f8d683caa208edbc6d9878f775b097131e1b38be0544c2df9a6322bce6a1 e2e-test/go.mod -1e583b017d02bac9507c27d00dc36affc434571bfbfe8867ece775feccfec463 e2e-test/go.sum +237aa16ee7dcf23cf72ed4a080f6aaf62521900d4a0778bf586e53058fd3e413 e2e-test/dagger.json +ddb8629578dc1ce3d5570e3d74169cd6d9188c72c55e0f04a4385e040200afa9 e2e-test/go.mod +6c6439ee349a3ca0b8285535a71fdabac880a796a29888bd993f81273f011fb8 e2e-test/go.sum fae1ce1efecdc12b8f3039f8f6dbd26e25cc0ebcce678c935aed989588437545 e2e-test/main.go -4942f899802d862f8d66c32270150fd57ff5dde41188843ff133ceb537540e7c iac-scan/README.md -33599562a94b863bc3ced0d4bac9becfa639ac1db5f2e5e8b18431a606d94654 iac-scan/dagger.json -7a5635226597f47e21668b81e73508fd05473d7fba70ef81f5a7908160169fe5 iac-scan/main.go +38efd610f138637105483356a4b15f6d9bd03f5e94248d0c22d7363b16ea8b49 iac-scan/README.md +aeff4542a163c87eb70f7f7567136716c11d77086c2ee73f430f45e3a9801bcd iac-scan/dagger.json +61b63922cffea42260c87514cfc8e49f37e35f57d73d9f7de24e3e4ebf0301f2 iac-scan/main.go +bcb009d9fe6c0ebdcb05ea1a132229a297ae631bd801863756b3891af71a20bf iac-scan/scanofrecord.go +0b87addddd042f75ef9ed615f5ca87443518be64d83e5a986c988d50ed32e95b iac-scan/scanofrecord_test.go e6bd0de50d3dc45e9d5446c28b1249d3471c4a38c12bc23bc580d639d0e0e2b8 license-scan/README.md -5348014cc6d56cccb668d0a507201b4dc2b5c9ea4f31e99a88a903c060375266 license-scan/dagger.json -9abdc96226ab7150694be5bcde70a9be1008b906bb7f3f609bdb7e7e103847f6 license-scan/main.go +a99ac52f329be179a5f4f2857417ef6030f73a59bdf2abd32a663323307359b1 license-scan/dagger.json +e017d60f6220d3fdaca039f1c9f1f785678f605bc6fd58046d4d68ce07a73cdd license-scan/main.go +62af1e8e23d1989710f60e0d81732e203c02c9903bc9cecdbe1249e6a030fe5b license-scan/report.go +de9cfd90f880fe90f8a73d381dbf76bd303c7a6f752ddb86d7c6f432a270af6a license-scan/report_test.go +bcb009d9fe6c0ebdcb05ea1a132229a297ae631bd801863756b3891af71a20bf license-scan/scanofrecord.go +ffdc5096cbda6150955a7c869f1d3f9add09f3001a9c8e3d2187bc139f37cf3a license-scan/scanofrecord_test.go 58757ea49fa6ee753ab0187d0f94fb5f8bbd3294862330ffc569ad84c291c1d6 malware-scan/README.md -a01305371eac283b32e57885ad04c624d42d46eea3fba6e17cb2434ba8d0bd75 malware-scan/dagger.json +71ca4bfc644281dab6c862b1ed5c9c5d96dc5ee0514a76e7b685fdbd1179b5fd malware-scan/dagger.json 991b2ca316bc15089f8e8eb8633e52059eac4d77126dad638b3ec0363bfa4ea7 malware-scan/main.go 216760c5154c216bbe668c8fac34067ae2b7f881c67da9594cf6515fa7f7f24a mobile-android/README.md -2b08bdfeffda3b978a7d56887dfd59f54a6a56492f3092894c3d469d7fcb8fac mobile-android/dagger.json +235753794bce158530211c65b8c02650a327d5f0b955d0aedc3107f7823e2352 mobile-android/dagger.json fe4bb56d5479abfce33b984bfbc234386f7847e93108d37543c6004d84d7c44d mobile-android/main.go 40d57ac8f3ff98f55181d37295b2e140824b7dcb5aa64341c735763588722439 mobile-flutter/README.md -00160c3a8cb4d70b4edbba4b4ff70ad94ade7e01a97d7642560c296a416154af mobile-flutter/dagger.json +802521ebd80a41676f7f3f86fc19fbd384fe3d31b1939d731484971572bfb59f mobile-flutter/dagger.json 110f7fea48f166d4d6fdaa1f8ce02d67193a82b75a4bb8b48c7b00398b0ba971 mobile-flutter/main.go 5d510d06d9e53b378cbca3f7fe54b96d66f6de0c02b8b054a00080a825212137 mobile-ios/README.md -9e0cd0686a74f30d5f6d6563fe0aeb41b253b2f280df77db251dc6514e37a855 mobile-ios/dagger.json +49689e9249b7c130859bac14944f5e391f98c991c9be3342c131fbd443bc07e5 mobile-ios/dagger.json 399134ece3e1db34369d16b014db467e602cf5da28709752acb7a97a134fd68f mobile-ios/main.go 87f8081b4a9f4db6c0e8f88c7657d98c793ab95b991931c450e0c94869a1f2ef mobile-security-scan/README.md -38db76f440af901337d6e14fd4324780e18f7faffddb4ca89012c9eaa8d2547c mobile-security-scan/dagger.json +58f4cabdb22eaaa216f4fded88eb7cce947de09ae639e88471bac1cd4acf8ee8 mobile-security-scan/dagger.json 80770bd49be0b15bdd49c685153879dcf321624a86908f192b754a88d0f19fa2 mobile-security-scan/main.go ca50162a4bcf9d7d89a38560bc893997989487b416e8d399dd139235eb23f477 model-scan/README.md -398a1764937829391271d6161d13fb8a07797c29f13ec88854ff53a49aa6c8a7 model-scan/dagger.json +211d79c47f2cfc6536aaee261505bec5615421b10942cb98a397f83e08a2e8b0 model-scan/dagger.json ef13e2d03862b8963e4040fbbdeca9642444cefab6fa4e8c7feee6f927458d3e model-scan/main.go 115bdb4588a756d0090e73334a6fc5f2dc50a11e5075cf9c382d0a88eca86a24 perf-test/.gitattributes 35f95c7691a2e5e33ec7e3e0f203197cd120af831305add2a218b6c20353db8f perf-test/.gitignore a3b0128b0294ba7ffd01ad4488849a1a2014af6999d212d2ceec7a6c1943e7f5 perf-test/README.md -a4f93086fafd1e8b1b4fb20bc042e6bf2deffc188a65645e70663f986cfdf83c perf-test/dagger.json -794718a5ad23894b33bb2c02fe211a2af28aeb6f6b6032e336830a402ddc316e perf-test/go.mod -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perf-test/go.sum +014669389b1e85570e09423274837d572e6e7e62f86ee32a8820878f13e8e837 perf-test/dagger.json +97cbe97c75e4a0ea7bb8af394e321f8547d64d3e57743e305e9803d90d3aa5a3 perf-test/go.mod +6c6439ee349a3ca0b8285535a71fdabac880a796a29888bd993f81273f011fb8 perf-test/go.sum d2928ffd6bcaf82b8f11810517e6839836f3d77caa644ab18da10b1120b055cd perf-test/main.go +36563ee5354104283995bff5bb2fe0765f4cca4929f5ba965ef48b0ab062d124 prebuild-check/dagger.json +d829052abc31382543dc06d04d30654415ab576c7d8165ca818a6c941f992a00 prebuild-check/lockfile.go +57e78c449a261e65f069ffea9a29713239f67ba5eb51bb91ff8ef2ef6fd531ce prebuild-check/main.go +ed69713e644f152af31869034a9c29b9e5c413b1abb5d4b99cd1156f968894b6 prebuild-check/pinning.go +47d14a3d23c6f72f2ce56ce29d22d0c95cc433cef703969c15ec710a62982502 prebuild-check/prebuild_test.go +7f734196f0337dce613733469438a429244d3eb8f43c8e8606a94996701a9adf prebuild-check/report.go f9af9f765929bd93a22fef8041716fa496ff767f7e9f3643f1a16a963a33f46e release/README.md -8c46148d2e026fd3c4fd2a7edbfc1d90fd118ae5388788ca7be7b93ed6d718cc release/dagger.json +1582e9c1416a445bf4694ac18ff8b382db7dadd6e0a258328e13a81e5b996931 release/dagger.json 93df7b20d51c868a8fd931d345d4cb12c127b368594e3fcf17a52d59df3a0fac release/main.go -bc72516d95ed1b7bcdced0c44851add60e50ddabb10deedac2a12efad979a6c7 sast-scan/README.md -541774f2856c29b58e398b6372e13c0bf00708428dce145de5036bf5cccae856 sast-scan/dagger.json +4d06e8db9ed987776b8f51878ce6cb17933dbaa4dc615a1b0f605835c4400e9a sast-scan/README.md +32cf662594acff51aa9a360031c39585ae471b55c524976c808507259c2aa069 sast-scan/dagger.json 417571f8f7b301a967b1111623c6fcefec140c15dab453a4867bc2c97c18724d sast-scan/gate.go d59d142d4dd45fa8b88dbbeddc823b295837988d1e53697c33bb1d80aabc7b81 sast-scan/gate_test.go -7c851f2052519be229cd129369489919a8c583f8069b1d13fe48ccdccf33cd08 sast-scan/main.go +5c44bde4779f11f5ab8e031a319ca4275e19a2bbf406296753c99ba00bf1ca44 sast-scan/main.go 3f3393851222017215220595f0f5d64a1e3d80737359b5af68581570f0464fe7 sast-scan/qualitygate.go 01049098cdd9eca7dbba403048d00375403d8bc908d463204e7b5373daa24da9 sast-scan/qualitygate_test.go +f9040016c6e5bb084e771b732bb443bb3c1a71d1b06ef7cccd607ab91976afb0 sast-scan/record_test.go +c382f94c9fac3abecf83c3021eea8f296d485799403b672be75ace8122876d84 sast-scan/ruleset.go +47f83a65db18ca2c4507f7df3867f65d423fb10802f5636292ca966ddcb3edd5 sast-scan/ruleset_test.go +370cdc21e5b8dd14add49ce1183cdd9e73de2201fc1aa90aa0938710d6bf40dd sast-scan/semgrep_args.go +fea00fc1bc6a4964c769869dae886602db0ba39c6f6a1c074a1664c520616499 sast-scan/semgrep_args_test.go 8ea5387206da3d738c1be264f2e3981c0f7c72339dc0de5ec9b9159012e79f94 sbom/README.md -6cb4a1ec6f25f79d6793e90251661c193e6ce699300effcf7eb442fe176f1615 sbom/dagger.json -8601ef0ffd9ff5b8bcf8efdaac262532027d08ca502364a340c5291479f05143 sbom/main.go +480bab901cc463118e25c210893ee403a2644ad8f68378b25cbbd20e800730fd sbom/dagger.json +4ab7994ad8f262935bb251f3c04035f314afde5483ba3eadf0846eae16441e89 sbom/main.go 94c17dc2b770dc38bea8587fcbed8ef1f89329aaa122cb24eb147c71d3dad551 sbom/pullauth/pullauth.go 9aca87f5be9e90e3fb8204d5891a3d2707b7c67035d6b8301e4de80834dbd68c sbom/pullauth/pullauth_test.go 66beccb4d75bf7f615aa68d657b81298067fb27a59ee76fce8a6fbf47685e7cb secret-scan/README.md -37c26c209ef6347363573933d603ec08dfda91c28f46b83046aacf9967c9189b secret-scan/dagger.json +211988fc449ab348c86056414e0e5b56d2f5fddf11f9c14f0ccc8ea98b2ed40e secret-scan/dagger.json +9df5331b28cc1dfaa8f8ca4a936ebd24c9fd0cb142368cce036ea91be8b89e13 secret-scan/history.go +ffd129057be9d007462d1c8e3d988f36599a6035fcff7d092322c4c387cdc1c9 secret-scan/history_test.go dd4809b411a47584256cdafbc513ed2f9a1f2fe9c095381255ad8c8c008ada30 secret-scan/main.go e7b6c30c9fb134f75545152c1838eb50d1060c0c969b43b702e5bbb2091306c5 security-scan/README.md -8e0ad6f1e72a05f68dcf8ba6d956869713b79003bd2efe14737b0ded2fb183ba security-scan/dagger.json -c72e6ec4f2a20efbbcf0e04f46987d16370ceb99663c2906cc62b329bdd3524c security-scan/main.go +602069c7a9d3213218e23cc8b3079899e2e136cedf70bdb421d33a4d329b3ab7 security-scan/dagger.json +e99f35b4e924b2f8e88be172618d42e79648322d050e2cb416200aeb341ad82c security-scan/main.go +c82ff749d7cd81052ac19c8d24ad49e8a60b6de6807a7153972f85b9d5fae7f9 security-scan/main_test.go +b155edcc87c986254b21e456952fb1ed78fc1b025fcf482789acea62ef7f5aa5 security-scan/vulndb.go +15e65ee43e7d3d91e8462901bd836566e334e7638f21f3be180113d640992e97 security-scan/vulndb_test.go 9a828a3f0c429b665d9b9a99320cacee304b329dc8e53bb6d4e64507a78bf715 serverless-deploy/README.md -98bd2388654407772054c4114547a6a184410ad1e70f8efe6643698659fda0a4 serverless-deploy/dagger.json +908cf82da1718455477e2f98c743d17188b8151f399a4aebc47d41e848b8d22a serverless-deploy/dagger.json 9a7b016e9406f69492a4732ef2d488a5bed58d237be4ecc32b4917e181624772 serverless-deploy/main.go 77a690b5ef474f62433b52894f32862221aad9da0cab9eddfff576fa1950c380 standard-build/README.md -c89a76910e64e9d1b0b68a5a7cf9148a51ce5a0d936e0ae6e6d89d5cdbfb14d9 standard-build/dagger.json +ae2bfdcb63734577c43b3c868720e63ffb985501c1efa02027e1e9ba28a2645b standard-build/dagger.json 80c55b8d8cd15f03b8fef1b73df0121a28317caf8ee0832a2f86e3eb97cf5c8c standard-build/evidence/evidence.go -93bc41eb64ca62dbc6360de24035f1f7340595d8b8b8cbe0fc7585d2d98c9287 standard-build/evidence/evidence_test.go +3fc9d403a0d5bd282798aae30f1dbfaf04407d1c2aa7a8d03f68f8da166552ba standard-build/evidence/evidence_test.go 132a82b01c10d7e3ac92413b163052222b23b7f845874136a6ff353be9f166a3 standard-build/layout/ignore.go 47655a92bb52dc7f223e1e5e6bae6520138e83cb742455402170cd87add3522a standard-build/layout/ignore_test.go ae691a6a9f4fab2a0cc3a390f990b14feadb0e61a8990b6992a188b6c4823220 standard-build/layout/layout.go 20649ea9d8ae7c860c4ac46efd931505e6cdfd4772e2a0496b7ca9b5db88b069 standard-build/layout/layout_test.go -9688735098905b33d354dc8a6da916058c60daf78ebffeb6f72f8042254acd5d standard-build/main.go +3366321fae10e678de4c3b83fa5624a9fc238e2cbbbfdea4508ad0a06692f6ba standard-build/main.go +89dc267054af366d5cf7dcb7ec5bbcb132b6937ed24632cb39b68d081f7c1f16 standard-build/pushgate/pushgate.go +b5c2bf5ed35557ed94145cd064ff8a82f0d34e2e87dc9a0dbe87dee9f639fc07 standard-build/pushgate/pushgate_test.go e5b67487536c147595d1dd23b1b32535de9f4f7b67511cffbde4fb5305432381 static-deploy/README.md -0bc892038ac9fe670b0e6b09205d4ba2ca1a1fdb23d523b7112cc25f7a03207e static-deploy/dagger.json +7acf59006bb0143fd97086ee8f402ae0c952dd04b111ecf981bba0e6e2d39aca static-deploy/dagger.json 185d50220835de0a4fbcdffc127480f2fa15de9a9d7658a38cc8546b1b95c8d5 static-deploy/main.go dd3952beebba15befcf8003af5e7ce4d697dc8b4e4625cf98d3cfb57c92b41e9 vm-deploy/README.md -952849148e922b51a3effdc684a3c2c1493f8fc681a9b84608bb7fd93e3f8442 vm-deploy/dagger.json +162470a52ac81986c398735bae0b475c047033dd5929fab6b8ed06acf1b234b9 vm-deploy/dagger.json 94031f015b2acb852735f8188310f4403b10a7f824bdb8a5a3f8607894df407d vm-deploy/main.go b361683cbf5421743196df5d096e692c3f82a0fbd71efddd9f779340633bf77b windows-deploy/README.md -f57de9c93375770e8b31dc4cd0c2fc2f5518736ef664ac7c910ab99285b05845 windows-deploy/dagger.json +500ba960a0531c476387cebd8d99416161ecf8ec64b0d24a083404ebaee8682e windows-deploy/dagger.json 942d2bc371b1f198e389cdfaddacfcf696d8c8e5e826b039e4eb1861d79d931d windows-deploy/main.go diff --git a/ai-code-review/dagger.json b/ai-code-review/dagger.json index b19a841..3d17d51 100644 --- a/ai-code-review/dagger.json +++ b/ai-code-review/dagger.json @@ -1,6 +1,6 @@ { "name": "ai-code-review", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/container-paas-deploy/dagger.json b/container-paas-deploy/dagger.json index d8336e8..98bed87 100644 --- a/container-paas-deploy/dagger.json +++ b/container-paas-deploy/dagger.json @@ -1,6 +1,6 @@ { "name": "container-paas-deploy", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/contract-test/dagger.json b/contract-test/dagger.json index 4c5310c..dda2dae 100644 --- a/contract-test/dagger.json +++ b/contract-test/dagger.json @@ -1,6 +1,6 @@ { "name": "contract-test", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/contract-test/go.mod b/contract-test/go.mod index 18f8b31..86b5ae1 100644 --- a/contract-test/go.mod +++ b/contract-test/go.mod @@ -7,40 +7,40 @@ require ( github.com/dagger/otel-go v1.43.0 github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 github.com/vektah/gqlparser/v2 v2.5.32 - go.opentelemetry.io/otel v1.43.0 - go.opentelemetry.io/otel/trace v1.43.0 + go.opentelemetry.io/otel v1.45.0 + go.opentelemetry.io/otel/trace v1.45.0 ) require ( github.com/99designs/gqlgen v0.17.89 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/sosodev/duration v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.17.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 // indirect go.opentelemetry.io/otel/log v0.17.0 // indirect - go.opentelemetry.io/otel/metric v1.43.0 // indirect - go.opentelemetry.io/otel/sdk v1.43.0 + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/sdk v1.45.0 go.opentelemetry.io/otel/sdk/log v0.17.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect - go.opentelemetry.io/proto/otlp v1.9.0 // indirect - golang.org/x/net v0.57.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.opentelemetry.io/proto/otlp v1.11.0 // indirect + golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect - golang.org/x/text v0.40.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect - google.golang.org/grpc v1.82.1 // indirect + golang.org/x/text v0.41.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/grpc v1.83.2 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/contract-test/go.sum b/contract-test/go.sum index 1336182..5d9f65a 100644 --- a/contract-test/go.sum +++ b/contract-test/go.sum @@ -1,112 +1,193 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM= +cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/99designs/gqlgen v0.17.89 h1:KzEcxPiMgQoMw3m/E85atUEHyZyt0PbAflMia5Kw8z8= github.com/99designs/gqlgen v0.17.89/go.mod h1:GFqruTVGB7ZTdrf1uzOagpXbY7DrEt1pIxnTdhIbWvQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 h1:l7+6kwRMJNwdCvYdDl7Eax+wzEYHSnNY7zrrfbhDdTA= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM= github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs= github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU= +github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw= +github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/alexflint/go-arg v1.5.1 h1:nBuWUCpuRy0snAG+uIJ6N0UvYxpxA0/ghA/AaHxlT8Y= +github.com/alexflint/go-arg v1.5.1/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8= +github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= +github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= github.com/dagger/otel-go v1.43.0 h1:AYCnAamWmxtSxigWPTgC+8EWqiWPcDZEegh8y05gdJ8= github.com/dagger/otel-go v1.43.0/go.mod h1:83CTuXi70zcx1kaym5buqmb7RNzg1E9dEiQSFyLbLdU= github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 h1:g6vfdGRyz6fAjfHz5FyYPZgHy8qcQ31fHrBl1iCOzxw= github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59/go.mod h1:jsdUJeYzcbyK1j/EqMGPrQgNYxl/Zfg06vvM9C/xXxs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= -github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I= +github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= +github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao= +github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8= +github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc= +github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/logrusorgru/aurora/v4 v4.0.0 h1:sRjfPpun/63iADiSvGGjgA1cAYegEWMPCJdUpJYn9JA= +github.com/logrusorgru/aurora/v4 v4.0.0/go.mod h1:lP0iIa2nrnT/qoFXcOZSrZQpJ1o6n2CUf/hyHi2Q4ZQ= +github.com/matryer/moq v0.6.0 h1:FCccG09c3o4cg3gnrZ+7ty5Pa/sjmN24BMHp/0pwhjQ= +github.com/matryer/moq v0.6.0/go.mod h1:iEVhY/XBwFG/nbRyEf0oV+SqnTHZJ5wectzx7yT+y98= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sosodev/duration v1.4.0 h1:35ed0KiVFriGHHzZZJaZLgmTEEICIyt8Sx0RQfj9IjE= github.com/sosodev/duration v1.4.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4= +github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/urfave/cli/v3 v3.7.0 h1:AGSnbUyjtLiM+WJUb4dzXKldl/gL+F8OwmRDtVr6g2U= +github.com/urfave/cli/v3 v3.7.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/vektah/gqlparser/v2 v2.5.32 h1:k9QPJd4sEDTL+qB4ncPLflqTJ3MmjB9SrVzJrawpFSc= github.com/vektah/gqlparser/v2 v2.5.32/go.mod h1:c1I28gSOVNzlfc4WuDlqU7voQnsqI6OG2amkBAFmgts= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0 h1:ZVg+kCXxd9LtAaQNKBxAvJ5NpMf7LpvEr4MIZqb0TMQ= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0/go.mod h1:hh0tMeZ75CCXrHd9OXRYxTlCAdxcXioWHFIpYw2rZu8= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0 h1:djrxvDxAe44mJUrKataUbOhCKhR3F8QCyWucO16hTQs= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0/go.mod h1:dt3nxpQEiSoKvfTVxp3TUg5fHPLhKtbcnN3Z1I1ePD0= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0 h1:VO3BL6OZXRQ1yQc8W6EVfJzINeJ35BkiHx4MYfoQf44= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0/go.mod h1:qRDnJ2nv3CQXMK2HUd9K9VtvedsPAce3S+/4LZHjX/s= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0 h1:MMrOAN8H1FrvDyq9UJ4lu5/+ss49Qgfgb7Zpm0m8ABo= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0/go.mod h1:Na+2NNASJtF+uT4NxDe0G+NQb+bUgdPDfwxY/6JmS/c= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 h1:ao6Oe+wSebTlQ1OEht7jlYTzQKE+pnx/iNywFvTbuuI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0/go.mod h1:u3T6vz0gh/NVzgDgiwkgLxpsSF6PaPmo2il0apGJbls= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 h1:mq/Qcf28TWz719lE3/hMB4KkyDuLJIvgJnFGcd0kEUI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0/go.mod h1:yk5LXEYhsL2htyDNJbEq7fWzNEigeEdV5xBF/Y+kAv0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 h1:inYW9ZhgqiDqh6BioM7DVHHzEGVq76Db5897WLGZ5Go= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0/go.mod h1:Izur+Wt8gClgMJqO/cZ8wdeeMryJ/xxiOVgFSSfpDTY= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 h1:klTViGcsvLCd1xN3rZzfZ12NslC/OimbmR+k+A006RI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0/go.mod h1:jRsK04CWmXuY8A0O+wMpSf+t90RHZ53o5Qmxn2PQPfk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 h1:pnxy6c/kvNBWdNNFzqpjuJLm9Hjhgk/Q0nY221rwuk0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0/go.mod h1:qw6YsFapotRwoDhXRZvljzaOvCQB7UfnafEJagpN2TA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 h1:QRefszxJmfPdjXUUm3j6iDzY03mTPXMjqErFqQ67vUg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0/go.mod h1:Tiz03lTBVBrm7eWZBOidzEaYaJa8tjwGUGv6d8mlTyk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 h1:fG5MCxGz8+2VtrN/WgqSpJFctVz24gpxj8CxkKmc8Ww= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0/go.mod h1:BmAYTn+3ysbRe+IU2msxmf5Rx3g6DHvex+tWI3LdhYI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 h1:QBajQ2SrwQijzHyZbQlPsuIzpl/ll8DY6wPWsajeGcI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0/go.mod h1:08ZQLjrPLQ6R4kAXvuOvODEer5Yh4CoFvll5qB2BCI8= go.opentelemetry.io/otel/log v0.16.0 h1:DeuBPqCi6pQwtCK0pO4fvMB5eBq6sNxEnuTs88pjsN4= go.opentelemetry.io/otel/log v0.16.0/go.mod h1:rWsmqNVTLIA8UnwYVOItjyEZDbKIkMxdQunsIhpUMes= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= -go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/metric/x v0.67.0 h1:PcicCNZFkZ4bXfSooXdo3WN7RBOVOtjVdo1wD358Uns= +go.opentelemetry.io/otel/metric/x v0.67.0/go.mod h1:FBjCWZe6wgcqxcMtjdGiClDKXb2YxxXii0CXftE4QtI= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= go.opentelemetry.io/otel/sdk/log v0.16.0 h1:e/b4bdlQwC5fnGtG3dlXUrNOnP7c8YLVSpSfEBIkTnI= go.opentelemetry.io/otel/sdk/log v0.16.0/go.mod h1:JKfP3T6ycy7QEuv3Hj8oKDy7KItrEkus8XJE6EoSzw4= go.opentelemetry.io/otel/sdk/log/logtest v0.16.0 h1:/XVkpZ41rVRTP4DfMgYv1nEtNmf65XPPyAdqV90TMy4= go.opentelemetry.io/otel/sdk/log/logtest v0.16.0/go.mod h1:iOOPgQr5MY9oac/F5W86mXdeyWZGleIx3uXO98X2R6Y= -go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= -go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= -go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= -go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= +go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= -gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= -gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= -google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 h1:tu/dtnW1o3wfaxCOjSLn5IRX4YDcJrtlpzYkhHhGaC4= -google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171/go.mod h1:M5krXqk4GhBKvB596udGL3UyjL4I1+cTbK0orROM9ng= -google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 h1:yQugLulqltosq0B/f8l4w9VryjV+N/5gcW0jQ3N8Qec= -google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478/go.mod h1:C6ADNqOxbgdUUeRTU+LCHDPB9ttAMCTff6auwCVa4uc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= -google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= -google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= -google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= +google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cosign/README.md b/cosign/README.md index 0279978..437a214 100644 --- a/cosign/README.md +++ b/cosign/README.md @@ -49,7 +49,7 @@ timestamp (SET) against the Rekor keys it trusts — Sigstore's unless `--rekor-public-key` (fail closed, with an error naming the missing flag) instead of failing later with one that reads like a bad signature. Signing functions accept the key and pass it on; they do not require it. Not yet -measured against cosign v2.4.1 on a real private Rekor (staging test plan). +measured against cosign v2.4.1 on a real private Rekor (the module image is v3.1.4 since 2026-11-04, with v2 signing defaults restored by COSIGN_USE_SIGNING_CONFIG=false / COSIGN_NEW_BUNDLE_FORMAT=false; re-measure on staging) (staging test plan). Sign and verify must make the **same** choice. In the rendered Jenkins pipelines the tenant opts in per pipeline with the `spec.pipeline.overrides` keys diff --git a/cosign/attestation/attestation.go b/cosign/attestation/attestation.go index 7c46e16..5cdeb9c 100644 --- a/cosign/attestation/attestation.go +++ b/cosign/attestation/attestation.go @@ -13,7 +13,7 @@ // do not pass a statement. It replaces a template that shipped literal // `${BUILD_STARTED_ON}` / `${ACTOR_ID}` placeholders nothing ever // expanded, labelled a commit id as `sha1` after stripping `sha256:`, and -// claimed `dagger v0.15.0` while every module pins v0.21.7. +// claimed `dagger v0.15.0` while every module pinned v0.21.7. package attestation import ( diff --git a/cosign/attestation/attestation_test.go b/cosign/attestation/attestation_test.go index c5f8f08..b68f9c8 100644 --- a/cosign/attestation/attestation_test.go +++ b/cosign/attestation/attestation_test.go @@ -92,7 +92,7 @@ func validInput() ProvenanceInput { SourceURI: "git+https://github.com/acme/app@refs/tags/v1.2.3", SourceDigest: "sha256:" + commit, // what the old docstring told callers to pass InvocationID: "123", - EngineVersion: "v0.21.7", + EngineVersion: "v0.21.11", Now: time.Date(2026, 10, 11, 8, 0, 0, 0, time.UTC), } } @@ -115,7 +115,7 @@ func TestProvenancePredicateHasNoPlaceholders(t *testing.T) { if !strings.Contains(s, `"startedOn": "2026-10-11T08:00:00Z"`) { t.Fatalf("defaulted timestamp missing:\n%s", s) } - if strings.Contains(s, "v0.15.0") || !strings.Contains(s, "v0.21.7") { + if strings.Contains(s, "v0.15.0") || !strings.Contains(s, "v0.21.11") { t.Fatalf("engine version wrong:\n%s", s) } } diff --git a/cosign/attestation/platformsign.go b/cosign/attestation/platformsign.go new file mode 100644 index 0000000..1072f0b --- /dev/null +++ b/cosign/attestation/platformsign.go @@ -0,0 +1,128 @@ +package attestation + +// Pure helpers for `platform-sign` (ADR-0093 §5, WP-07): the request the sign +// step sends to the platform, and the checks on the platform's answer before +// `cosign attach signature` publishes it. Standard library only. + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "regexp" + "strings" +) + +// PlatformSignPath is the platform route, with the digest as one path segment. +const PlatformSignPath = "/api/v1/artifacts/%s/sign" + +var ( + platformDigestRE = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`) + // The API's own patterns (app/security/schemas/platform_signing.py). + platformVersionRE = regexp.MustCompile(`^[A-Za-z0-9_][A-Za-z0-9._-]{0,127}$`) + platformRepositoryRE = regexp.MustCompile(`^[a-z0-9][a-z0-9.:/_-]{2,254}$`) + platformServiceRE = regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`) + // A problem `type` URI's last segment: what a refusal is called. + problemSlugRE = regexp.MustCompile(`[a-z0-9-]{1,80}$`) +) + +// PlatformSignRequest returns the JSON body of the sign request, after checking +// every value against the API's own grammar (so a refusal is about the image, +// never about a malformed call). +func PlatformSignRequest(serviceID, version, repository, digest string) ([]byte, error) { + if !platformDigestRE.MatchString(digest) { + return nil, fmt.Errorf("--image-digest %q is not sha256:<64 hex>", digest) + } + if !platformServiceRE.MatchString(serviceID) { + return nil, fmt.Errorf("--service-id %q is not a UUID", serviceID) + } + if !platformVersionRE.MatchString(version) { + return nil, fmt.Errorf("--version %q is not an image tag or commit", version) + } + if !platformRepositoryRE.MatchString(repository) || strings.ContainsAny(repository, "@") { + return nil, fmt.Errorf("--repository %q must be a lower-case registry/path with no tag or digest", repository) + } + return json.Marshal(map[string]string{ + "service_id": serviceID, + "version": version, + "repository": repository, + }) +} + +// PlatformSignature is what `cosign attach signature` needs from the answer. +type PlatformSignature struct { + // Payload is the exact simple-signing payload the platform signed. + Payload []byte + // SignatureB64 is the base64 signature over SHA-256(Payload). + SignatureB64 string + KeyFingerprint string +} + +// ParsePlatformSignature judges the platform's answer to a sign request. +// +// Anything but 200 is a refusal and an error naming the HTTP status and the +// problem slug (never the request's token). A 200 is accepted only when it is +// about the digest that was asked for, its payload is the cosign simple-signing +// payload for that SAME digest, and the signature is base64: a payload about +// another image must never be attached to this one. +func ParsePlatformSignature(status int, body []byte, digest string) (*PlatformSignature, error) { + if status != 200 { + var problem struct { + Type string `json:"type"` + Detail any `json:"detail"` + } + _ = json.Unmarshal(body, &problem) + slug := problemSlugRE.FindString(problem.Type) + detail := fmt.Sprint(problem.Detail) + if problem.Detail == nil { + detail = "" + } + if len(detail) > 300 { + detail = detail[:300] + } + if status == 0 { + return nil, fmt.Errorf("NOT signed: the platform did not answer") + } + return nil, fmt.Errorf("NOT signed (HTTP %d %s): %s", status, slug, detail) + } + var answer struct { + ImageDigest string `json:"image_digest"` + Payload string `json:"payload"` + Signature string `json:"signature"` + KeyFingerprint string `json:"key_fingerprint"` + } + if err := json.Unmarshal(body, &answer); err != nil { + return nil, fmt.Errorf("NOT signed: the platform's answer is not JSON: %w", err) + } + if answer.ImageDigest != digest { + return nil, fmt.Errorf("NOT signed: the platform signed %q, not %q", answer.ImageDigest, digest) + } + payload, err := base64.StdEncoding.DecodeString(answer.Payload) + if err != nil { + return nil, fmt.Errorf("NOT signed: the payload is not base64: %w", err) + } + var doc struct { + Critical struct { + Image struct { + Digest string `json:"docker-manifest-digest"` + } `json:"image"` + Type string `json:"type"` + } `json:"critical"` + } + if err := json.Unmarshal(payload, &doc); err != nil { + return nil, fmt.Errorf("NOT signed: the payload is not a simple-signing document: %w", err) + } + if doc.Critical.Image.Digest != digest { + return nil, fmt.Errorf("NOT signed: the payload names %q, not %q", doc.Critical.Image.Digest, digest) + } + if doc.Critical.Type != "cosign container image signature" { + return nil, fmt.Errorf("NOT signed: the payload type %q is not a cosign image signature", doc.Critical.Type) + } + if _, err := base64.StdEncoding.DecodeString(answer.Signature); err != nil || answer.Signature == "" { + return nil, fmt.Errorf("NOT signed: the signature is not base64") + } + return &PlatformSignature{ + Payload: payload, + SignatureB64: answer.Signature, + KeyFingerprint: answer.KeyFingerprint, + }, nil +} diff --git a/cosign/attestation/platformsign_test.go b/cosign/attestation/platformsign_test.go new file mode 100644 index 0000000..7a67388 --- /dev/null +++ b/cosign/attestation/platformsign_test.go @@ -0,0 +1,121 @@ +package attestation + +import ( + "encoding/base64" + "encoding/json" + "strings" + "testing" +) + +// MUTATION-CHECK (staging, both directions; each must FAIL, not error): +// - ParsePlatformSignature skips the image_digest comparison → +// TestAnAnswerAboutAnotherDigestIsNotAttached FAILS; +// - it skips the payload digest comparison → +// TestAPayloadAboutAnotherImageIsNotAttached FAILS; +// - it treats any 2xx (or 0) as signed → TestARefusalNamesTheSlugAndSignsNothing FAILS; +// - tighten the repository grammar to `[a-z0-9./-]` (drop `:`) → +// TestLegitimateRequestsAreAccepted FAILS on the `host:5000/...` case; +// - loosen PlatformSignRequest to accept any repository → +// TestUnsafeRequestValuesAreRefused FAILS. + +const goodDigest = "sha256:" + "ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12ab12" +const otherDigest = "sha256:" + "cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34cd34" +const svc = "66666666-7777-4888-9999-000000000000" + +func payloadFor(digest string) string { + doc := map[string]any{ + "critical": map[string]any{ + "identity": map[string]string{"docker-reference": "registry.acme.test/shop/api"}, + "image": map[string]string{"docker-manifest-digest": digest}, + "type": "cosign container image signature", + }, + "optional": nil, + } + raw, _ := json.Marshal(doc) + return base64.StdEncoding.EncodeToString(raw) +} + +func answer(t *testing.T, imageDigest, payloadDigest string) []byte { + t.Helper() + raw, err := json.Marshal(map[string]any{ + "image_digest": imageDigest, + "payload": payloadFor(payloadDigest), + "signature": base64.StdEncoding.EncodeToString([]byte("der-signature")), + "key_fingerprint": "fp", + "key_version": 1, + "public_key_pem": "-----BEGIN PUBLIC KEY-----", + }) + if err != nil { + t.Fatal(err) + } + return raw +} + +func TestLegitimateRequestsAreAccepted(t *testing.T) { + for _, repo := range []string{ + "registry.acme.test/shop/api", + "registry.acme.test:5000/repository/docker/shop-api", + "10.0.0.5:8082/team/svc_name", + } { + body, err := PlatformSignRequest(svc, "3f1c30981b56", repo, goodDigest) + if err != nil { + t.Fatalf("%s: %v", repo, err) + } + var got map[string]string + if err := json.Unmarshal(body, &got); err != nil || got["repository"] != repo || got["service_id"] != svc { + t.Fatalf("%s: body %s", repo, body) + } + } +} + +func TestUnsafeRequestValuesAreRefused(t *testing.T) { + cases := []struct{ svc, version, repo, digest string }{ + {svc, "v1", "registry.acme.test/shop/api", "sha256:short"}, + {svc, "v1", "registry.acme.test/shop/api@sha256:x", goodDigest}, + {svc, "v1", "registry.acme.test/shop/api;id", goodDigest}, + {svc, "v1", "Registry.acme.test/Shop", goodDigest}, + {svc, "v1;rm", "registry.acme.test/shop/api", goodDigest}, + {"not-a-uuid", "v1", "registry.acme.test/shop/api", goodDigest}, + } + for _, c := range cases { + if _, err := PlatformSignRequest(c.svc, c.version, c.repo, c.digest); err == nil { + t.Fatalf("accepted %+v", c) + } + } +} + +func TestAMatchingAnswerIsAttached(t *testing.T) { + sig, err := ParsePlatformSignature(200, answer(t, goodDigest, goodDigest), goodDigest) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(sig.Payload), goodDigest) || sig.SignatureB64 == "" { + t.Fatalf("%+v", sig) + } +} + +func TestAnAnswerAboutAnotherDigestIsNotAttached(t *testing.T) { + if _, err := ParsePlatformSignature(200, answer(t, otherDigest, otherDigest), goodDigest); err == nil { + t.Fatal("an answer about another digest was accepted") + } +} + +func TestAPayloadAboutAnotherImageIsNotAttached(t *testing.T) { + if _, err := ParsePlatformSignature(200, answer(t, goodDigest, otherDigest), goodDigest); err == nil { + t.Fatal("a payload about another image was accepted") + } +} + +func TestARefusalNamesTheSlugAndSignsNothing(t *testing.T) { + body := []byte(`{"type":"https://integraci.co/problems/signing-verdict-block","title":"Signing Refused","status":409,"detail":"cve blocks"}`) + _, err := ParsePlatformSignature(409, body, goodDigest) + if err == nil || !strings.Contains(err.Error(), "signing-verdict-block") || !strings.Contains(err.Error(), "409") { + t.Fatalf("got %v", err) + } + if _, err := ParsePlatformSignature(0, nil, goodDigest); err == nil { + t.Fatal("no answer was taken as signed") + } + if _, err := ParsePlatformSignature(202, answer(t, goodDigest, goodDigest), goodDigest); err == nil { + t.Fatal("a non-200 answer was taken as signed") + } +} diff --git a/cosign/attestation/verify_test.go b/cosign/attestation/verify_test.go index c84a1fa..9c42704 100644 --- a/cosign/attestation/verify_test.go +++ b/cosign/attestation/verify_test.go @@ -86,7 +86,7 @@ func statementJSON(t *testing.T, o stOpts) []byte { "resolvedDependencies": deps, }, "runDetails": map[string]any{ - "builder": map[string]any{"id": o.builder, "version": map[string]string{"dagger-engine": "v0.21.7"}}, + "builder": map[string]any{"id": o.builder, "version": map[string]string{"dagger-engine": "v0.21.11"}}, "metadata": map[string]string{"invocationId": "42"}, }, }, diff --git a/cosign/dagger.json b/cosign/dagger.json index 06add76..46a7150 100644 --- a/cosign/dagger.json +++ b/cosign/dagger.json @@ -1,6 +1,6 @@ { "name": "cosign", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, @@ -11,6 +11,8 @@ "./attestation/gate.go", "./attestation/verify.go", "./attestation/tlog.go", - "./policy/attestation_gate.rego" + "./policy/attestation_gate.rego", + "./platform_sign.go", + "./attestation/platformsign.go" ] } diff --git a/cosign/main.go b/cosign/main.go index 76ca78d..31029fc 100644 --- a/cosign/main.go +++ b/cosign/main.go @@ -49,7 +49,7 @@ const opaImage = "openpolicyagent/opa:1.0.0" // daggerEngineVersion is the engine every module's dagger.json pins; recorded // as the provenance builder version. Before #2143 this said v0.15.0. -const daggerEngineVersion = "v0.21.7" +const daggerEngineVersion = "v0.21.11" // Cosign is the IntegraCI artifact signing module. type Cosign struct{} @@ -79,9 +79,18 @@ type VerifyResult struct { // runs don't pollute each other's keychain / SIGSTORE_* state. func (m *Cosign) cosignContainer() *dagger.Container { return dag.Container(). - From("gcr.io/projectsigstore/cosign:v2.4.1"). + From("gcr.io/projectsigstore/cosign:v3.1.4"). WithEnvVariable("HOME", "/tmp/cosign-home"). - WithEnvVariable("COSIGN_YES", "true") // non-interactive + WithEnvVariable("COSIGN_YES", "true"). // non-interactive + // cosign v3 (2026-11-04 bump, docs/security/vuln-remediation-20261104.md) + // defaults to a TUF-fetched signing config, which REFUSES the keyed + // `--tlog-upload=false` this module signs with (v3.1.4 + // signcommon.ValidateSigningOptions) and fetches from the public TUF root + // on every call. cosign reads every flag from COSIGN_ (options/ + // root.go BindViper), and an explicit flag still wins: these two keep + // the v2.4.1 behaviour every caller and verifier here was written for. + WithEnvVariable("COSIGN_USE_SIGNING_CONFIG", "false"). + WithEnvVariable("COSIGN_NEW_BUNDLE_FORMAT", "false") } // Sign signs a container image with Cosign. diff --git a/cosign/platform_sign.go b/cosign/platform_sign.go new file mode 100644 index 0000000..15ba91d --- /dev/null +++ b/cosign/platform_sign.go @@ -0,0 +1,111 @@ +package main + +// PlatformSign: the pipeline's sign step under platform-held signing +// (ADR-0093 §5, WP-07). The private key never leaves the platform's OpenBao; +// this step asks the platform to sign ONE pushed digest and attaches the +// answer with `cosign attach signature`. + +import ( + "bytes" + "context" + "dagger/cosign/attestation" + "dagger/cosign/internal/dagger" + "fmt" + "io" + "net/http" + "strings" + "time" +) + +// PlatformSign asks IntegraCI to sign `@` with the +// tenant's platform-held key, then attaches that signature to the image. +// +// The call is `POST /api/v1/artifacts//sign` with +// `{service_id, version, repository}` and the `ci-sign:` token +// (`--token`, scope `artifacts:sign`, bound to the service). The platform +// signs only a digest its own registry read ties to the version's tag, with an +// analysis-of-record image scan of that version and no `block`/`unknown` in +// the security verdict. Any refusal FAILS this call ("NOT signed (HTTP 409 +// signing-...)"), so a pipeline whose push was refused, or whose image is +// blocked, carries no signature. +// +// Before attaching, the answer is checked: it must be about the digest that +// was asked for and its payload must name that digest. Nothing goes to a +// transparency log; the platform's own verifier reads the signature with the +// tenant's public key (GET /api/v1/artifact-attestations/custody). +// +// +cache="never" +func (m *Cosign) PlatformSign( + ctx context.Context, + // IntegraCI API base URL + apiURL string, + // The `ci-sign:` token (INTEGRACI_SIGN_TOKEN) + token *dagger.Secret, + serviceID string, + // The commit or image tag the image was built as (its scans are filed under it) + version string, + // registry/path of the pushed image, no tag and no digest + repository string, + // The pushed digest, sha256: (the archive digest push-archive verified) + imageDigest string, + // Registry username, so cosign can push the signature + // +optional + registryUsername string, + // Registry password/token for --registry-username + // +optional + registryPassword *dagger.Secret, + // The registry is served over plain HTTP / self-signed TLS + // +optional + registryInsecure bool, +) (string, error) { + body, err := attestation.PlatformSignRequest(serviceID, version, repository, imageDigest) + if err != nil { + return "", err + } + if strings.TrimSpace(apiURL) == "" || token == nil { + return "", fmt.Errorf("NOT signed: no --api-url or --token (the platform holds the key)") + } + tokenStr, err := token.Plaintext(ctx) + if err != nil { + return "", fmt.Errorf("read token secret: %w", err) + } + endpoint := strings.TrimRight(apiURL, "/") + fmt.Sprintf(attestation.PlatformSignPath, imageDigest) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, bytes.NewReader(body)) + if err != nil { + return "", fmt.Errorf("build request: %w", err) + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer "+tokenStr) + status, answer := 0, []byte(nil) + client := &http.Client{Timeout: 60 * time.Second} + if resp, err := client.Do(req); err == nil { + status = resp.StatusCode + answer, _ = io.ReadAll(io.LimitReader(resp.Body, 64<<10)) + resp.Body.Close() + } + sig, err := attestation.ParsePlatformSignature(status, answer, imageDigest) + if err != nil { + return "", err + } + ref := repository + "@" + imageDigest + c, err := withRegistryAuth(ctx, m.cosignContainer(), ref, registryUsername, registryPassword) + if err != nil { + return "", err + } + args := []string{ + "cosign", "attach", "signature", + "--payload", "/tmp/sign/payload.json", + "--signature", "/tmp/sign/signature.b64", + } + args = append(args, insecureRegistryArgs(registryInsecure)...) + args = append(args, ref) + _, err = c. + WithNewFile("/tmp/sign/payload.json", string(sig.Payload)). + WithNewFile("/tmp/sign/signature.b64", sig.SignatureB64). + WithExec(args). + Sync(ctx) + if err != nil { + return "", fmt.Errorf("cosign attach signature failed: %w", err) + } + return fmt.Sprintf("signed %s (platform key %s)\n", ref, sig.KeyFingerprint), nil +} diff --git a/dast-scan/dagger.json b/dast-scan/dagger.json index 1d586c8..166ced5 100644 --- a/dast-scan/dagger.json +++ b/dast-scan/dagger.json @@ -1,6 +1,6 @@ { "name": "dast-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/db-migration/dagger.json b/db-migration/dagger.json index 9acad26..9c71881 100644 --- a/db-migration/dagger.json +++ b/db-migration/dagger.json @@ -1,6 +1,6 @@ { "name": "db-migration", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/db-migration/go.mod b/db-migration/go.mod index feb19a7..e78aa3b 100644 --- a/db-migration/go.mod +++ b/db-migration/go.mod @@ -7,40 +7,40 @@ require ( github.com/dagger/otel-go v1.43.0 github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 github.com/vektah/gqlparser/v2 v2.5.32 - go.opentelemetry.io/otel v1.43.0 - go.opentelemetry.io/otel/trace v1.43.0 + go.opentelemetry.io/otel v1.45.0 + go.opentelemetry.io/otel/trace v1.45.0 ) require ( github.com/99designs/gqlgen v0.17.89 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/sosodev/duration v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.17.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 // indirect go.opentelemetry.io/otel/log v0.17.0 // indirect - go.opentelemetry.io/otel/metric v1.43.0 // indirect - go.opentelemetry.io/otel/sdk v1.43.0 + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/sdk v1.45.0 go.opentelemetry.io/otel/sdk/log v0.17.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect - go.opentelemetry.io/proto/otlp v1.9.0 // indirect - golang.org/x/net v0.51.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.34.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect - google.golang.org/grpc v1.79.3 // indirect + go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.opentelemetry.io/proto/otlp v1.11.0 // indirect + golang.org/x/net v0.58.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/text v0.41.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/grpc v1.83.2 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/db-migration/go.sum b/db-migration/go.sum index 4bb39e6..5d9f65a 100644 --- a/db-migration/go.sum +++ b/db-migration/go.sum @@ -1,97 +1,193 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM= +cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/99designs/gqlgen v0.17.89 h1:KzEcxPiMgQoMw3m/E85atUEHyZyt0PbAflMia5Kw8z8= github.com/99designs/gqlgen v0.17.89/go.mod h1:GFqruTVGB7ZTdrf1uzOagpXbY7DrEt1pIxnTdhIbWvQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 h1:l7+6kwRMJNwdCvYdDl7Eax+wzEYHSnNY7zrrfbhDdTA= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM= github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs= github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU= +github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw= +github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/alexflint/go-arg v1.5.1 h1:nBuWUCpuRy0snAG+uIJ6N0UvYxpxA0/ghA/AaHxlT8Y= +github.com/alexflint/go-arg v1.5.1/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8= +github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= +github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= github.com/dagger/otel-go v1.43.0 h1:AYCnAamWmxtSxigWPTgC+8EWqiWPcDZEegh8y05gdJ8= github.com/dagger/otel-go v1.43.0/go.mod h1:83CTuXi70zcx1kaym5buqmb7RNzg1E9dEiQSFyLbLdU= github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 h1:g6vfdGRyz6fAjfHz5FyYPZgHy8qcQ31fHrBl1iCOzxw= github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59/go.mod h1:jsdUJeYzcbyK1j/EqMGPrQgNYxl/Zfg06vvM9C/xXxs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= -github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I= +github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= +github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao= +github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8= +github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc= +github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/logrusorgru/aurora/v4 v4.0.0 h1:sRjfPpun/63iADiSvGGjgA1cAYegEWMPCJdUpJYn9JA= +github.com/logrusorgru/aurora/v4 v4.0.0/go.mod h1:lP0iIa2nrnT/qoFXcOZSrZQpJ1o6n2CUf/hyHi2Q4ZQ= +github.com/matryer/moq v0.6.0 h1:FCccG09c3o4cg3gnrZ+7ty5Pa/sjmN24BMHp/0pwhjQ= +github.com/matryer/moq v0.6.0/go.mod h1:iEVhY/XBwFG/nbRyEf0oV+SqnTHZJ5wectzx7yT+y98= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sosodev/duration v1.4.0 h1:35ed0KiVFriGHHzZZJaZLgmTEEICIyt8Sx0RQfj9IjE= github.com/sosodev/duration v1.4.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4= +github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/urfave/cli/v3 v3.7.0 h1:AGSnbUyjtLiM+WJUb4dzXKldl/gL+F8OwmRDtVr6g2U= +github.com/urfave/cli/v3 v3.7.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/vektah/gqlparser/v2 v2.5.32 h1:k9QPJd4sEDTL+qB4ncPLflqTJ3MmjB9SrVzJrawpFSc= github.com/vektah/gqlparser/v2 v2.5.32/go.mod h1:c1I28gSOVNzlfc4WuDlqU7voQnsqI6OG2amkBAFmgts= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0 h1:ZVg+kCXxd9LtAaQNKBxAvJ5NpMf7LpvEr4MIZqb0TMQ= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0/go.mod h1:hh0tMeZ75CCXrHd9OXRYxTlCAdxcXioWHFIpYw2rZu8= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0 h1:djrxvDxAe44mJUrKataUbOhCKhR3F8QCyWucO16hTQs= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0/go.mod h1:dt3nxpQEiSoKvfTVxp3TUg5fHPLhKtbcnN3Z1I1ePD0= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0 h1:VO3BL6OZXRQ1yQc8W6EVfJzINeJ35BkiHx4MYfoQf44= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0/go.mod h1:qRDnJ2nv3CQXMK2HUd9K9VtvedsPAce3S+/4LZHjX/s= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0 h1:MMrOAN8H1FrvDyq9UJ4lu5/+ss49Qgfgb7Zpm0m8ABo= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0/go.mod h1:Na+2NNASJtF+uT4NxDe0G+NQb+bUgdPDfwxY/6JmS/c= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 h1:ao6Oe+wSebTlQ1OEht7jlYTzQKE+pnx/iNywFvTbuuI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0/go.mod h1:u3T6vz0gh/NVzgDgiwkgLxpsSF6PaPmo2il0apGJbls= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 h1:mq/Qcf28TWz719lE3/hMB4KkyDuLJIvgJnFGcd0kEUI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0/go.mod h1:yk5LXEYhsL2htyDNJbEq7fWzNEigeEdV5xBF/Y+kAv0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 h1:inYW9ZhgqiDqh6BioM7DVHHzEGVq76Db5897WLGZ5Go= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0/go.mod h1:Izur+Wt8gClgMJqO/cZ8wdeeMryJ/xxiOVgFSSfpDTY= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 h1:klTViGcsvLCd1xN3rZzfZ12NslC/OimbmR+k+A006RI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0/go.mod h1:jRsK04CWmXuY8A0O+wMpSf+t90RHZ53o5Qmxn2PQPfk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 h1:pnxy6c/kvNBWdNNFzqpjuJLm9Hjhgk/Q0nY221rwuk0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0/go.mod h1:qw6YsFapotRwoDhXRZvljzaOvCQB7UfnafEJagpN2TA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 h1:QRefszxJmfPdjXUUm3j6iDzY03mTPXMjqErFqQ67vUg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0/go.mod h1:Tiz03lTBVBrm7eWZBOidzEaYaJa8tjwGUGv6d8mlTyk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 h1:fG5MCxGz8+2VtrN/WgqSpJFctVz24gpxj8CxkKmc8Ww= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0/go.mod h1:BmAYTn+3ysbRe+IU2msxmf5Rx3g6DHvex+tWI3LdhYI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 h1:QBajQ2SrwQijzHyZbQlPsuIzpl/ll8DY6wPWsajeGcI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0/go.mod h1:08ZQLjrPLQ6R4kAXvuOvODEer5Yh4CoFvll5qB2BCI8= go.opentelemetry.io/otel/log v0.16.0 h1:DeuBPqCi6pQwtCK0pO4fvMB5eBq6sNxEnuTs88pjsN4= go.opentelemetry.io/otel/log v0.16.0/go.mod h1:rWsmqNVTLIA8UnwYVOItjyEZDbKIkMxdQunsIhpUMes= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= -go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/metric/x v0.67.0 h1:PcicCNZFkZ4bXfSooXdo3WN7RBOVOtjVdo1wD358Uns= +go.opentelemetry.io/otel/metric/x v0.67.0/go.mod h1:FBjCWZe6wgcqxcMtjdGiClDKXb2YxxXii0CXftE4QtI= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= go.opentelemetry.io/otel/sdk/log v0.16.0 h1:e/b4bdlQwC5fnGtG3dlXUrNOnP7c8YLVSpSfEBIkTnI= go.opentelemetry.io/otel/sdk/log v0.16.0/go.mod h1:JKfP3T6ycy7QEuv3Hj8oKDy7KItrEkus8XJE6EoSzw4= go.opentelemetry.io/otel/sdk/log/logtest v0.16.0 h1:/XVkpZ41rVRTP4DfMgYv1nEtNmf65XPPyAdqV90TMy4= go.opentelemetry.io/otel/sdk/log/logtest v0.16.0/go.mod h1:iOOPgQr5MY9oac/F5W86mXdeyWZGleIx3uXO98X2R6Y= -go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= -go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= -go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= -go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= +go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= -gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 h1:tu/dtnW1o3wfaxCOjSLn5IRX4YDcJrtlpzYkhHhGaC4= -google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171/go.mod h1:M5krXqk4GhBKvB596udGL3UyjL4I1+cTbK0orROM9ng= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= -google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= +google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/deploy-k8s/dagger.json b/deploy-k8s/dagger.json index 5643060..c597a4f 100644 --- a/deploy-k8s/dagger.json +++ b/deploy-k8s/dagger.json @@ -1,6 +1,6 @@ { "name": "deploy-k8s", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/e2e-test/dagger.json b/e2e-test/dagger.json index c9b2a1d..01f5727 100644 --- a/e2e-test/dagger.json +++ b/e2e-test/dagger.json @@ -1,6 +1,6 @@ { "name": "e2e-test", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/e2e-test/go.mod b/e2e-test/go.mod index 8049581..3197da4 100644 --- a/e2e-test/go.mod +++ b/e2e-test/go.mod @@ -7,40 +7,40 @@ require ( github.com/dagger/otel-go v1.43.0 github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 github.com/vektah/gqlparser/v2 v2.5.32 - go.opentelemetry.io/otel v1.43.0 - go.opentelemetry.io/otel/trace v1.43.0 + go.opentelemetry.io/otel v1.45.0 + go.opentelemetry.io/otel/trace v1.45.0 ) require ( github.com/99designs/gqlgen v0.17.89 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/sosodev/duration v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.17.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 // indirect go.opentelemetry.io/otel/log v0.17.0 // indirect - go.opentelemetry.io/otel/metric v1.43.0 // indirect - go.opentelemetry.io/otel/sdk v1.43.0 + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/sdk v1.45.0 go.opentelemetry.io/otel/sdk/log v0.17.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect - go.opentelemetry.io/proto/otlp v1.9.0 // indirect - golang.org/x/net v0.57.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.opentelemetry.io/proto/otlp v1.11.0 // indirect + golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect - golang.org/x/text v0.40.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect - google.golang.org/grpc v1.82.1 // indirect + golang.org/x/text v0.41.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/grpc v1.83.2 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/e2e-test/go.sum b/e2e-test/go.sum index 1336182..5d9f65a 100644 --- a/e2e-test/go.sum +++ b/e2e-test/go.sum @@ -1,112 +1,193 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM= +cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/99designs/gqlgen v0.17.89 h1:KzEcxPiMgQoMw3m/E85atUEHyZyt0PbAflMia5Kw8z8= github.com/99designs/gqlgen v0.17.89/go.mod h1:GFqruTVGB7ZTdrf1uzOagpXbY7DrEt1pIxnTdhIbWvQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 h1:l7+6kwRMJNwdCvYdDl7Eax+wzEYHSnNY7zrrfbhDdTA= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM= github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs= github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU= +github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw= +github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/alexflint/go-arg v1.5.1 h1:nBuWUCpuRy0snAG+uIJ6N0UvYxpxA0/ghA/AaHxlT8Y= +github.com/alexflint/go-arg v1.5.1/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8= +github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= +github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= github.com/dagger/otel-go v1.43.0 h1:AYCnAamWmxtSxigWPTgC+8EWqiWPcDZEegh8y05gdJ8= github.com/dagger/otel-go v1.43.0/go.mod h1:83CTuXi70zcx1kaym5buqmb7RNzg1E9dEiQSFyLbLdU= github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 h1:g6vfdGRyz6fAjfHz5FyYPZgHy8qcQ31fHrBl1iCOzxw= github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59/go.mod h1:jsdUJeYzcbyK1j/EqMGPrQgNYxl/Zfg06vvM9C/xXxs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= -github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I= +github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= +github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao= +github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8= +github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc= +github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/logrusorgru/aurora/v4 v4.0.0 h1:sRjfPpun/63iADiSvGGjgA1cAYegEWMPCJdUpJYn9JA= +github.com/logrusorgru/aurora/v4 v4.0.0/go.mod h1:lP0iIa2nrnT/qoFXcOZSrZQpJ1o6n2CUf/hyHi2Q4ZQ= +github.com/matryer/moq v0.6.0 h1:FCccG09c3o4cg3gnrZ+7ty5Pa/sjmN24BMHp/0pwhjQ= +github.com/matryer/moq v0.6.0/go.mod h1:iEVhY/XBwFG/nbRyEf0oV+SqnTHZJ5wectzx7yT+y98= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sosodev/duration v1.4.0 h1:35ed0KiVFriGHHzZZJaZLgmTEEICIyt8Sx0RQfj9IjE= github.com/sosodev/duration v1.4.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4= +github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/urfave/cli/v3 v3.7.0 h1:AGSnbUyjtLiM+WJUb4dzXKldl/gL+F8OwmRDtVr6g2U= +github.com/urfave/cli/v3 v3.7.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/vektah/gqlparser/v2 v2.5.32 h1:k9QPJd4sEDTL+qB4ncPLflqTJ3MmjB9SrVzJrawpFSc= github.com/vektah/gqlparser/v2 v2.5.32/go.mod h1:c1I28gSOVNzlfc4WuDlqU7voQnsqI6OG2amkBAFmgts= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0 h1:ZVg+kCXxd9LtAaQNKBxAvJ5NpMf7LpvEr4MIZqb0TMQ= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0/go.mod h1:hh0tMeZ75CCXrHd9OXRYxTlCAdxcXioWHFIpYw2rZu8= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0 h1:djrxvDxAe44mJUrKataUbOhCKhR3F8QCyWucO16hTQs= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0/go.mod h1:dt3nxpQEiSoKvfTVxp3TUg5fHPLhKtbcnN3Z1I1ePD0= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0 h1:VO3BL6OZXRQ1yQc8W6EVfJzINeJ35BkiHx4MYfoQf44= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.41.0/go.mod h1:qRDnJ2nv3CQXMK2HUd9K9VtvedsPAce3S+/4LZHjX/s= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0 h1:MMrOAN8H1FrvDyq9UJ4lu5/+ss49Qgfgb7Zpm0m8ABo= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.41.0/go.mod h1:Na+2NNASJtF+uT4NxDe0G+NQb+bUgdPDfwxY/6JmS/c= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 h1:ao6Oe+wSebTlQ1OEht7jlYTzQKE+pnx/iNywFvTbuuI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0/go.mod h1:u3T6vz0gh/NVzgDgiwkgLxpsSF6PaPmo2il0apGJbls= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 h1:mq/Qcf28TWz719lE3/hMB4KkyDuLJIvgJnFGcd0kEUI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0/go.mod h1:yk5LXEYhsL2htyDNJbEq7fWzNEigeEdV5xBF/Y+kAv0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 h1:inYW9ZhgqiDqh6BioM7DVHHzEGVq76Db5897WLGZ5Go= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0/go.mod h1:Izur+Wt8gClgMJqO/cZ8wdeeMryJ/xxiOVgFSSfpDTY= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 h1:klTViGcsvLCd1xN3rZzfZ12NslC/OimbmR+k+A006RI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0/go.mod h1:jRsK04CWmXuY8A0O+wMpSf+t90RHZ53o5Qmxn2PQPfk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 h1:pnxy6c/kvNBWdNNFzqpjuJLm9Hjhgk/Q0nY221rwuk0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0/go.mod h1:qw6YsFapotRwoDhXRZvljzaOvCQB7UfnafEJagpN2TA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 h1:QRefszxJmfPdjXUUm3j6iDzY03mTPXMjqErFqQ67vUg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0/go.mod h1:Tiz03lTBVBrm7eWZBOidzEaYaJa8tjwGUGv6d8mlTyk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 h1:fG5MCxGz8+2VtrN/WgqSpJFctVz24gpxj8CxkKmc8Ww= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0/go.mod h1:BmAYTn+3ysbRe+IU2msxmf5Rx3g6DHvex+tWI3LdhYI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 h1:QBajQ2SrwQijzHyZbQlPsuIzpl/ll8DY6wPWsajeGcI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0/go.mod h1:08ZQLjrPLQ6R4kAXvuOvODEer5Yh4CoFvll5qB2BCI8= go.opentelemetry.io/otel/log v0.16.0 h1:DeuBPqCi6pQwtCK0pO4fvMB5eBq6sNxEnuTs88pjsN4= go.opentelemetry.io/otel/log v0.16.0/go.mod h1:rWsmqNVTLIA8UnwYVOItjyEZDbKIkMxdQunsIhpUMes= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= -go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/metric/x v0.67.0 h1:PcicCNZFkZ4bXfSooXdo3WN7RBOVOtjVdo1wD358Uns= +go.opentelemetry.io/otel/metric/x v0.67.0/go.mod h1:FBjCWZe6wgcqxcMtjdGiClDKXb2YxxXii0CXftE4QtI= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= go.opentelemetry.io/otel/sdk/log v0.16.0 h1:e/b4bdlQwC5fnGtG3dlXUrNOnP7c8YLVSpSfEBIkTnI= go.opentelemetry.io/otel/sdk/log v0.16.0/go.mod h1:JKfP3T6ycy7QEuv3Hj8oKDy7KItrEkus8XJE6EoSzw4= go.opentelemetry.io/otel/sdk/log/logtest v0.16.0 h1:/XVkpZ41rVRTP4DfMgYv1nEtNmf65XPPyAdqV90TMy4= go.opentelemetry.io/otel/sdk/log/logtest v0.16.0/go.mod h1:iOOPgQr5MY9oac/F5W86mXdeyWZGleIx3uXO98X2R6Y= -go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= -go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= -go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= -go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= +go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= -gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= -gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= -google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 h1:tu/dtnW1o3wfaxCOjSLn5IRX4YDcJrtlpzYkhHhGaC4= -google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171/go.mod h1:M5krXqk4GhBKvB596udGL3UyjL4I1+cTbK0orROM9ng= -google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 h1:yQugLulqltosq0B/f8l4w9VryjV+N/5gcW0jQ3N8Qec= -google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478/go.mod h1:C6ADNqOxbgdUUeRTU+LCHDPB9ttAMCTff6auwCVa4uc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= -google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= -google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= -google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= +google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/iac-scan/README.md b/iac-scan/README.md index 2cf47bb..8c1c338 100644 --- a/iac-scan/README.md +++ b/iac-scan/README.md @@ -1,7 +1,7 @@ # iac-scan > **UNVERIFIED SCAFFOLD** — run `dagger develop` + `dagger functions` + test -> against a matching Dagger engine (engineVersion `v0.21.7`) before use. The +> against a matching Dagger engine (engineVersion `v0.21.11`) before use. The > Go in `main.go` has NOT been compiled or validated by Dagger codegen in > this environment (`dagger develop` is unavailable, and the `dag` global > plus the `*Directory` / `*Container` / `*Secret` / `*File` types are diff --git a/iac-scan/dagger.json b/iac-scan/dagger.json index a84df89..ad9733f 100644 --- a/iac-scan/dagger.json +++ b/iac-scan/dagger.json @@ -1,11 +1,12 @@ { "name": "iac-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, "source": ".", "include": [ - "./main.go" + "./main.go", + "./scanofrecord.go" ] } diff --git a/iac-scan/main.go b/iac-scan/main.go index 417f7ab..7b1ab03 100644 --- a/iac-scan/main.go +++ b/iac-scan/main.go @@ -45,6 +45,8 @@ type ScanResult struct { Report string `json:"report,omitempty"` Skipped bool `json:"skipped"` Success bool `json:"success"` + // Suppression files the scan of record removed from the scanned copy. + IgnoredSuppressions []string `json:"ignored_suppressions,omitempty"` } // Scan runs an IaC misconfiguration pass over the source directory with the @@ -70,8 +72,24 @@ func (m *IacScan) Scan( // Version (commit SHA / image tag) the scan applies to // +optional version string, + // The analysis job of record (ADR-0093 §4, WP-05): the repository's + // suppression files (trivy.yaml, .trivyignore[.yaml], .checkov.yaml, ...) + // are removed from the scanned copy and Trivy reads no configuration from + // the tree. Off for every other caller. + // +optional + scanOfRecord bool, ) (*ScanResult, error) { result := &ScanResult{Tool: tool} + if scanOfRecord { + var err error + source, result.IgnoredSuppressions, err = dropSuppression(ctx, source, + func(ctx context.Context, pattern string) ([]string, error) { return source.Glob(ctx, pattern) }, + func(d *dagger.Directory, paths []string) *dagger.Directory { return d.WithoutFiles(paths) }, + ) + if err != nil { + return nil, err + } + } var ( report string @@ -84,7 +102,7 @@ func (m *IacScan) Scan( result.Success = true return result, nil case "trivy": - report, err = m.runTrivyConfig(ctx, source) + report, err = m.runTrivyConfig(ctx, source, scanOfRecord) case "checkov": report, err = m.runCheckov(ctx, source) default: @@ -120,22 +138,15 @@ func (m *IacScan) Scan( // runTrivyConfig runs "trivy config" over the source directory in JSON mode. // Trivy exits non-zero when misconfigurations are present; we force // --exit-code 0 and read the JSON report rather than relying on the exit code. -func (m *IacScan) runTrivyConfig(ctx context.Context, source *dagger.Directory) (string, error) { - const reportPath = "/tmp/iac-report.json" +func (m *IacScan) runTrivyConfig(ctx context.Context, source *dagger.Directory, scanOfRecord bool) (string, error) { report, err := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). // Persist Trivy's misconfig/policy DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithMountedDirectory("/src", source). WithWorkdir("/src"). - WithExec([]string{ - "trivy", "config", - "--format", "json", - "--output", reportPath, - "--exit-code", "0", - ".", - }). - File(reportPath). + WithExec(iacTrivyArgs(scanOfRecord)). + File(iacReportPath). Contents(ctx) if err != nil { return "", fmt.Errorf("read trivy config JSON output: %w", err) @@ -143,6 +154,20 @@ func (m *IacScan) runTrivyConfig(ctx context.Context, source *dagger.Directory) return report, nil } +const iacReportPath = "/tmp/iac-report.json" + +// iacTrivyArgs is the `trivy config` argv; the scan of record adds +// trustedConfigArgs before the target. +func iacTrivyArgs(scanOfRecord bool) []string { + return withTrustedConfig([]string{ + "trivy", "config", + "--format", "json", + "--output", iacReportPath, + "--exit-code", "0", + ".", + }, scanOfRecord) +} + // runCheckov runs Checkov over the source directory in JSON mode. Checkov // exits non-zero when failed checks are present, so we tolerate the exit code // and read the JSON emitted on stdout. @@ -195,8 +220,9 @@ func (m *IacScan) postResults( "medium_count": result.Medium, "low_count": result.Low, "report_data": map[string]any{ - "iac_critical": result.Critical, - "iac_high": result.High, + "iac_critical": result.Critical, + "iac_high": result.High, + "ignored_suppressions": result.IgnoredSuppressions, }, } diff --git a/iac-scan/scanofrecord.go b/iac-scan/scanofrecord.go new file mode 100644 index 0000000..30f725b --- /dev/null +++ b/iac-scan/scanofrecord.go @@ -0,0 +1,92 @@ +package main + +// The scan of record (ADR-0093 §4 condition 3, WP-05): the repository being +// judged must not be able to steer the scanner that judges it. By default +// Trivy reads trivy.yaml, .trivyignore[.yaml] and trivy-secret.yaml from the +// tree it scans, so a change could ignore its own licence or misconfiguration +// finding (WP-13 review, 2026-11-05, CONFIRMED). With --scan-of-record those +// files are removed from the scanned copy (reported as ignored_suppressions) +// and Trivy is told to read no configuration from the tree at all. Mirrors +// security-scan's withoutSuppression / trustedConfigArgs. +// +// Pure where it can be: dropSuppression takes the tree's glob and "without" +// as functions, so a test passes an in-memory tree and checks the tree that +// comes back. + +import ( + "context" + "fmt" +) + +// suppressionFiles are the files Trivy (and Checkov) read from the scanned +// tree and obey. Kept equal to security-scan's list by +// apps/api/tests/test_analysis_of_record.py. +var suppressionFiles = []string{ + ".gitleaksignore", + ".gitleaks.toml", + ".trivyignore", + ".trivyignore.yaml", + "trivy.yaml", + "trivy.yml", + ".semgrepignore", + ".checkov.yaml", + ".checkov.yml", + "trivy-secret.yaml", + "trivy-secret.yml", +} + +// dropSuppression returns source minus every suppressionFiles entry, at any +// depth, and the paths it removed. A tree that cannot be listed is an error: +// a scan of record that could not drop the suppressions is not one. +func dropSuppression[T any]( + ctx context.Context, + source T, + glob func(context.Context, string) ([]string, error), + without func(T, []string) T, +) (T, []string, error) { + var found []string + for _, name := range suppressionFiles { + for _, pattern := range []string{name, "**/" + name} { + matches, err := glob(ctx, pattern) + if err != nil { + var none T + return none, nil, fmt.Errorf("list %s for the scan of record: %w", name, err) + } + found = append(found, matches...) + } + } + seen := map[string]bool{} + var removed []string + for _, p := range found { + if !seen[p] { + seen[p] = true + removed = append(removed, p) + } + } + if len(removed) == 0 { + return source, nil, nil + } + return without(source, removed), removed, nil +} + +// trustedConfigArgs are the Trivy flags the scan of record adds: no +// configuration, ignore file or secret configuration is read from the tree +// it scans (Trivy 0.76, "Disabling configuration files"). +func trustedConfigArgs(scanOfRecord bool) []string { + if !scanOfRecord { + return nil + } + return []string{"--config=", "--ignorefile=", "--secret-config="} +} + +// withTrustedConfig inserts trustedConfigArgs before the final target +// argument of a Trivy argv (the target must stay last). +func withTrustedConfig(args []string, scanOfRecord bool) []string { + extra := trustedConfigArgs(scanOfRecord) + if len(extra) == 0 || len(args) == 0 { + return args + } + out := append([]string{}, args[:len(args)-1]...) + out = append(out, extra...) + return append(out, args[len(args)-1]) +} diff --git a/iac-scan/scanofrecord_test.go b/iac-scan/scanofrecord_test.go new file mode 100644 index 0000000..208b1ba --- /dev/null +++ b/iac-scan/scanofrecord_test.go @@ -0,0 +1,127 @@ +package main + +// Written on the build VM, not run there (owner decision 2026-10-11). Runs +// with `go test ./...` after `dagger develop` has generated internal/dagger. + +import ( + "context" + "errors" + "path" + "reflect" + "sort" + "strings" + "testing" +) + +type memTree struct { + files map[string]bool + globErr error +} + +func newTree(paths ...string) memTree { + files := map[string]bool{} + for _, p := range paths { + files[p] = true + } + return memTree{files: files} +} + +func (t memTree) Glob(_ context.Context, pattern string) ([]string, error) { + if t.globErr != nil { + return nil, t.globErr + } + var out []string + for p := range t.files { + if name, ok := strings.CutPrefix(pattern, "**/"); ok { + if strings.Contains(p, "/") && path.Base(p) == name { + out = append(out, p) + } + } else if p == pattern { + out = append(out, p) + } + } + sort.Strings(out) + return out, nil +} + +func (t memTree) WithoutFiles(paths []string) memTree { + files := map[string]bool{} + for p := range t.files { + files[p] = true + } + for _, p := range paths { + delete(files, p) + } + return memTree{files: files} +} + +func (t memTree) list() []string { + var out []string + for p := range t.files { + out = append(out, p) + } + sort.Strings(out) + return out +} + +// A change that ships trivy.yaml / .trivyignore to hide its own misconfiguration +// is scanned WITHOUT them. Mutant: return `source, removed, nil` -> the tree +// still holds them and this fails. +func TestTheIacScanOfRecordTreeHasNoSuppressionFile(t *testing.T) { + tree := newTree("main.tf", "trivy.yaml", ".trivyignore", "svc/.trivyignore.yaml", "trivy-secret.yaml") + got, removed, err := dropSuppression(context.Background(), tree, tree.Glob, memTree.WithoutFiles) + if err != nil { + t.Fatal(err) + } + if want := []string{"main.tf"}; !reflect.DeepEqual(got.list(), want) { + t.Fatalf("scanned tree = %q, want %q", got.list(), want) + } + if len(removed) != 4 { + t.Fatalf("removed %q, want the four suppression files", removed) + } +} + +// Legal direction: a tree without suppression is scanned whole. +func TestAnIacTreeWithoutSuppressionIsScannedWhole(t *testing.T) { + tree := newTree("main.tf", "src/trivy.go") + got, removed, err := dropSuppression(context.Background(), tree, tree.Glob, memTree.WithoutFiles) + if err != nil || len(removed) != 0 || !reflect.DeepEqual(got.list(), tree.list()) { + t.Fatalf("got %q removed %q err %v", got.list(), removed, err) + } +} + +func TestAnIacTreeThatCannotBeListedIsNotAScanOfRecord(t *testing.T) { + tree := memTree{globErr: errors.New("boom")} + if _, _, err := dropSuppression(context.Background(), tree, tree.Glob, memTree.WithoutFiles); err == nil { + t.Fatal("an unlistable tree must be an error, never a whole-tree scan") + } +} + +// Mirrors security-scan's TestTrivyReadsNoConfigFromTheTreeInTheScanOfRecord. +// Mutant: drop trustedConfigArgs from iacTrivyArgs -> fails; legal direction: +// add them outside the scan of record -> the second loop fails. +func TestIacTrivyReadsNoConfigFromTheTreeInTheScanOfRecord(t *testing.T) { + args := iacTrivyArgs(true) + for _, flag := range []string{"--config=", "--ignorefile=", "--secret-config="} { + if !contains(args, flag) { + t.Errorf("iac scan of record lacks %s: %q", flag, args) + } + } + if args[len(args)-1] != "." { + t.Errorf("the target must stay last: %q", args) + } + for _, a := range iacTrivyArgs(false) { + if strings.HasPrefix(a, "--config=") || strings.HasPrefix(a, "--ignorefile=") { + t.Errorf("outside the scan of record the argv must not change: %q", a) + } + } +} + +func contains(xs []string, s string) bool { + for _, x := range xs { + if x == s { + return true + } + } + return false +} diff --git a/license-scan/dagger.json b/license-scan/dagger.json index 33e93a8..2123dad 100644 --- a/license-scan/dagger.json +++ b/license-scan/dagger.json @@ -1,11 +1,13 @@ { "name": "license-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, "source": ".", "include": [ - "./main.go" + "./main.go", + "./report.go", + "./scanofrecord.go" ] } diff --git a/license-scan/main.go b/license-scan/main.go index b2b6dba..c1e4c18 100644 --- a/license-scan/main.go +++ b/license-scan/main.go @@ -50,7 +50,7 @@ func (m *LicenseScan) ScanFs( } report, err := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). // Persist Trivy's vulnerability DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithDirectory("/src", source). @@ -100,7 +100,7 @@ func (m *LicenseScan) ScanImage( } report, err := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). // Persist Trivy's vulnerability DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithExec([]string{ diff --git a/license-scan/report.go b/license-scan/report.go new file mode 100644 index 0000000..e598d12 --- /dev/null +++ b/license-scan/report.go @@ -0,0 +1,177 @@ +package main + +// Report: the licence LIST, not a decision (ADR-0093 §10 item 3, WP-13 13f). +// +// A tenant's licence posture is its legal decision (OD-15): the tenant's +// allow / deny lists in secure_delivery_policies decide, in the platform's +// security verdict. This function posts what Trivy found, one entry per +// package, and never fails on a licence. The --blocklist of ScanFs/ScanImage is +// IntegraCI's own rule 3 for what IntegraCI bundles and stays as it is for +// that use; it is not the tenant's policy. +// +// dagger call report --source . --api-url $API --token env:TOKEN --service-id $SVC --version $SHA + +import ( + "bytes" + "context" + "dagger/license-scan/internal/dagger" + "encoding/json" + "fmt" + "net/http" + "sort" + "strings" + "time" +) + +// PackageLicence is one package's licence as Trivy reports it. +type PackageLicence struct { + Package string `json:"package"` + License string `json:"license"` +} + +// ReportResult is what Report returns. +type ReportResult struct { + Outcome string `json:"outcome"` // ran | could_not_run + Licences []PackageLicence `json:"licenses"` + Posted bool `json:"posted"` + Error string `json:"error,omitempty"` + // Suppression files the scan of record removed from the scanned copy. + IgnoredSuppressions []string `json:"ignored_suppressions,omitempty"` +} + +// licenceArgs is the `trivy fs --scanners license` argv; the scan of record +// adds trustedConfigArgs before the target. +func licenceArgs(scanOfRecord bool) []string { + return withTrustedConfig([]string{ + "trivy", "fs", "--scanners", "license", "--format", "json", + "--output", "/tmp/license-report.json", "--exit-code", "0", ".", + }, scanOfRecord) +} + +// parseLicences reads `trivy fs --scanners license --format json` output. +func parseLicences(report string) ([]PackageLicence, error) { + var doc struct { + Results []struct { + Licenses []struct { + PkgName string `json:"PkgName"` + Name string `json:"Name"` + } `json:"Licenses"` + } `json:"Results"` + } + if err := json.Unmarshal([]byte(report), &doc); err != nil { + return nil, fmt.Errorf("trivy licence report unreadable: %w", err) + } + seen := map[string]bool{} + out := []PackageLicence{} + for _, r := range doc.Results { + for _, l := range r.Licenses { + if l.PkgName == "" { + continue // file-level licence of the repository's own code + } + key := l.PkgName + "\x00" + l.Name + if seen[key] { + continue + } + seen[key] = true + out = append(out, PackageLicence{Package: l.PkgName, License: l.Name}) + } + } + sort.Slice(out, func(i, j int) bool { + if out[i].Package != out[j].Package { + return out[i].Package < out[j].Package + } + return out[i].License < out[j].License + }) + return out, nil +} + +// Report posts the dependency licence list as scan_type=license. +func (m *LicenseScan) Report( + ctx context.Context, + source *dagger.Directory, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // +optional + version string, + // The analysis job of record (ADR-0093 §4, WP-05): the repository's + // suppression files are removed from the scanned copy, Trivy reads no + // configuration from the tree, and what was ignored is posted as + // information. Off for every other caller. + // +optional + scanOfRecord bool, +) (*ReportResult, error) { + res := &ReportResult{Outcome: "ran", Licences: []PackageLicence{}} + var err error + if scanOfRecord { + source, res.IgnoredSuppressions, err = dropSuppression(ctx, source, + func(ctx context.Context, pattern string) ([]string, error) { return source.Glob(ctx, pattern) }, + func(d *dagger.Directory, paths []string) *dagger.Directory { return d.WithoutFiles(paths) }, + ) + } + var report string + if err == nil { + report, err = dag.Container(). + From("aquasec/trivy:0.76.1"). + WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). + WithDirectory("/src", source). + WithWorkdir("/src"). + WithExec(licenceArgs(scanOfRecord)). + File("/tmp/license-report.json"). + Contents(ctx) + } + if err == nil { + res.Licences, err = parseLicences(report) + } + if err != nil { + res.Outcome, res.Error, res.Licences = "could_not_run", err.Error(), []PackageLicence{} + } + if apiURL == "" || token == nil { + return res, nil + } + licences := res.Licences + if len(licences) > 5000 { + licences = licences[:5000] + } + data := map[string]any{"outcome": res.Outcome, "licenses": licences} + if res.Outcome == "could_not_run" { + data = map[string]any{"outcome": res.Outcome, "error": res.Error} + } + if len(res.IgnoredSuppressions) > 0 { + data["ignored_suppressions"] = res.IgnoredSuppressions + } + body, err := json.Marshal(map[string]any{ + "service_id": serviceID, + "version": version, + "scan_type": "license", + "scanner": "trivy", + "report_format": "json", + "report_data": data, + }) + if err != nil { + return res, fmt.Errorf("marshal licence payload: %w", err) + } + req, err := http.NewRequestWithContext(ctx, http.MethodPost, strings.TrimRight(apiURL, "/")+"/api/v1/scans", bytes.NewReader(body)) + if err != nil { + return res, fmt.Errorf("build request: %w", err) + } + tok, err := token.Plaintext(ctx) + if err != nil { + return res, fmt.Errorf("read token secret: %w", err) + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer "+tok) + resp, err := (&http.Client{Timeout: 60 * time.Second}).Do(req) + if err != nil { + return res, fmt.Errorf("post licence report: %w", err) + } + defer resp.Body.Close() + if resp.StatusCode >= 300 { + return res, fmt.Errorf("post licence report returned %d", resp.StatusCode) + } + res.Posted = true + return res, nil +} diff --git a/license-scan/report_test.go b/license-scan/report_test.go new file mode 100644 index 0000000..3fbc45d --- /dev/null +++ b/license-scan/report_test.go @@ -0,0 +1,25 @@ +package main + +import "testing" + +func TestParseLicencesListsPackagesWithoutDeciding(t *testing.T) { + report := `{"Results":[{"Licenses":[ + {"PkgName":"left-pad","Name":"MIT"}, + {"PkgName":"left-pad","Name":"MIT"}, + {"PkgName":"gpl-thing","Name":"GPL-3.0"}, + {"PkgName":"","Name":"Apache-2.0"}]}]}` + got, err := parseLicences(report) + if err != nil { + t.Fatal(err) + } + want := []PackageLicence{{"gpl-thing", "GPL-3.0"}, {"left-pad", "MIT"}} + if len(got) != len(want) || got[0] != want[0] || got[1] != want[1] { + t.Fatalf("got %v, want %v", got, want) + } +} + +func TestAnUnreadableLicenceReportIsAnError(t *testing.T) { + if _, err := parseLicences("FATAL"); err == nil { + t.Fatal("an unreadable report must be could_not_run, not an empty list") + } +} diff --git a/license-scan/scanofrecord.go b/license-scan/scanofrecord.go new file mode 100644 index 0000000..30f725b --- /dev/null +++ b/license-scan/scanofrecord.go @@ -0,0 +1,92 @@ +package main + +// The scan of record (ADR-0093 §4 condition 3, WP-05): the repository being +// judged must not be able to steer the scanner that judges it. By default +// Trivy reads trivy.yaml, .trivyignore[.yaml] and trivy-secret.yaml from the +// tree it scans, so a change could ignore its own licence or misconfiguration +// finding (WP-13 review, 2026-11-05, CONFIRMED). With --scan-of-record those +// files are removed from the scanned copy (reported as ignored_suppressions) +// and Trivy is told to read no configuration from the tree at all. Mirrors +// security-scan's withoutSuppression / trustedConfigArgs. +// +// Pure where it can be: dropSuppression takes the tree's glob and "without" +// as functions, so a test passes an in-memory tree and checks the tree that +// comes back. + +import ( + "context" + "fmt" +) + +// suppressionFiles are the files Trivy (and Checkov) read from the scanned +// tree and obey. Kept equal to security-scan's list by +// apps/api/tests/test_analysis_of_record.py. +var suppressionFiles = []string{ + ".gitleaksignore", + ".gitleaks.toml", + ".trivyignore", + ".trivyignore.yaml", + "trivy.yaml", + "trivy.yml", + ".semgrepignore", + ".checkov.yaml", + ".checkov.yml", + "trivy-secret.yaml", + "trivy-secret.yml", +} + +// dropSuppression returns source minus every suppressionFiles entry, at any +// depth, and the paths it removed. A tree that cannot be listed is an error: +// a scan of record that could not drop the suppressions is not one. +func dropSuppression[T any]( + ctx context.Context, + source T, + glob func(context.Context, string) ([]string, error), + without func(T, []string) T, +) (T, []string, error) { + var found []string + for _, name := range suppressionFiles { + for _, pattern := range []string{name, "**/" + name} { + matches, err := glob(ctx, pattern) + if err != nil { + var none T + return none, nil, fmt.Errorf("list %s for the scan of record: %w", name, err) + } + found = append(found, matches...) + } + } + seen := map[string]bool{} + var removed []string + for _, p := range found { + if !seen[p] { + seen[p] = true + removed = append(removed, p) + } + } + if len(removed) == 0 { + return source, nil, nil + } + return without(source, removed), removed, nil +} + +// trustedConfigArgs are the Trivy flags the scan of record adds: no +// configuration, ignore file or secret configuration is read from the tree +// it scans (Trivy 0.76, "Disabling configuration files"). +func trustedConfigArgs(scanOfRecord bool) []string { + if !scanOfRecord { + return nil + } + return []string{"--config=", "--ignorefile=", "--secret-config="} +} + +// withTrustedConfig inserts trustedConfigArgs before the final target +// argument of a Trivy argv (the target must stay last). +func withTrustedConfig(args []string, scanOfRecord bool) []string { + extra := trustedConfigArgs(scanOfRecord) + if len(extra) == 0 || len(args) == 0 { + return args + } + out := append([]string{}, args[:len(args)-1]...) + out = append(out, extra...) + return append(out, args[len(args)-1]) +} diff --git a/license-scan/scanofrecord_test.go b/license-scan/scanofrecord_test.go new file mode 100644 index 0000000..381861a --- /dev/null +++ b/license-scan/scanofrecord_test.go @@ -0,0 +1,127 @@ +package main + +// Written on the build VM, not run there (owner decision 2026-10-11). Runs +// with `go test ./...` after `dagger develop` has generated internal/dagger. + +import ( + "context" + "errors" + "path" + "reflect" + "sort" + "strings" + "testing" +) + +type memTree struct { + files map[string]bool + globErr error +} + +func newTree(paths ...string) memTree { + files := map[string]bool{} + for _, p := range paths { + files[p] = true + } + return memTree{files: files} +} + +func (t memTree) Glob(_ context.Context, pattern string) ([]string, error) { + if t.globErr != nil { + return nil, t.globErr + } + var out []string + for p := range t.files { + if name, ok := strings.CutPrefix(pattern, "**/"); ok { + if strings.Contains(p, "/") && path.Base(p) == name { + out = append(out, p) + } + } else if p == pattern { + out = append(out, p) + } + } + sort.Strings(out) + return out, nil +} + +func (t memTree) WithoutFiles(paths []string) memTree { + files := map[string]bool{} + for p := range t.files { + files[p] = true + } + for _, p := range paths { + delete(files, p) + } + return memTree{files: files} +} + +func (t memTree) list() []string { + var out []string + for p := range t.files { + out = append(out, p) + } + sort.Strings(out) + return out +} + +// A change that ships trivy.yaml / .trivyignore to hide its own GPL dependency +// is scanned WITHOUT them. Mutant: return `source, removed, nil` -> the tree +// still holds them and this fails. +func TestTheLicenceScanOfRecordTreeHasNoSuppressionFile(t *testing.T) { + tree := newTree("package.json", "trivy.yaml", ".trivyignore", "svc/.trivyignore.yaml", "trivy-secret.yaml") + got, removed, err := dropSuppression(context.Background(), tree, tree.Glob, memTree.WithoutFiles) + if err != nil { + t.Fatal(err) + } + if want := []string{"package.json"}; !reflect.DeepEqual(got.list(), want) { + t.Fatalf("scanned tree = %q, want %q", got.list(), want) + } + if len(removed) != 4 { + t.Fatalf("removed %q, want the four suppression files", removed) + } +} + +// Legal direction: a tree without suppression is scanned whole. +func TestALicenceTreeWithoutSuppressionIsScannedWhole(t *testing.T) { + tree := newTree("package.json", "src/trivy.go") + got, removed, err := dropSuppression(context.Background(), tree, tree.Glob, memTree.WithoutFiles) + if err != nil || len(removed) != 0 || !reflect.DeepEqual(got.list(), tree.list()) { + t.Fatalf("got %q removed %q err %v", got.list(), removed, err) + } +} + +func TestALicenceTreeThatCannotBeListedIsNotAScanOfRecord(t *testing.T) { + tree := memTree{globErr: errors.New("boom")} + if _, _, err := dropSuppression(context.Background(), tree, tree.Glob, memTree.WithoutFiles); err == nil { + t.Fatal("an unlistable tree must be an error, never a whole-tree scan") + } +} + +// Mirrors security-scan's TestTrivyReadsNoConfigFromTheTreeInTheScanOfRecord. +// Mutant: drop trustedConfigArgs from licenceArgs -> fails; legal direction: +// add them outside the scan of record -> the second loop fails. +func TestLicenceTrivyReadsNoConfigFromTheTreeInTheScanOfRecord(t *testing.T) { + args := licenceArgs(true) + for _, flag := range []string{"--config=", "--ignorefile=", "--secret-config="} { + if !contains(args, flag) { + t.Errorf("licence scan of record lacks %s: %q", flag, args) + } + } + if args[len(args)-1] != "." { + t.Errorf("the target must stay last: %q", args) + } + for _, a := range licenceArgs(false) { + if strings.HasPrefix(a, "--config=") || strings.HasPrefix(a, "--ignorefile=") { + t.Errorf("outside the scan of record the argv must not change: %q", a) + } + } +} + +func contains(xs []string, s string) bool { + for _, x := range xs { + if x == s { + return true + } + } + return false +} diff --git a/malware-scan/dagger.json b/malware-scan/dagger.json index e352d83..c2ed5c6 100644 --- a/malware-scan/dagger.json +++ b/malware-scan/dagger.json @@ -1,6 +1,6 @@ { "name": "malware-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/mobile-android/dagger.json b/mobile-android/dagger.json index 8f109d5..67898e2 100644 --- a/mobile-android/dagger.json +++ b/mobile-android/dagger.json @@ -1,6 +1,6 @@ { "name": "mobile-android", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/mobile-flutter/dagger.json b/mobile-flutter/dagger.json index 0e04fd4..22d1311 100644 --- a/mobile-flutter/dagger.json +++ b/mobile-flutter/dagger.json @@ -1,6 +1,6 @@ { "name": "mobile-flutter", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/mobile-ios/dagger.json b/mobile-ios/dagger.json index a3ca4dc..9de371d 100644 --- a/mobile-ios/dagger.json +++ b/mobile-ios/dagger.json @@ -1,6 +1,6 @@ { "name": "mobile-ios", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/mobile-security-scan/dagger.json b/mobile-security-scan/dagger.json index 481b0ff..d72aaed 100644 --- a/mobile-security-scan/dagger.json +++ b/mobile-security-scan/dagger.json @@ -1,6 +1,6 @@ { "name": "mobile-security-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/model-scan/dagger.json b/model-scan/dagger.json index 14e68ae..ee82c77 100644 --- a/model-scan/dagger.json +++ b/model-scan/dagger.json @@ -1,6 +1,6 @@ { "name": "model-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/perf-test/dagger.json b/perf-test/dagger.json index 44cc296..ee8e7f4 100644 --- a/perf-test/dagger.json +++ b/perf-test/dagger.json @@ -1,6 +1,6 @@ { "name": "perf-test", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/perf-test/go.mod b/perf-test/go.mod index 3ce49bb..97dae64 100644 --- a/perf-test/go.mod +++ b/perf-test/go.mod @@ -2,6 +2,48 @@ module dagger/perf-test go 1.26.4 +require ( + github.com/Khan/genqlient v0.8.1 + github.com/dagger/otel-go v1.43.0 + github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 + github.com/vektah/gqlparser/v2 v2.5.32 + go.opentelemetry.io/otel v1.45.0 + go.opentelemetry.io/otel/trace v1.45.0 +) + +require ( + github.com/99designs/gqlgen v0.17.89 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/go-logr/logr v1.4.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect + github.com/sosodev/duration v1.4.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.17.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.17.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 // indirect + go.opentelemetry.io/otel/log v0.17.0 // indirect + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/sdk v1.45.0 + go.opentelemetry.io/otel/sdk/log v0.17.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.opentelemetry.io/proto/otlp v1.11.0 // indirect + golang.org/x/net v0.58.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/text v0.41.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/grpc v1.83.2 // indirect + google.golang.org/protobuf v1.36.11 // indirect +) + replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0 replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0 diff --git a/perf-test/go.sum b/perf-test/go.sum index e69de29..5d9f65a 100644 --- a/perf-test/go.sum +++ b/perf-test/go.sum @@ -0,0 +1,193 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM= +cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= +github.com/99designs/gqlgen v0.17.89 h1:KzEcxPiMgQoMw3m/E85atUEHyZyt0PbAflMia5Kw8z8= +github.com/99designs/gqlgen v0.17.89/go.mod h1:GFqruTVGB7ZTdrf1uzOagpXbY7DrEt1pIxnTdhIbWvQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 h1:l7+6kwRMJNwdCvYdDl7Eax+wzEYHSnNY7zrrfbhDdTA= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM= +github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs= +github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU= +github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw= +github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ= +github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= +github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= +github.com/alexflint/go-arg v1.5.1 h1:nBuWUCpuRy0snAG+uIJ6N0UvYxpxA0/ghA/AaHxlT8Y= +github.com/alexflint/go-arg v1.5.1/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8= +github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= +github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= +github.com/dagger/otel-go v1.43.0 h1:AYCnAamWmxtSxigWPTgC+8EWqiWPcDZEegh8y05gdJ8= +github.com/dagger/otel-go v1.43.0/go.mod h1:83CTuXi70zcx1kaym5buqmb7RNzg1E9dEiQSFyLbLdU= +github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59 h1:g6vfdGRyz6fAjfHz5FyYPZgHy8qcQ31fHrBl1iCOzxw= +github.com/dagger/querybuilder v0.0.0-20260402040506-574a5e81cb59/go.mod h1:jsdUJeYzcbyK1j/EqMGPrQgNYxl/Zfg06vvM9C/xXxs= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I= +github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao= +github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8= +github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc= +github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/logrusorgru/aurora/v4 v4.0.0 h1:sRjfPpun/63iADiSvGGjgA1cAYegEWMPCJdUpJYn9JA= +github.com/logrusorgru/aurora/v4 v4.0.0/go.mod h1:lP0iIa2nrnT/qoFXcOZSrZQpJ1o6n2CUf/hyHi2Q4ZQ= +github.com/matryer/moq v0.6.0 h1:FCccG09c3o4cg3gnrZ+7ty5Pa/sjmN24BMHp/0pwhjQ= +github.com/matryer/moq v0.6.0/go.mod h1:iEVhY/XBwFG/nbRyEf0oV+SqnTHZJ5wectzx7yT+y98= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sosodev/duration v1.4.0 h1:35ed0KiVFriGHHzZZJaZLgmTEEICIyt8Sx0RQfj9IjE= +github.com/sosodev/duration v1.4.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4= +github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/urfave/cli/v3 v3.7.0 h1:AGSnbUyjtLiM+WJUb4dzXKldl/gL+F8OwmRDtVr6g2U= +github.com/urfave/cli/v3 v3.7.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= +github.com/vektah/gqlparser/v2 v2.5.32 h1:k9QPJd4sEDTL+qB4ncPLflqTJ3MmjB9SrVzJrawpFSc= +github.com/vektah/gqlparser/v2 v2.5.32/go.mod h1:c1I28gSOVNzlfc4WuDlqU7voQnsqI6OG2amkBAFmgts= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0 h1:ZVg+kCXxd9LtAaQNKBxAvJ5NpMf7LpvEr4MIZqb0TMQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.16.0/go.mod h1:hh0tMeZ75CCXrHd9OXRYxTlCAdxcXioWHFIpYw2rZu8= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0 h1:djrxvDxAe44mJUrKataUbOhCKhR3F8QCyWucO16hTQs= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.16.0/go.mod h1:dt3nxpQEiSoKvfTVxp3TUg5fHPLhKtbcnN3Z1I1ePD0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0 h1:klTViGcsvLCd1xN3rZzfZ12NslC/OimbmR+k+A006RI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.45.0/go.mod h1:jRsK04CWmXuY8A0O+wMpSf+t90RHZ53o5Qmxn2PQPfk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0 h1:pnxy6c/kvNBWdNNFzqpjuJLm9Hjhgk/Q0nY221rwuk0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.45.0/go.mod h1:qw6YsFapotRwoDhXRZvljzaOvCQB7UfnafEJagpN2TA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 h1:QRefszxJmfPdjXUUm3j6iDzY03mTPXMjqErFqQ67vUg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0/go.mod h1:Tiz03lTBVBrm7eWZBOidzEaYaJa8tjwGUGv6d8mlTyk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 h1:fG5MCxGz8+2VtrN/WgqSpJFctVz24gpxj8CxkKmc8Ww= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0/go.mod h1:BmAYTn+3ysbRe+IU2msxmf5Rx3g6DHvex+tWI3LdhYI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0 h1:QBajQ2SrwQijzHyZbQlPsuIzpl/ll8DY6wPWsajeGcI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.45.0/go.mod h1:08ZQLjrPLQ6R4kAXvuOvODEer5Yh4CoFvll5qB2BCI8= +go.opentelemetry.io/otel/log v0.16.0 h1:DeuBPqCi6pQwtCK0pO4fvMB5eBq6sNxEnuTs88pjsN4= +go.opentelemetry.io/otel/log v0.16.0/go.mod h1:rWsmqNVTLIA8UnwYVOItjyEZDbKIkMxdQunsIhpUMes= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/metric/x v0.67.0 h1:PcicCNZFkZ4bXfSooXdo3WN7RBOVOtjVdo1wD358Uns= +go.opentelemetry.io/otel/metric/x v0.67.0/go.mod h1:FBjCWZe6wgcqxcMtjdGiClDKXb2YxxXii0CXftE4QtI= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= +go.opentelemetry.io/otel/sdk/log v0.16.0 h1:e/b4bdlQwC5fnGtG3dlXUrNOnP7c8YLVSpSfEBIkTnI= +go.opentelemetry.io/otel/sdk/log v0.16.0/go.mod h1:JKfP3T6ycy7QEuv3Hj8oKDy7KItrEkus8XJE6EoSzw4= +go.opentelemetry.io/otel/sdk/log/logtest v0.16.0 h1:/XVkpZ41rVRTP4DfMgYv1nEtNmf65XPPyAdqV90TMy4= +go.opentelemetry.io/otel/sdk/log/logtest v0.16.0/go.mod h1:iOOPgQr5MY9oac/F5W86mXdeyWZGleIx3uXO98X2R6Y= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= +go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc= +google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= +google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/prebuild-check/dagger.json b/prebuild-check/dagger.json new file mode 100644 index 0000000..de1c8d8 --- /dev/null +++ b/prebuild-check/dagger.json @@ -0,0 +1,14 @@ +{ + "name": "prebuild-check", + "engineVersion": "v0.21.11", + "sdk": { + "source": "go" + }, + "source": ".", + "include": [ + "./main.go", + "./lockfile.go", + "./pinning.go", + "./report.go" + ] +} diff --git a/prebuild-check/lockfile.go b/prebuild-check/lockfile.go new file mode 100644 index 0000000..31e83b9 --- /dev/null +++ b/prebuild-check/lockfile.go @@ -0,0 +1,324 @@ +package main + +// Lockfile present-and-in-sync check (ADR-0093 §10 item 2, WP-13 13b). +// +// Pure: it judges a map of repository-relative path -> file content, so it is +// tested without a Dagger engine. main.go reads the files from the mounted +// source and posts the result. +// +// Outcomes (the ADR-0093 §10 rule): +// +// not_applicable no package ecosystem in the repository (a static site): passes +// ran every declared ecosystem was checked; findings list what failed +// +// "No lockfile for a declared ecosystem" is a FINDING (lockfile_missing), never +// a pass and never could_not_run: the check ran and the lockfile is not there. + +import ( + "encoding/json" + "path" + "sort" + "strings" +) + +// LockfileFinding is one lockfile problem. Kind is lockfile_missing, +// lockfile_out_of_sync or lockfile_changed_without_manifest. +type LockfileFinding struct { + Kind string `json:"kind"` + Ecosystem string `json:"ecosystem"` + Manifest string `json:"manifest"` + Lockfile string `json:"lockfile,omitempty"` + Detail string `json:"detail,omitempty"` +} + +// LockfileReport is what the check posts (report_data of scan_type lockfile). +type LockfileReport struct { + Outcome string `json:"outcome"` + Ecosystems []string `json:"ecosystems"` + Findings []LockfileFinding `json:"lockfile_findings"` +} + +// skippedDir reports whether a path lies in a vendored / generated tree whose +// manifests are not the repository's own. +func skippedDir(p string) bool { + for _, seg := range strings.Split(p, "/") { + switch seg { + case "node_modules", "vendor", ".git", "dist", "build", "target", ".venv", "venv", "__pycache__": + return true + } + } + return false +} + +func exists(files map[string]string, p string) bool { + _, ok := files[p] + return ok +} + +func firstExisting(files map[string]string, dir string, names ...string) string { + for _, n := range names { + p := path.Join(dir, n) + if exists(files, p) { + return p + } + } + return "" +} + +// pythonLockfiles returns the lockfile a pyproject.toml's declared tool needs, +// or "" when it declares no locking tool (PEP 621 metadata alone). +func pythonTool(pyproject string) (tool, lock string) { + switch { + case strings.Contains(pyproject, "[tool.poetry"): + return "poetry", "poetry.lock" + case strings.Contains(pyproject, "[tool.uv"): + return "uv", "uv.lock" + case strings.Contains(pyproject, "[tool.pdm"): + return "pdm", "pdm.lock" + } + return "", "" +} + +// npmManifestDeps returns the dependency names a package.json declares. +func npmManifestDeps(content string) (map[string]bool, bool) { + var pkg struct { + Dependencies map[string]any `json:"dependencies"` + DevDependencies map[string]any `json:"devDependencies"` + } + if err := json.Unmarshal([]byte(content), &pkg); err != nil { + return nil, false + } + out := map[string]bool{} + for k := range pkg.Dependencies { + out[k] = true + } + for k := range pkg.DevDependencies { + out[k] = true + } + return out, true +} + +// npmLockRootDeps returns the root dependency names a package-lock.json v2/v3 +// records (packages[""]), and false when the lock has no such section (v1). +func npmLockRootDeps(content string) (map[string]bool, bool) { + var lock struct { + Packages map[string]struct { + Dependencies map[string]any `json:"dependencies"` + DevDependencies map[string]any `json:"devDependencies"` + } `json:"packages"` + } + if err := json.Unmarshal([]byte(content), &lock); err != nil { + return nil, false + } + root, ok := lock.Packages[""] + if !ok { + return nil, false + } + out := map[string]bool{} + for k := range root.Dependencies { + out[k] = true + } + for k := range root.DevDependencies { + out[k] = true + } + return out, true +} + +func setDiff(a, b map[string]bool) []string { + var out []string + for k := range a { + if !b[k] { + out = append(out, k) + } + } + sort.Strings(out) + return out +} + +func goModRequires(content string) bool { + for _, line := range strings.Split(content, "\n") { + l := strings.TrimSpace(line) + if strings.HasPrefix(l, "require ") || l == "require (" || strings.HasPrefix(l, "require(") { + return true + } + } + return false +} + +// CheckLockfiles judges every manifest under files. changed lists the +// repository-relative paths the change touched (the diff range); nil when the +// job does not know it, which skips only the changed-without-manifest rule. +func CheckLockfiles(files map[string]string, changed []string) LockfileReport { + ecos := map[string]bool{} + var findings []LockfileFinding + paths := make([]string, 0, len(files)) + for p := range files { + if !skippedDir(p) { + paths = append(paths, p) + } + } + sort.Strings(paths) + + // manifest -> lockfile actually used, for the changed-without-manifest rule. + pairs := map[string]string{} + missing := func(eco, manifest, lock string) { + findings = append(findings, LockfileFinding{ + Kind: "lockfile_missing", Ecosystem: eco, Manifest: manifest, Lockfile: lock, + }) + } + + for _, p := range paths { + dir, base := path.Dir(p), path.Base(p) + switch base { + case "package.json": + ecos["npm"] = true + lock := firstExisting(files, dir, "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock") + if lock == "" { + // A workspace member is locked by the root's lockfile. + if root := firstExisting(files, ".", "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock"); root != "" && dir != "." { + pairs[p] = root + continue + } + missing("npm", p, path.Join(dir, "package-lock.json")) + continue + } + pairs[p] = lock + if path.Base(lock) == "package-lock.json" { + want, okM := npmManifestDeps(files[p]) + have, okL := npmLockRootDeps(files[lock]) + if okM && okL { + if add, drop := setDiff(want, have), setDiff(have, want); len(add)+len(drop) > 0 { + findings = append(findings, LockfileFinding{ + Kind: "lockfile_out_of_sync", Ecosystem: "npm", Manifest: p, Lockfile: lock, + Detail: "not in lockfile: " + strings.Join(add, ",") + "; only in lockfile: " + strings.Join(drop, ","), + }) + } + } + } + case "pyproject.toml": + tool, lockName := pythonTool(files[p]) + if tool == "" { + continue + } + ecos["pypi"] = true + if lock := firstExisting(files, dir, lockName); lock != "" { + pairs[p] = lock + } else { + missing("pypi", p, path.Join(dir, lockName)) + } + case "requirements.in": + ecos["pypi"] = true + if lock := firstExisting(files, dir, "requirements.txt"); lock != "" { + pairs[p] = lock + } else { + missing("pypi", p, path.Join(dir, "requirements.txt")) + } + case "Pipfile": + ecos["pypi"] = true + if lock := firstExisting(files, dir, "Pipfile.lock"); lock != "" { + pairs[p] = lock + } else { + missing("pypi", p, path.Join(dir, "Pipfile.lock")) + } + case "requirements.txt": + // Its own lock when every line is pinned; pinning is the pinning check's job. + ecos["pypi"] = true + case "go.mod": + ecos["go"] = true + if !goModRequires(files[p]) { + continue + } + if lock := firstExisting(files, dir, "go.sum"); lock != "" { + pairs[p] = lock + } else { + missing("go", p, path.Join(dir, "go.sum")) + } + case "Cargo.toml": + ecos["cargo"] = true + // A workspace member is locked at the workspace root. + if lock := firstExisting(files, dir, "Cargo.lock"); lock != "" { + pairs[p] = lock + } else if !exists(files, "Cargo.lock") { + missing("cargo", p, path.Join(dir, "Cargo.lock")) + } + case "composer.json": + ecos["composer"] = true + if lock := firstExisting(files, dir, "composer.lock"); lock != "" { + pairs[p] = lock + } else { + missing("composer", p, path.Join(dir, "composer.lock")) + } + case "Gemfile": + ecos["ruby"] = true + if lock := firstExisting(files, dir, "Gemfile.lock"); lock != "" { + pairs[p] = lock + } else { + missing("ruby", p, path.Join(dir, "Gemfile.lock")) + } + case "build.gradle", "build.gradle.kts": + // Gradle locking is opt-in ("where used"): only a build that turned + // dependency locking on needs gradle.lockfile. + if !strings.Contains(files[p], "dependencyLocking") { + continue + } + ecos["gradle"] = true + if lock := firstExisting(files, dir, "gradle.lockfile"); lock != "" { + pairs[p] = lock + } else { + missing("gradle", p, path.Join(dir, "gradle.lockfile")) + } + } + } + + if changed != nil { + touched := map[string]bool{} + for _, c := range changed { + touched[strings.TrimPrefix(strings.TrimSpace(c), "./")] = true + } + manifests := make([]string, 0, len(pairs)) + for m := range pairs { + manifests = append(manifests, m) + } + sort.Strings(manifests) + for _, m := range manifests { + lock := pairs[m] + if touched[lock] && !touched[m] { + findings = append(findings, LockfileFinding{ + Kind: "lockfile_changed_without_manifest", Ecosystem: ecoOf(path.Base(m)), + Manifest: m, Lockfile: lock, + }) + } + } + } + + report := LockfileReport{Outcome: "ran", Findings: findings} + for e := range ecos { + report.Ecosystems = append(report.Ecosystems, e) + } + sort.Strings(report.Ecosystems) + if len(report.Ecosystems) == 0 { + report.Outcome = "not_applicable" + } + if report.Findings == nil { + report.Findings = []LockfileFinding{} + } + return report +} + +func ecoOf(manifest string) string { + switch manifest { + case "package.json": + return "npm" + case "pyproject.toml", "requirements.in", "Pipfile": + return "pypi" + case "go.mod": + return "go" + case "Cargo.toml": + return "cargo" + case "composer.json": + return "composer" + case "Gemfile": + return "ruby" + } + return "gradle" +} diff --git a/prebuild-check/main.go b/prebuild-check/main.go new file mode 100644 index 0000000..8428355 --- /dev/null +++ b/prebuild-check/main.go @@ -0,0 +1,447 @@ +// Package main implements the IntegraCI prebuild-check Dagger module. +// +// The pre-build checklist of ADR-0093 §10 that had no module (WP-13): +// +// lockfile item 2: a lockfile present and in sync per ecosystem (13b) +// pinning item 7: floating ranges, unpinned FROM, unpinned uses: (13e) +// manifests item 7: the dependency manifests, posted to the PLATFORM's +// typosquat check (POST /api/v1/supply-chain/dependency-scan); +// the platform decides, the job does not (13e) +// api-lint item 6: spectral over an OpenAPI document with the +// api-rulesets content pack (13d) +// tests item 5: a test report's counts and coverage (13f) +// +// No function fails the pipeline on what it FOUND: each posts a scan row and +// the platform's security verdict decides (ADR-0093 §10, "no item fails the +// pipeline on its own exit code"). A check that applies and could not execute +// posts outcome=could_not_run, which the verdict reads as unknown, never pass. +// +// Engines: spectral (stoplight/spectral, Apache-2.0) only. Nothing copyleft. +// +// Usage (from the analysis job; WP-05 renders the calls): +// +// dagger call lockfile --source . --api-url $API --token env:TOKEN --service-id $SVC --version $SHA +// dagger call pinning --source . --api-url $API --token env:TOKEN --service-id $SVC --version $SHA +// dagger call manifests --source . --api-url $API --token env:TOKEN --service-id $SVC --version $SHA +// dagger call api-lint --source . --rulesets ./rulesets --api-url $API --token env:TOKEN --service-id $SVC --version $SHA +package main + +import ( + "bytes" + "context" + "dagger/prebuild-check/internal/dagger" + "encoding/json" + "errors" + "fmt" + "net/http" + "path" + "strings" + "time" +) + +// PrebuildCheck is the IntegraCI pre-build checklist module. +type PrebuildCheck struct{} + +// CheckResult is what each function returns to the pipeline (for its log). +type CheckResult struct { + Check string `json:"check"` + Outcome string `json:"outcome"` // ran | not_applicable | could_not_run + Findings int `json:"findings"` + Posted bool `json:"posted"` + Error string `json:"error,omitempty"` +} + +const spectralImage = "stoplight/spectral:6.14.2" + +// maxFileBytes bounds what is read per manifest; a larger "manifest" is not one. +const maxFileBytes = 2 << 20 + +var manifestGlobs = []string{ + "**/package.json", "**/package-lock.json", "**/npm-shrinkwrap.json", "**/yarn.lock", + "**/pnpm-lock.yaml", "**/bun.lock", "**/bun.lockb", + "**/pyproject.toml", "**/poetry.lock", "**/uv.lock", "**/pdm.lock", + "**/requirements.in", "**/requirements.txt", "**/Pipfile", "**/Pipfile.lock", + "**/go.mod", "**/go.sum", "**/Cargo.toml", "**/Cargo.lock", + "**/composer.json", "**/composer.lock", "**/Gemfile", "**/Gemfile.lock", + "**/build.gradle", "**/build.gradle.kts", "**/gradle.lockfile", +} + +var pinningGlobs = []string{ + "**/Dockerfile", "**/Dockerfile.*", "**/*.Dockerfile", "**/Containerfile", + ".github/workflows/*.yml", ".github/workflows/*.yaml", + "**/package.json", "**/requirements.txt", +} + +var specGlobs = []string{ + "openapi.yaml", "openapi.yml", "openapi.json", + "**/openapi*.yaml", "**/openapi*.yml", "**/openapi*.json", + "**/swagger.yaml", "**/swagger.yml", "**/swagger.json", +} + +// readFiles collects the files matching globs (deduplicated, vendored trees +// skipped). A read error is returned: the caller posts could_not_run. +func readFiles(ctx context.Context, source *dagger.Directory, globs []string, contents bool) (map[string]string, error) { + out := map[string]string{} + for _, g := range globs { + matches, err := source.Glob(ctx, g) + if err != nil { + return nil, fmt.Errorf("glob %s: %w", g, err) + } + for _, m := range matches { + m = strings.TrimPrefix(m, "./") + if _, seen := out[m]; seen || skippedDir(m) { + continue + } + if !contents || strings.HasSuffix(m, ".lockb") { + out[m] = "" + continue + } + f := source.File(m) + size, err := f.Size(ctx) + if err != nil { + return nil, fmt.Errorf("stat %s: %w", m, err) + } + if size > maxFileBytes { + out[m] = "" + continue + } + c, err := f.Contents(ctx) + if err != nil { + return nil, fmt.Errorf("read %s: %w", m, err) + } + out[m] = c + } + } + return out, nil +} + +// errChangedUnknown is the could_not_run reason when the caller had no range. +var errChangedUnknown = errors.New("the change's file range could not be computed, so the lockfile-changed-without-manifest rule was not judged") + +func splitChanged(changed string) []string { + if strings.TrimSpace(changed) == "" { + return nil + } + var out []string + for _, f := range strings.FieldsFunc(changed, func(r rune) bool { return r == '\n' || r == ',' }) { + if f = strings.TrimSpace(f); f != "" { + out = append(out, f) + } + } + return out +} + +// Lockfile checks every declared ecosystem has a lockfile in sync with its +// manifest and posts scan_type=lockfile. +func (m *PrebuildCheck) Lockfile( + ctx context.Context, + source *dagger.Directory, + // Paths the change touched (newline or comma separated; the push/PR diff + // range). Empty skips only the "lockfile changed without its manifest" rule. + // +optional + changed string, + // The caller could not compute the change's file range (no usable base + // commit). The "lockfile changed without its manifest" rule then cannot be + // judged, so the row is could_not_run (the verdict reads unknown), never an + // empty list that silently skips the rule (WP-13 review, 2026-11-05). + // +optional + changedUnknown bool, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // +optional + version string, +) (*CheckResult, error) { + res := &CheckResult{Check: "lockfile"} + files, err := readFiles(ctx, source, manifestGlobs, true) + if err == nil && changedUnknown { + err = errChangedUnknown + } + var report LockfileReport + if err != nil { + res.Outcome, res.Error = "could_not_run", err.Error() + report = LockfileReport{Outcome: "could_not_run", Ecosystems: []string{}, Findings: []LockfileFinding{}} + } else { + report = CheckLockfiles(files, splitChanged(changed)) + res.Outcome, res.Findings = report.Outcome, len(report.Findings) + } + data := map[string]any{ + "outcome": report.Outcome, + "ecosystems": report.Ecosystems, + "lockfile_findings": report.Findings, + } + if res.Error != "" { + data["error"] = truncate(res.Error, 500) + } + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "lockfile", "integraci-lockfile", len(report.Findings), len(report.Findings), 0, 0, data, + )) +} + +// Pinning reports floating version ranges, FROM images not pinned to a digest +// and GitHub Actions not pinned to a commit SHA. Posts scan_type=pinning +// (warn-only in the verdict). +func (m *PrebuildCheck) Pinning( + ctx context.Context, + source *dagger.Directory, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // +optional + version string, +) (*CheckResult, error) { + res := &CheckResult{Check: "pinning", Outcome: "ran"} + findings := []PinningFinding{} + files, err := readFiles(ctx, source, pinningGlobs, true) + if err != nil { + res.Outcome, res.Error = "could_not_run", err.Error() + } else { + findings = CheckPinning(files) + if len(files) == 0 { + res.Outcome = "not_applicable" + } + } + res.Findings = len(findings) + if len(findings) > 500 { + findings = findings[:500] + } + data := map[string]any{"outcome": res.Outcome, "pinning_findings": findings} + if res.Error != "" { + data["error"] = truncate(res.Error, 500) + } + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "pinning", "integraci-pinning", res.Findings, 0, 0, res.Findings, data, + )) +} + +// Manifests posts each npm / PyPI manifest to the platform's typosquat check. +// The platform decides (and, air-gapped, asks only the tenant's mirror); this +// function never calls a package registry itself. +func (m *PrebuildCheck) Manifests( + ctx context.Context, + source *dagger.Directory, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // +optional + version string, +) (*CheckResult, error) { + res := &CheckResult{Check: "manifests", Outcome: "ran"} + files, err := readFiles(ctx, source, []string{"**/package.json", "**/requirements.txt"}, true) + if err != nil { + res.Outcome, res.Error = "could_not_run", err.Error() + // Nothing posted: with no platform package-check row of this commit the + // verdict's dependencies family is unknown, never pass. + return res, err + } + posted := 0 + for _, p := range sortedKeys(files) { + eco := map[string]string{"package.json": "npm", "requirements.txt": "pypi"}[path.Base(p)] + if eco == "" || files[p] == "" { + continue + } + body := map[string]any{ + "ecosystem": eco, + "manifest": files[p], + "service_id": serviceID, + "version": version, + "check_registry": true, + "on_typosquat": "block", + } + if err := m.post(ctx, res, apiURL, token, "/api/v1/supply-chain/dependency-scan", body); err != nil { + return res, err + } + posted++ + } + if posted == 0 { + // No npm / PyPI manifest: the platform records not_applicable from the + // lockfile row's ecosystem list (prebuild_verdict), nothing is posted. + res.Outcome = "not_applicable" + } + return res, nil +} + +// ApiLint runs spectral over each OpenAPI document with the api-rulesets +// pack's ruleset. No document: an explicit outcome=not_applicable row is +// posted (ADR-0093 §10 item 6), because in enforce the verdict reads a MISSING +// scan of record as unknown, never as "no spec". Posts scan_type=api_lint, +// report-only in the verdict. +func (m *PrebuildCheck) ApiLint( + ctx context.Context, + source *dagger.Directory, + // The api-rulesets content pack directory (catalog/api-rulesets): its + // golden-path/ruleset.yaml is used. + rulesets *dagger.Directory, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // +optional + version string, +) (*CheckResult, error) { + res := &CheckResult{Check: "api_lint"} + specs, err := readFiles(ctx, source, specGlobs, false) + if err != nil { + res.Outcome, res.Error = "could_not_run", err.Error() + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "api_lint", "spectral", 0, 0, 0, 0, + map[string]any{"outcome": "could_not_run", "error": truncate(err.Error(), 500)}, + )) + } + if len(specs) == 0 { + // Said out loud: a missing row is "the check did not report", which the + // verdict must not read as green. + res.Outcome = "not_applicable" + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "api_lint", "spectral", 0, 0, 0, 0, + map[string]any{"outcome": "not_applicable"}, + )) + } + args := []string{"spectral", "lint", "--ruleset", "/rulesets/golden-path/ruleset.yaml", "--format", "json", "--fail-severity", "error", "--quiet"} + args = append(args, sortedKeys(specs)...) + out, err := dag.Container(). + From(spectralImage). + WithMountedDirectory("/src", source). + WithMountedDirectory("/rulesets", rulesets). + WithWorkdir("/src"). + // spectral exits 1 on lint errors; `|| true` keeps "found something" + // apart from "could not run", which is an unreadable report below. + WithExec([]string{"sh", "-c", shellJoin(args) + " > /tmp/spectral.json || true"}). + File("/tmp/spectral.json"). + Contents(ctx) + counts, perr := spectralCounts(out) + if err != nil || perr != nil { + msg := fmt.Sprint(err) + if perr != nil { + msg = perr.Error() + } + res.Outcome, res.Error = "could_not_run", msg + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "api_lint", "spectral", 0, 0, 0, 0, + map[string]any{"outcome": "could_not_run", "error": truncate(msg, 500)}, + )) + } + res.Outcome = "ran" + res.Findings = counts[0] + counts[1] + counts[2] + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "api_lint", "spectral", res.Findings, 0, counts[0], counts[1]+counts[2], + map[string]any{"outcome": "ran", "specs": sortedKeys(specs)}, + )) +} + +// Tests posts a test report's result (item 5). Run in the branch / pull +// request job, after the tests: they execute the change's code, so never in +// the analysis job. Counts come from the job's own test step. +func (m *PrebuildCheck) Tests( + ctx context.Context, + total int, + failed int, + // +optional + errored int, + // Line coverage in percent; negative = not measured. + // +optional + // +default=-1 + coverage float64, + // The test step could not run (no report): posted as could_not_run. + // +optional + couldNotRun bool, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // +optional + version string, +) (*CheckResult, error) { + res := &CheckResult{Check: "tests", Outcome: "ran", Findings: failed + errored} + data := map[string]any{"outcome": "ran", "tests_total": total, "tests_failed": failed, "tests_errored": errored} + if couldNotRun { + res.Outcome = "could_not_run" + data = map[string]any{"outcome": "could_not_run"} + } else if coverage >= 0 { + data["coverage_percent"] = coverage + } + return res, m.post(ctx, res, apiURL, token, "/api/v1/scans", scanPayload( + serviceID, version, "tests", "integraci-tests", failed+errored, 0, failed+errored, 0, data, + )) +} + +// ─── helpers ────────────────────────────────────────────────────────────────── + +// scanPayload builds a POST /scans body. The severity COLUMNS stay zero on +// purpose: the deploy gate's legacy scan layer reads critical/high/medium of +// EVERY row of a version as CVE counts, so a lint error or a failed test there +// would deny a deploy as a CVE. The counts ride in report_data +// (prebuild_counts), which only the platform's pre-build judge reads. +func scanPayload(serviceID, version, scanType, scanner string, total, critical, high, medium int, data map[string]any) map[string]any { + data["prebuild_counts"] = map[string]int{"critical": critical, "high": high, "medium": medium} + return map[string]any{ + "service_id": serviceID, + "version": version, + "scan_type": scanType, + "scanner": scanner, + "report_format": "json", + "findings_count": total, + "report_data": data, + } +} + +// post sends body when the API is configured; a local run (no URL or token) +// posts nothing. A failed post is an error: an unposted check must not look +// like a posted pass. +func (m *PrebuildCheck) post(ctx context.Context, res *CheckResult, apiURL string, token *dagger.Secret, route string, body map[string]any) error { + if apiURL == "" || token == nil { + return nil + } + raw, err := json.Marshal(body) + if err != nil { + return fmt.Errorf("marshal %s payload: %w", res.Check, err) + } + req, err := http.NewRequestWithContext(ctx, http.MethodPost, strings.TrimRight(apiURL, "/")+route, bytes.NewReader(raw)) + if err != nil { + return fmt.Errorf("build request: %w", err) + } + tok, err := token.Plaintext(ctx) + if err != nil { + return fmt.Errorf("read token secret: %w", err) + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer "+tok) + resp, err := (&http.Client{Timeout: 60 * time.Second}).Do(req) + if err != nil { + return fmt.Errorf("post %s: %w", route, err) + } + defer resp.Body.Close() + if resp.StatusCode >= 300 { + return fmt.Errorf("post %s returned %d", route, resp.StatusCode) + } + res.Posted = true + return nil +} + +func truncate(s string, n int) string { + if len(s) <= n { + return s + } + return s[:n] +} + +func shellJoin(args []string) string { + q := make([]string, len(args)) + for i, a := range args { + q[i] = "'" + strings.ReplaceAll(a, "'", `'"'"'`) + "'" + } + return strings.Join(q, " ") +} diff --git a/prebuild-check/pinning.go b/prebuild-check/pinning.go new file mode 100644 index 0000000..6a4da19 --- /dev/null +++ b/prebuild-check/pinning.go @@ -0,0 +1,142 @@ +package main + +// Dependency pinning check (ADR-0093 §10 item 7, WP-13 13e). Pure. +// +// Findings (each only ever WARNS in the verdict): +// +// floating_range a package.json version range (^, ~, *, x, >, >=, latest) +// or a requirements.txt line without == +// unpinned_from a Dockerfile FROM that is not pinned to an @sha256 digest +// unpinned_uses a GitHub Actions `uses:` not pinned to a 40-hex commit SHA + +import ( + "encoding/json" + "path" + "regexp" + "sort" + "strings" +) + +// PinningFinding is one unpinned reference. +type PinningFinding struct { + Kind string `json:"kind"` + File string `json:"file"` + Line int `json:"line,omitempty"` + Ref string `json:"ref"` +} + +var ( + fromRe = regexp.MustCompile(`(?i)^\s*FROM\s+(?:--platform=\S+\s+)?(\S+)(?:\s+AS\s+(\S+))?`) + usesRe = regexp.MustCompile(`^\s*-?\s*uses:\s*["']?([^"'\s#]+)`) + shaRe = regexp.MustCompile(`@[0-9a-f]{40}$`) + digestRe = regexp.MustCompile(`@sha256:[0-9a-f]{64}$`) + npmExactRe = regexp.MustCompile(`^v?\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$`) + reqPinnedRe = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._-]*(?:\[[^\]]*\])?\s*===?\s*[^\s,;*]+\s*(?:;.*)?$`) +) + +func isDockerfile(base string) bool { + return base == "Dockerfile" || strings.HasPrefix(base, "Dockerfile.") || strings.HasSuffix(base, ".Dockerfile") || base == "Containerfile" +} + +func isWorkflow(p string) bool { + return strings.HasPrefix(p, ".github/workflows/") && (strings.HasSuffix(p, ".yml") || strings.HasSuffix(p, ".yaml")) +} + +// npmRefPinned reports whether a package.json value names one exact version. +// Non-registry refs (git, file, link, workspace, npm: aliases with exact +// versions) are not ranges and are left to the lockfile. +func npmRefPinned(v string) bool { + v = strings.TrimSpace(v) + for _, p := range []string{"file:", "link:", "workspace:", "git+", "git:", "github:", "http:", "https:", "portal:", "patch:"} { + if strings.HasPrefix(v, p) { + return true + } + } + if strings.HasPrefix(v, "npm:") { + if i := strings.LastIndex(v, "@"); i > 0 { + v = v[i+1:] + } + } + return npmExactRe.MatchString(v) +} + +// CheckPinning scans the given files (repository-relative path -> content). +func CheckPinning(files map[string]string) []PinningFinding { + paths := make([]string, 0, len(files)) + for p := range files { + if !skippedDir(p) { + paths = append(paths, p) + } + } + sort.Strings(paths) + out := []PinningFinding{} + for _, p := range paths { + content, base := files[p], path.Base(p) + switch { + case isDockerfile(base): + stages := map[string]bool{} + for i, line := range strings.Split(content, "\n") { + m := fromRe.FindStringSubmatch(line) + if m == nil { + continue + } + ref := m[1] + // scratch, an EARLIER build stage, or a build-arg image (judged + // where the arg is set) are not registry pulls. Stages are + // recorded after the check, so `FROM x AS x` is still a pull. + local := strings.EqualFold(ref, "scratch") || stages[strings.ToLower(ref)] || strings.Contains(ref, "$") + if m[2] != "" { + stages[strings.ToLower(m[2])] = true + } + if !local && !digestRe.MatchString(ref) { + out = append(out, PinningFinding{Kind: "unpinned_from", File: p, Line: i + 1, Ref: ref}) + } + } + case isWorkflow(p): + for i, line := range strings.Split(content, "\n") { + m := usesRe.FindStringSubmatch(line) + if m == nil { + continue + } + ref := m[1] + if strings.HasPrefix(ref, "./") || (strings.HasPrefix(ref, "docker://") && digestRe.MatchString(ref)) { + continue + } + if !shaRe.MatchString(ref) { + out = append(out, PinningFinding{Kind: "unpinned_uses", File: p, Line: i + 1, Ref: ref}) + } + } + case base == "package.json": + var pkg struct { + Dependencies map[string]string `json:"dependencies"` + DevDependencies map[string]string `json:"devDependencies"` + } + if json.Unmarshal([]byte(content), &pkg) != nil { + continue + } + for _, deps := range []map[string]string{pkg.Dependencies, pkg.DevDependencies} { + names := make([]string, 0, len(deps)) + for n := range deps { + names = append(names, n) + } + sort.Strings(names) + for _, n := range names { + if !npmRefPinned(deps[n]) { + out = append(out, PinningFinding{Kind: "floating_range", File: p, Ref: n + "@" + deps[n]}) + } + } + } + case base == "requirements.txt": + for i, raw := range strings.Split(content, "\n") { + line := strings.TrimSpace(strings.SplitN(raw, "#", 2)[0]) + if line == "" || strings.HasPrefix(line, "-") { + continue + } + if !reqPinnedRe.MatchString(line) { + out = append(out, PinningFinding{Kind: "floating_range", File: p, Line: i + 1, Ref: line}) + } + } + } + } + return out +} diff --git a/prebuild-check/prebuild_test.go b/prebuild-check/prebuild_test.go new file mode 100644 index 0000000..6a48464 --- /dev/null +++ b/prebuild-check/prebuild_test.go @@ -0,0 +1,120 @@ +package main + +import ( + "strings" + "testing" +) + +func kinds(r LockfileReport) []string { + var out []string + for _, f := range r.Findings { + out = append(out, f.Kind+":"+f.Manifest) + } + return out +} + +// Mutant: treat "no lockfile" as a pass -> this test fails. +func TestPoetryWithoutLockIsMissing(t *testing.T) { + r := CheckLockfiles(map[string]string{"pyproject.toml": "[tool.poetry]\nname='x'\n"}, nil) + if r.Outcome != "ran" || len(r.Findings) != 1 || r.Findings[0].Kind != "lockfile_missing" { + t.Fatalf("got %+v", r) + } +} + +// Mutant: report "no ecosystem" as could_not_run -> this test fails. +func TestStaticSiteIsNotApplicable(t *testing.T) { + r := CheckLockfiles(map[string]string{"index.html": "", "css/site.css": ""}, nil) + if r.Outcome != "not_applicable" || len(r.Findings) != 0 { + t.Fatalf("got %+v", r) + } +} + +func TestLockedEcosystemsPass(t *testing.T) { + files := map[string]string{ + "pyproject.toml": "[tool.uv]\n", "uv.lock": "", + "go.mod": "module x\nrequire github.com/a/b v1.0.0\n", "go.sum": "", + "Cargo.toml": "", "Cargo.lock": "", + "web/package.json": `{"dependencies":{"react":"18.3.1"}}`, + "web/package-lock.json": `{"packages":{"":{"dependencies":{"react":"18.3.1"}}}}`, + } + if r := CheckLockfiles(files, nil); len(r.Findings) != 0 { + t.Fatalf("unexpected findings %v", kinds(r)) + } +} + +func TestNpmLockOutOfSync(t *testing.T) { + files := map[string]string{ + "package.json": `{"dependencies":{"react":"18.3.1","axios":"1.7.0"}}`, + "package-lock.json": `{"packages":{"":{"dependencies":{"react":"18.3.1"}}}}`, + } + r := CheckLockfiles(files, nil) + if len(r.Findings) != 1 || r.Findings[0].Kind != "lockfile_out_of_sync" || !strings.Contains(r.Findings[0].Detail, "axios") { + t.Fatalf("got %+v", r.Findings) + } +} + +func TestLockChangedWithoutManifest(t *testing.T) { + files := map[string]string{"composer.json": "{}", "composer.lock": "{}"} + r := CheckLockfiles(files, []string{"composer.lock"}) + if len(r.Findings) != 1 || r.Findings[0].Kind != "lockfile_changed_without_manifest" { + t.Fatalf("got %+v", r.Findings) + } + if r := CheckLockfiles(files, []string{"composer.lock", "composer.json"}); len(r.Findings) != 0 { + t.Fatalf("both changed is in sync: %+v", r.Findings) + } +} + +func TestVendoredManifestsAreIgnored(t *testing.T) { + r := CheckLockfiles(map[string]string{"node_modules/x/package.json": "{}"}, nil) + if r.Outcome != "not_applicable" { + t.Fatalf("got %+v", r) + } +} + +func TestGoModWithoutRequiresNeedsNoSum(t *testing.T) { + if r := CheckLockfiles(map[string]string{"go.mod": "module x\n\ngo 1.25\n"}, nil); len(r.Findings) != 0 { + t.Fatalf("got %+v", r.Findings) + } +} + +func TestPinning(t *testing.T) { + files := map[string]string{ + "Dockerfile": "FROM golang:1.25 AS build\nFROM build AS test\nFROM gcr.io/distroless/static@sha256:" + + strings.Repeat("a", 64) + "\nFROM scratch\nFROM ${BASE}\n", + ".github/workflows/ci.yml": "steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-go@" + + strings.Repeat("b", 40) + "\n - uses: ./local-action\n", + "package.json": `{"dependencies":{"react":"^18.3.1","axios":"1.7.0","x":"workspace:*"}}`, + "requirements.txt": "requests==2.32.3\nflask>=3\n# comment\n-r other.txt\n", + } + got := map[string]bool{} + for _, f := range CheckPinning(files) { + got[f.Kind+" "+f.Ref] = true + } + want := []string{ + "unpinned_from golang:1.25", + "unpinned_uses actions/checkout@v4", + "floating_range react@^18.3.1", + "floating_range flask>=3", + } + for _, w := range want { + if !got[w] { + t.Errorf("missing finding %q in %v", w, got) + } + } + if len(got) != len(want) { + t.Errorf("unexpected findings: %v", got) + } +} + +func TestSpectralCounts(t *testing.T) { + c, err := spectralCounts(`[{"severity":0},{"severity":1},{"severity":3}]`) + if err != nil || c != [3]int{1, 1, 1} { + t.Fatalf("got %v %v", c, err) + } + if c, err := spectralCounts("[]"); err != nil || c != [3]int{} { + t.Fatalf("clean: %v %v", c, err) + } + if _, err := spectralCounts("Error: spectral crashed"); err == nil { + t.Fatal("an unreadable report must be could_not_run, not a clean lint") + } +} diff --git a/prebuild-check/report.go b/prebuild-check/report.go new file mode 100644 index 0000000..c7cd6b9 --- /dev/null +++ b/prebuild-check/report.go @@ -0,0 +1,40 @@ +package main + +import ( + "encoding/json" + "fmt" + "sort" +) + +// spectralCounts reads spectral's JSON report: [errors, warnings, info+hint]. +// An empty report is a clean lint ("[]"); anything not a JSON array means +// spectral did not produce its report, which is an error (could_not_run). +func spectralCounts(report string) ([3]int, error) { + var out [3]int + var results []struct { + Severity int `json:"severity"` + } + if err := json.Unmarshal([]byte(report), &results); err != nil { + return out, fmt.Errorf("spectral report unreadable: %w", err) + } + for _, r := range results { + switch r.Severity { + case 0: + out[0]++ + case 1: + out[1]++ + default: + out[2]++ + } + } + return out, nil +} + +func sortedKeys(m map[string]string) []string { + out := make([]string, 0, len(m)) + for k := range m { + out = append(out, k) + } + sort.Strings(out) + return out +} diff --git a/release/dagger.json b/release/dagger.json index d87d296..c827970 100644 --- a/release/dagger.json +++ b/release/dagger.json @@ -1,6 +1,6 @@ { "name": "release", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/sast-scan/README.md b/sast-scan/README.md index fd26197..6a909d6 100644 --- a/sast-scan/README.md +++ b/sast-scan/README.md @@ -32,6 +32,45 @@ When `tool=none`, the scan is skipped and a result with `skipped=true` is returned. Results are POSTed to the API only when both `api-url` and `token` are set. +## Air-gapped rules (`--rules-dir`, ADR-0093 §8) + +`semgrep --config=auto` fetches its rules from the Semgrep registry and sends +the project URL, so it cannot run air-gapped. Pass `--rules-dir` with the +extracted `sast-rules` content pack (`catalog/sast-rules`, ADR-0078) and the +module runs `semgrep scan --config=/rules --metrics=off` with +`SEMGREP_SEND_METRICS=off` and `SEMGREP_ENABLE_VERSION_CHECK=0`. `auto` is +never used then. The argument builder is `semgrep_args.go`, tested without an +engine in `semgrep_args_test.go`. + +Without `--rules-dir` the legacy `--config=auto` run is unchanged and does +NOT get `--metrics=off`: semgrep refuses that pair ("Cannot create auto config +when metrics are off", exit 2). + +Licences: the pack holds only in-house or permissively licensed rule files +(the Semgrep-maintained registry rules are under the Semgrep Rules License +v1.0, which forbids redistribution). The semgrep engine (LGPL-2.1) is never +bundled by IntegraCI; the customer's mirror pulls `semgrep/semgrep` from +upstream. + +```sh +dagger call sarif --source . --rules-dir ./sast-rules export --path=integraci-sarif/sast.sarif +``` + +### Which ruleset ran (#2908) + +`--rules-dir` accepts any directory, and SARIF does not say which rule files +produced it. `scan` therefore digests the directory it mounts at `/rules` +(`ruleset.go`: for each non-hidden file in byte order of its relative path, +`\0\n`, then `sha256:` + the sha256 of those lines) and +posts it as `report_data.sast_ruleset_digest`. The platform computes the digest +of the pack it ships (`catalog/sast-rules/rules`) itself and compares; where +the gate point and the `sast` family both enforce, a SAST scan of record with +no digest (no `--rules-dir`, CodeQL) or another one is `unknown`. The posted +value is never taken as the pack's digest. Paths with a hidden segment +(`.gitkeep`) are skipped on both sides. The API image and the pack the runners +mount must be deployed together: a pack revision the API image does not carry +reads `unknown`. + ## Usage > These commands are illustrative and have NOT been run here. Verify against diff --git a/sast-scan/dagger.json b/sast-scan/dagger.json index 300c185..e2acd9a 100644 --- a/sast-scan/dagger.json +++ b/sast-scan/dagger.json @@ -1,6 +1,6 @@ { "name": "sast-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, @@ -8,6 +8,8 @@ "include": [ "./main.go", "./qualitygate.go", - "./gate.go" + "./gate.go", + "./semgrep_args.go", + "./ruleset.go" ] } diff --git a/sast-scan/main.go b/sast-scan/main.go index e90a46d..807bfdb 100644 --- a/sast-scan/main.go +++ b/sast-scan/main.go @@ -8,7 +8,8 @@ // Supported tools (each runs the vendor's canonical CLI inside its official // container image): // -// semgrep semgrep/semgrep semgrep scan --config=auto --error +// semgrep semgrep/semgrep semgrep scan --config=/rules --metrics=off --error (with --rules-dir) +// semgrep scan --config=auto --error (legacy, no --rules-dir) // sonarqube sonarsource/sonar-scanner-cli sonar-scanner (SONAR_TOKEN + SONAR_HOST_URL) // codeql codeql CLI bundle database create + database analyze // snyk-code snyk/snyk snyk code test --severity-threshold= @@ -22,6 +23,7 @@ // dagger call scan --source . --tool snyk-code --vendor-token env:SNYK_TOKEN --severity high // dagger call scan --source . --tool codeql --language python // dagger call scan --source . --tool none +// dagger call scan --source . --rules-dir ./sast-rules # air-gap: rules from the sast-rules pack package main import ( @@ -60,6 +62,13 @@ type ScanResult struct { // stage red on `warn`; on `block` Scan returns an error instead. GateDecision string `json:"gate_decision,omitempty"` GateReason string `json:"gate_reason,omitempty"` + // `.semgrepignore` files the scan of record removed (ADR-0093 §4). + IgnoredSuppressions []string `json:"ignored_suppressions,omitempty"` + // sha256 of the rules directory semgrep ran (ruleset.go, #2908). Empty + // when no --rules-dir was given (registry `auto`, CodeQL's query packs): + // the platform then cannot tell which rules ran, and an enforcing verdict + // reads the scan as `unknown`. + RulesetDigest string `json:"ruleset_digest,omitempty"` } // Scan runs a SAST pass over the source directory with the selected tool, @@ -117,6 +126,18 @@ func (m *SastScan) Scan( // and the UAT door judges SonarQube by it (ADR-0072). // +optional revision string, + // The analysis job of record (ADR-0093 §4, WP-05): the repository's + // `.semgrepignore` is removed from the scanned copy and semgrep ignores + // inline `nosemgrep` comments, so a change cannot silence its own finding. + // Off for every other caller. + // +optional + scanOfRecord bool, + // The extracted `sast-rules` content pack (ADR-0078, ADR-0093 §8): its + // rules/ tree is what semgrep runs, with --metrics=off and never + // --config=auto. Omitted: the legacy --config=auto, which fetches the + // Semgrep registry and cannot run air-gapped. + // +optional + rulesDir *dagger.Directory, ) (*ScanResult, error) { result := &ScanResult{Tool: tool} // The pipeline installs the dagger CLI at ./bin/dagger and mirrors the @@ -124,6 +145,21 @@ func (m *SastScan) Scan( // the platform's code, not the tenant's; a SAST pass over them charges every // tenant with findings in Go it never wrote. Only these two paths go. source = source.WithoutFile("bin/dagger").WithoutDirectory(".integraci-modules") + if scanOfRecord { + removed, err := source.Glob(ctx, "**/.semgrepignore") + if err != nil { + return nil, fmt.Errorf("list .semgrepignore for the scan of record: %w", err) + } + top, err := source.Glob(ctx, ".semgrepignore") + if err != nil { + return nil, fmt.Errorf("list .semgrepignore for the scan of record: %w", err) + } + removed = append(top, removed...) + if len(removed) > 0 { + source = source.WithoutFiles(removed) + } + result.IgnoredSuppressions = removed + } var ( report string @@ -136,7 +172,15 @@ func (m *SastScan) Scan( result.Success = true return result, nil case "semgrep": - report, result.SarifPath, err = m.runSemgrep(ctx, source) + if rulesDir != nil { + // Digest EXACTLY the directory runSemgrep mounts at /rules, before + // the run: a scan whose ruleset cannot be named is not posted. + result.RulesetDigest, err = rulesetDigestOf(ctx, rulesDir.Directory(semgrepRulesSubdir)) + if err != nil { + return nil, fmt.Errorf("semgrep sast scan failed: %w", err) + } + } + report, result.SarifPath, err = m.runSemgrep(ctx, source, rulesDir, scanOfRecord) case "sonarqube": report, result.QualityGate, err = m.runSonarQube(ctx, source, sonarToken, sonarHostURL, sonarProjectKey) case "codeql": @@ -157,8 +201,19 @@ func (m *SastScan) Scan( } result.Report = report + if scanOfRecord { + // A scan of record that loaded no rules, or whose tool reported an + // execution error, did not analyse anything: posting it would make an + // empty run the trust=analysis evidence a commit is judged on. + if err := checkRecordReport(tool, report); err != nil { + return nil, err + } + } var parsed bool - result.Findings, result.Errors, result.Warnings, parsed = tallyFindings(report) + // The scan of record counts a result the tool marked suppressed (CodeQL + // `// codeql[...]` alert-suppression comments, SARIF `suppressions`): an + // in-repo comment cannot silence its own finding (ADR-0093 §4). + result.Findings, result.Errors, result.Warnings, parsed = tallyFindings(report, scanOfRecord) // A SARIF tool whose output parsed as nothing at all did not scan: snyk's // `|| true` prints `Authentication error` to stdout, a truncated file has no // results. Posting that as a clean scan is a green gate over an empty run, @@ -209,6 +264,9 @@ func (m *SastScan) Sarif( // +optional // +default="python" language string, + // The extracted `sast-rules` content pack; see Scan. + // +optional + rulesDir *dagger.Directory, ) (*dagger.File, error) { // Same exclusion as Scan: the CLI and the mirrored modules are the // platform's code, not the tenant's. @@ -219,7 +277,7 @@ func (m *SastScan) Sarif( ) switch strings.ToLower(tool) { case "semgrep": - report, _, err = m.runSemgrep(ctx, source) + report, _, err = m.runSemgrep(ctx, source, rulesDir, false) case "codeql": report, _, err = m.runCodeQL(ctx, source, language) default: @@ -228,7 +286,7 @@ func (m *SastScan) Sarif( if err != nil { return nil, fmt.Errorf("%s sarif failed: %w", tool, err) } - if _, _, _, parsed := tallyFindings(report); !parsed { + if _, _, _, parsed := tallyFindings(report, false); !parsed { return nil, fmt.Errorf("%s produced no parseable SARIF report (%d bytes)", tool, len(report)) } return dag.Directory().WithNewFile("sast.sarif", report).File("sast.sarif"), nil @@ -239,23 +297,33 @@ func (m *SastScan) Sarif( // exec DECLARES that a non-zero exit is an expected outcome; without that the // report can never be read back and a scan that finds something is // indistinguishable from a scan that could not run. -func (m *SastScan) runSemgrep(ctx context.Context, source *dagger.Directory) (string, string, error) { +// +// With rulesDir (the `sast-rules` pack) the rules come from the pack and nothing +// reaches semgrep.dev (semgrep_args.go); without it, the legacy registry run. +// The engine image itself is pulled from upstream or the customer's mirror, +// never bundled by IntegraCI (semgrep is LGPL-2.1; AGENTS.md rule 3). +// +// For the scan of record (disableNosem) the exit code is checked too: semgrep +// exits 0 (nothing found) or 1 (`--error`, findings); any other code is a run +// that failed, and its SARIF is not evidence of an analysis. +func (m *SastScan) runSemgrep(ctx context.Context, source *dagger.Directory, rulesDir *dagger.Directory, disableNosem bool) (string, string, error) { const sarifPath = "/tmp/semgrep-results.sarif" - semgrep := dag.Container(). - From("semgrep/semgrep:1.99.0"). + fromPack := rulesDir != nil + semgrep := dag.Container().From("semgrep/semgrep:1.99.0") + if fromPack { + semgrep = semgrep.WithMountedDirectory(semgrepRulesMount, rulesDir.Directory(semgrepRulesSubdir)) + for _, kv := range semgrepEnv(true) { + semgrep = semgrep.WithEnvVariable(kv[0], kv[1]) + } + } else { // Persist the semgrep registry rule cache across runs (--config=auto // otherwise re-fetches the rulesets on every scan). - WithMountedCache("/root/.cache/semgrep", dag.CacheVolume("semgrep-rules")). + semgrep = semgrep.WithMountedCache("/root/.cache/semgrep", dag.CacheVolume("semgrep-rules")) + } + semgrep = semgrep. WithMountedDirectory("/src", source). WithWorkdir("/src"). - WithExec([]string{ - "semgrep", "scan", - "--config=auto", - "--error", - "--sarif", - "--output", sarifPath, - ".", - }, dagger.ContainerWithExecOpts{ + WithExec(semgrepArgs(sarifPath, fromPack, disableNosem), dagger.ContainerWithExecOpts{ // `--error` makes semgrep exit 1 the moment it finds anything, and a // container whose exec failed cannot be read from: every later // `.File(...).Contents()` re-raises that same failure. Swallowing the @@ -272,6 +340,15 @@ func (m *SastScan) runSemgrep(ctx context.Context, source *dagger.Directory) (st Expect: dagger.ReturnTypeAny, }) + if disableNosem { + code, err := semgrep.ExitCode(ctx) + if err != nil { + return "", "", fmt.Errorf("read semgrep exit code: %w", err) + } + if !semgrepRanToCompletion(code) { + return "", "", fmt.Errorf("semgrep exited %d: the scan of record did not run to completion", code) + } + } sarif, err := semgrep.File(sarifPath).Contents(ctx) if err != nil { return "", "", fmt.Errorf("read semgrep SARIF output: %w", err) @@ -279,6 +356,76 @@ func (m *SastScan) runSemgrep(ctx context.Context, source *dagger.Directory) (st return sarif, sarifPath, nil } +// semgrepRanToCompletion: 0 = no finding, 1 = findings (`--error`). Every +// other exit code (2 fatal, 3-8 parse/config/rule errors, 13 missing config, +// 14 rule download failure, ...) is a run that did not analyse the tree. +func semgrepRanToCompletion(code int) bool { + return code == 0 || code == 1 +} + +// checkRecordReport refuses a SARIF report as the scan of record when it is +// not evidence that the tool analysed anything (ADR-0093 §4, WP-05): no run, +// a run whose driver declares zero rules (a registry fetch that failed behind +// an air gap still writes a well-formed empty SARIF), or a run whose +// invocation reports an `error`-level tool execution notification or +// `executionSuccessful: false`. Only for SARIF tools; sonarqube reports +// through its server. +func checkRecordReport(tool, report string) error { + if tool == "sonarqube" { + return nil + } + var doc struct { + Runs []struct { + Tool struct { + Driver struct { + Rules []json.RawMessage `json:"rules"` + } `json:"driver"` + // CodeQL declares its queries' rules on the query-pack + // extensions, not on the driver. + Extensions []struct { + Rules []json.RawMessage `json:"rules"` + } `json:"extensions"` + } `json:"tool"` + Invocations []struct { + ExecutionSuccessful *bool `json:"executionSuccessful"` + Notifications []struct { + Level string `json:"level"` + Message struct { + Text string `json:"text"` + } `json:"message"` + } `json:"toolExecutionNotifications"` + } `json:"invocations"` + } `json:"runs"` + } + if err := json.Unmarshal([]byte(report), &doc); err != nil || len(doc.Runs) == 0 { + return fmt.Errorf("%s: no SARIF run; refusing to record an analysis that did not happen", tool) + } + for _, run := range doc.Runs { + rules := len(run.Tool.Driver.Rules) + for _, ext := range run.Tool.Extensions { + rules += len(ext.Rules) + } + if rules == 0 { + return fmt.Errorf("%s: the run loaded no rules; refusing to record it as the scan of record", tool) + } + for _, inv := range run.Invocations { + if inv.ExecutionSuccessful != nil && !*inv.ExecutionSuccessful { + return fmt.Errorf("%s: the run reports executionSuccessful=false", tool) + } + for _, n := range inv.Notifications { + if strings.EqualFold(n.Level, "error") { + msg := n.Message.Text + if len(msg) > 200 { + msg = msg[:200] + } + return fmt.Errorf("%s: tool execution error: %s", tool, msg) + } + } + } + } + return nil +} + // runSonarQube runs the SonarQube scanner CLI against the source. The // scanner authenticates with SONAR_TOKEN and targets the server at // SONAR_HOST_URL, both injected from secrets/params. @@ -488,7 +635,10 @@ func (m *SastScan) runCheckmarx( // // `parsed` is false when the text is not SARIF; the caller decides what that // means for the tool that produced it. -func tallyFindings(report string) (total, blocking, warnings int, parsed bool) { +// +// countSuppressed (the scan of record) counts a result the tool marked +// suppressed as a finding: the suppression came from the judged repository. +func tallyFindings(report string, countSuppressed bool) (total, blocking, warnings int, parsed bool) { type rule struct { ID string `json:"id"` DefaultConfiguration struct { @@ -526,7 +676,7 @@ func tallyFindings(report string) (total, blocking, warnings int, parsed bool) { if res.Kind != "" && res.Kind != "fail" { continue // pass / notApplicable / informational: not a finding } - if len(res.Suppressions) > 0 { + if len(res.Suppressions) > 0 && !countSuppressed { continue // suppressed inline, as the gate message invites } total++ @@ -621,17 +771,23 @@ func (m *SastScan) postResults( "high_count": 0, "medium_count": result.Warnings, "report_data": map[string]any{ - "sast_errors": result.Errors, - "secret_count": 0, - "dast_high": 0, - "dast_critical": 0, - "sbom_present": false, - "signed": false, + "ignored_suppressions": result.IgnoredSuppressions, + "sast_errors": result.Errors, + "secret_count": 0, + "dast_high": 0, + "dast_critical": 0, + "sbom_present": false, + "signed": false, }, } if revision != "" { payload["revision"] = revision } + if result.RulesetDigest != "" { + // Compared by the platform with the digest of the pack IT ships + // (security_verdict, #2908); never trusted as the pack's own digest. + payload["report_data"].(map[string]any)[rulesetReportKey] = result.RulesetDigest + } if result.QualityGate != "" { // Read by the deploy gate (`quality_gate_failed`) and the integration graph. payload["report_data"].(map[string]any)["quality_gate"] = result.QualityGate diff --git a/sast-scan/record_test.go b/sast-scan/record_test.go new file mode 100644 index 0000000..be97cda --- /dev/null +++ b/sast-scan/record_test.go @@ -0,0 +1,95 @@ +package main + +// The scan of record (ADR-0093 §4, WP-05): a SARIF that is not evidence of an +// analysis is refused, and an in-repository suppression does not silence a +// finding. Written on the build VM, not run there (owner decision 2026-10-11). + +import ( + "strings" + "testing" +) + +const oneRule = `{"id":"python.lang.security.audit.eval","defaultConfiguration":{"level":"error"}}` + +func sarif(rules, results, invocations string) string { + return `{"version":"2.1.0","runs":[{"tool":{"driver":{"name":"semgrep","rules":[` + rules + + `]}},"results":[` + results + `],"invocations":[` + invocations + `]}]}` +} + +func TestARecordRunThatLoadedNoRulesIsRefused(t *testing.T) { + // What an air-gapped `--config=auto` leaves behind: well-formed, empty. + err := checkRecordReport("semgrep", sarif("", "", `{"executionSuccessful":true}`)) + if err == nil || !strings.Contains(err.Error(), "no rules") { + t.Fatalf("an empty rule set must not be a scan of record, got %v", err) + } +} + +func TestARecordRunWithAToolErrorIsRefused(t *testing.T) { + for name, inv := range map[string]string{ + "notification": `{"executionSuccessful":true,"toolExecutionNotifications":[{"level":"error","message":{"text":"Failed to download config from https://semgrep.dev/c/auto"}}]}`, + "unsuccessful": `{"executionSuccessful":false}`, + } { + if err := checkRecordReport("semgrep", sarif(oneRule, "", inv)); err == nil { + t.Errorf("%s: a failed run must not be a scan of record", name) + } + } + if err := checkRecordReport("codeql", `{"runs":[]}`); err == nil { + t.Error("no run at all must not be a scan of record") + } + if err := checkRecordReport("semgrep", "Authentication error"); err == nil { + t.Error("unparseable output must not be a scan of record") + } +} + +// Legal direction: a clean run that loaded rules is a scan of record, and a +// warning-level notification does not refuse it. +func TestACleanRecordRunIsAccepted(t *testing.T) { + inv := `{"executionSuccessful":true,"toolExecutionNotifications":[{"level":"warning","message":{"text":"Syntax error at line 3 in a.py"}}]}` + if err := checkRecordReport("semgrep", sarif(oneRule, "", inv)); err != nil { + t.Fatalf("a clean run must be recorded: %v", err) + } + if err := checkRecordReport("sonarqube", "anything"); err != nil { + t.Fatalf("sonarqube is not SARIF on stdout: %v", err) + } +} + +// CodeQL declares rules on tool.extensions (query packs), not on the driver. +func TestACodeQLRunWithRulesOnItsExtensionsIsAccepted(t *testing.T) { + report := `{"runs":[{"tool":{"driver":{"name":"CodeQL","rules":[]},"extensions":[{"name":"codeql/python-queries","rules":[` + + oneRule + `]}]},"results":[],"invocations":[{"executionSuccessful":true}]}]}` + if err := checkRecordReport("codeql", report); err != nil { + t.Fatalf("a CodeQL run with pack rules must be recorded: %v", err) + } + empty := `{"runs":[{"tool":{"driver":{"name":"CodeQL"},"extensions":[{"name":"p","rules":[]}]},"results":[]}]}` + if err := checkRecordReport("codeql", empty); err == nil { + t.Fatal("a CodeQL run with no rules anywhere must be refused") + } +} + +func TestSemgrepExitCodes(t *testing.T) { + for _, ok := range []int{0, 1} { + if !semgrepRanToCompletion(ok) { + t.Errorf("exit %d is a completed run", ok) + } + } + for _, bad := range []int{2, 3, 4, 7, 13, 14, 127} { + if semgrepRanToCompletion(bad) { + t.Errorf("exit %d must not count as a completed run", bad) + } + } +} + +func TestAnInlineSuppressionCountsInTheScanOfRecordOnly(t *testing.T) { + report := sarif(oneRule, + `{"ruleId":"python.lang.security.audit.eval","ruleIndex":0,"level":"error","suppressions":[{"kind":"inSource"}]}`, + `{"executionSuccessful":true}`) + total, blocking, _, parsed := tallyFindings(report, true) + if !parsed || total != 1 || blocking != 1 { + t.Fatalf("scan of record: total=%d blocking=%d parsed=%v, want 1/1/true", total, blocking, parsed) + } + // Every other caller keeps honouring it, as before. + total, blocking, _, _ = tallyFindings(report, false) + if total != 0 || blocking != 0 { + t.Fatalf("outside the scan of record: total=%d blocking=%d, want 0/0", total, blocking) + } +} diff --git a/sast-scan/ruleset.go b/sast-scan/ruleset.go new file mode 100644 index 0000000..a4a8646 --- /dev/null +++ b/sast-scan/ruleset.go @@ -0,0 +1,94 @@ +package main + +// The ruleset a SAST run used, recorded with the scan (#2908, ADR-0093 §8). +// +// `--rules-dir` accepts any directory and a SARIF report does not say which +// rule files produced it, so a near-empty rules directory would post a clean +// scan of record. The module therefore digests the directory it mounted and +// posts it as `report_data.sast_ruleset_digest`; the platform compares it with +// the digest IT computes from the pack it ships (`catalog/sast-rules/rules`, +// `apps/api/app/security/services/sast_ruleset.py`) and never with a value the +// caller supplies. The two implementations must agree byte for byte: the test +// vector in ruleset_test.go is the same one the Python test pins. + +import ( + "context" + "crypto/sha256" + "dagger/sast-scan/internal/dagger" + "encoding/hex" + "fmt" + "sort" + "strings" +) + +// rulesetReportKey is the report_data key the digest is posted under +// (`security_verdict.SAST_RULESET_KEY` on the platform). +const rulesetReportKey = "sast_ruleset_digest" + +// rulesetDigestPrefix names the algorithm, as an image digest does. +const rulesetDigestPrefix = "sha256:" + +// rulesetDigest is the digest of a rules tree given as relative POSIX path -> +// file bytes. Deterministic: for each path in byte order, the line +// `\x00\n`, and the sha256 of all the lines. +// A file's name is part of the digest (renaming a rule file changes it) and +// the NUL separator keeps a path from running into its hash. An empty tree has +// a digest too (the sha256 of nothing); it is not the platform pack's. +// +// A path with any hidden segment (".gitkeep", ".github/x.yaml") is skipped, as +// the platform does: semgrep does not load hidden config files, and the two +// listings (dagger Glob here, Path.rglob in Python) need not agree on whether +// they list dotfiles. +func rulesetDigest(files map[string][]byte) string { + paths := make([]string, 0, len(files)) + for p := range files { + if isHiddenPath(p) { + continue + } + paths = append(paths, p) + } + sort.Strings(paths) + h := sha256.New() + for _, p := range paths { + sum := sha256.Sum256(files[p]) + h.Write([]byte(p)) + h.Write([]byte{0}) + h.Write([]byte(hex.EncodeToString(sum[:]))) + h.Write([]byte{'\n'}) + } + return rulesetDigestPrefix + hex.EncodeToString(h.Sum(nil)) +} + +// isHiddenPath reports whether any segment of a relative path starts with ".". +func isHiddenPath(p string) bool { + for _, part := range strings.Split(p, "/") { + if strings.HasPrefix(part, ".") { + return true + } + } + return false +} + +// rulesetDigestOf digests every regular file under dir, the directory semgrep +// was given. A listing or read error is an error: a scan whose ruleset cannot +// be named is not posted with a guessed one. +func rulesetDigestOf(ctx context.Context, dir *dagger.Directory) (string, error) { + entries, err := dir.Glob(ctx, "**/*") + if err != nil { + return "", fmt.Errorf("list the rules directory: %w", err) + } + files := make(map[string][]byte, len(entries)) + for _, e := range entries { + // Directories are listed with a trailing slash; their files are listed + // on their own. + if strings.HasSuffix(e, "/") { + continue + } + body, err := dir.File(e).Contents(ctx) + if err != nil { + return "", fmt.Errorf("read rule file %s: %w", e, err) + } + files[strings.TrimPrefix(e, "./")] = []byte(body) + } + return rulesetDigest(files), nil +} diff --git a/sast-scan/ruleset_test.go b/sast-scan/ruleset_test.go new file mode 100644 index 0000000..2379a89 --- /dev/null +++ b/sast-scan/ruleset_test.go @@ -0,0 +1,83 @@ +package main + +// The ruleset digest (#2908). Written on the build VM, not run there (owner +// decision 2026-10-11). + +import ( + "strings" + "testing" +) + +// The cross-language vector: apps/api/tests/test_sast_ruleset_pin.py pins the +// SAME files to the SAME digest. If either side changes its encoding, one of +// the two tests fails. +const crossLanguageVector = "sha256:8fd4f707f97ff1e9f9d445830c1eaff610c1db0e96c3948039ebcbf7b04c1700" + +func vectorFiles() map[string][]byte { + return map[string][]byte{ + "python.yaml": []byte("rules: []\n"), + "nested/go.yaml": []byte("x"), + } +} + +func TestTheRulesetDigestMatchesThePlatformsEncoding(t *testing.T) { + if got := rulesetDigest(vectorFiles()); got != crossLanguageVector { + t.Fatalf("digest %s, want %s (the platform computes the pack's digest the same way)", got, crossLanguageVector) + } +} + +// Hidden paths are not part of the digest on either side (#2908 review): the +// Python twin pins the same vector with the same dotfiles added. +func TestHiddenPathsAreNotPartOfTheDigest(t *testing.T) { + files := vectorFiles() + files[".gitkeep"] = []byte("") + files[".hidden/x.yaml"] = []byte("y") + files["nested/.keep"] = []byte("z") + if got := rulesetDigest(files); got != crossLanguageVector { + t.Fatalf("dotfiles changed the digest: %s, want %s", got, crossLanguageVector) + } + // Legal direction: a visible file with a dot inside its name still counts. + files["a.b.yaml"] = []byte("rules: []\n") + if rulesetDigest(files) == crossLanguageVector { + t.Fatal("a visible rule file named a.b.yaml was skipped") + } +} + +func TestTheRulesetDigestIsDeterministic(t *testing.T) { + a := rulesetDigest(vectorFiles()) + for i := 0; i < 20; i++ { + if b := rulesetDigest(vectorFiles()); b != a { + t.Fatalf("map order changed the digest: %s vs %s", a, b) + } + } + if !strings.HasPrefix(a, "sha256:") || len(a) != len("sha256:")+64 { + t.Fatalf("digest %q is not sha256:<64 hex>", a) + } +} + +// Negative direction: every way of running fewer or other rules changes it. +func TestAnyChangeToTheRulesetChangesTheDigest(t *testing.T) { + base := rulesetDigest(vectorFiles()) + cases := map[string]map[string][]byte{ + "a file dropped": {"python.yaml": []byte("rules: []\n")}, + "a file edited": {"python.yaml": []byte("rules: [] \n"), "nested/go.yaml": []byte("x")}, + "a file renamed": {"python2.yaml": []byte("rules: []\n"), "nested/go.yaml": []byte("x")}, + "a file added": {"python.yaml": []byte("rules: []\n"), "nested/go.yaml": []byte("x"), "extra.yaml": nil}, + "an empty ruleset": {}, + // The separator: path and hash cannot run into each other. + "bytes moved into the name": {"python.yamlr": []byte("ules: []\n"), "nested/go.yaml": []byte("x")}, + } + for name, files := range cases { + if rulesetDigest(files) == base { + t.Errorf("%s: digest unchanged", name) + } + } +} + +func TestTheRulesetDigestIsPosted(t *testing.T) { + // postResults is not callable without an engine; the payload key is the + // contract the platform reads (security_verdict.SAST_RULESET_KEY). + if rulesetReportKey != "sast_ruleset_digest" { + t.Fatalf("report_data key %q changed; the platform reads sast_ruleset_digest", rulesetReportKey) + } +} diff --git a/sast-scan/semgrep_args.go b/sast-scan/semgrep_args.go new file mode 100644 index 0000000..9fdd0ce --- /dev/null +++ b/sast-scan/semgrep_args.go @@ -0,0 +1,60 @@ +package main + +// Semgrep's command line, kept apart from the Dagger calls so it can be tested +// without an engine (ADR-0093 §8, WP-09). +// +// Two modes: +// +// - rules from the `sast-rules` content pack (the scan of record, air-gap +// safe): `--config=/rules --metrics=off`, never `auto`. Nothing is fetched +// from the Semgrep registry and nothing is reported to it. +// - no pack given: the legacy `--config=auto`, which fetches the registry +// rules (Semgrep Rules License v1.0: the tenant's own internal use, from the +// tenant's own CI) and sends the project URL. It cannot run air-gapped. +// `--metrics=off` is NOT added here: semgrep refuses that pair outright +// ("Cannot create auto config when metrics are off", exit 2), so adding it +// would turn every existing pipeline red rather than make it private. + +// semgrepRulesMount is where the pack's rules/ tree is mounted in the container. +const semgrepRulesMount = "/rules" + +// semgrepRulesSubdir is the directory of the pack that holds the rule files. +// The pack root also carries LICENSES.yaml, which semgrep would try to load as +// a rule file, so only this subdirectory is mounted. +const semgrepRulesSubdir = "rules" + +// semgrepArgs is the exec line for one semgrep run writing SARIF to sarifPath. +// +// For the scan of record (disableNosem, ADR-0093 §4, WP-05) it also ignores +// inline `nosemgrep` comments: a change could otherwise mark its own finding +// as not a finding. +func semgrepArgs(sarifPath string, rulesFromPack, disableNosem bool) []string { + args := []string{"semgrep", "scan"} + if rulesFromPack { + args = append(args, "--config="+semgrepRulesMount, "--metrics=off") + } else { + args = append(args, "--config=auto") + } + args = append(args, "--error", "--sarif", "--output", sarifPath) + if disableNosem { + // `--no-git-ignore` too: a committed file listed in the repository's + // own .gitignore is still the repository's code, and a .gitignore line + // would otherwise drop it from the scan as a .semgrepignore line did. + args = append(args, "--disable-nosem", "--no-git-ignore") + } + return append(args, ".") +} + +// semgrepEnv is the environment of a pack run: no metrics and no version +// check (both are calls to semgrep.dev, which an air-gapped runner cannot make +// and a private one should not). Empty for the legacy `auto` run, for the +// reason in the file comment. +func semgrepEnv(rulesFromPack bool) [][2]string { + if !rulesFromPack { + return nil + } + return [][2]string{ + {"SEMGREP_SEND_METRICS", "off"}, + {"SEMGREP_ENABLE_VERSION_CHECK", "0"}, + } +} diff --git a/sast-scan/semgrep_args_test.go b/sast-scan/semgrep_args_test.go new file mode 100644 index 0000000..2290c24 --- /dev/null +++ b/sast-scan/semgrep_args_test.go @@ -0,0 +1,89 @@ +package main + +import ( + "strings" + "testing" +) + +func hasArg(args []string, want string) bool { + for _, a := range args { + if a == want { + return true + } + } + return false +} + +func TestPackRunNeverFetchesRegistryRules(t *testing.T) { + args := semgrepArgs("/tmp/out.sarif", true, false) + for _, a := range args { + if strings.Contains(a, "auto") { + t.Fatalf("a pack run must never use the registry config, got %q in %v", a, args) + } + } + if !hasArg(args, "--config=/rules") { + t.Fatalf("a pack run reads the mounted rules, got %v", args) + } +} + +func TestPackRunAlwaysTurnsMetricsOff(t *testing.T) { + args := semgrepArgs("/tmp/out.sarif", true, false) + if !hasArg(args, "--metrics=off") { + t.Fatalf("--metrics=off missing from %v", args) + } + env := map[string]string{} + for _, kv := range semgrepEnv(true) { + env[kv[0]] = kv[1] + } + if env["SEMGREP_SEND_METRICS"] != "off" || env["SEMGREP_ENABLE_VERSION_CHECK"] != "0" { + t.Fatalf("pack run env must disable metrics and the version check, got %v", env) + } +} + +func TestLegacyRunKeepsAutoWithoutMetricsOff(t *testing.T) { + // semgrep exits 2 on `--config=auto --metrics=off`; the legacy path must not + // carry the pair (the tightening mutant: always add --metrics=off). + args := semgrepArgs("/tmp/out.sarif", false, false) + if !hasArg(args, "--config=auto") { + t.Fatalf("legacy run lost --config=auto: %v", args) + } + if hasArg(args, "--metrics=off") { + t.Fatalf("semgrep refuses --metrics=off with --config=auto: %v", args) + } + if len(semgrepEnv(false)) != 0 { + t.Fatalf("legacy run must not set the metrics env either") + } +} + +func TestBothModesWriteSarifAndKeepFindingsAsExitCode(t *testing.T) { + for _, pack := range []bool{true, false} { + for _, record := range []bool{true, false} { + args := semgrepArgs("/tmp/x.sarif", pack, record) + if args[0] != "semgrep" || args[1] != "scan" || args[len(args)-1] != "." { + t.Fatalf("unexpected shape %v", args) + } + for _, want := range []string{"--sarif", "--error", "/tmp/x.sarif"} { + if !hasArg(args, want) { + t.Fatalf("%s missing from %v", want, args) + } + } + } + } +} + +// The scan of record ignores in-repo suppressions in BOTH rule modes, and no +// other run does (ADR-0093 §4, WP-05). +func TestScanOfRecordDisablesNosemInBothModes(t *testing.T) { + for _, pack := range []bool{true, false} { + args := semgrepArgs("/tmp/x.sarif", pack, true) + for _, want := range []string{"--disable-nosem", "--no-git-ignore"} { + if !hasArg(args, want) { + t.Fatalf("scan of record (pack=%v) lost %s: %v", pack, want, args) + } + } + other := semgrepArgs("/tmp/x.sarif", pack, false) + if hasArg(other, "--disable-nosem") || hasArg(other, "--no-git-ignore") { + t.Fatalf("a non-record run (pack=%v) must keep nosemgrep: %v", pack, other) + } + } +} diff --git a/sbom/dagger.json b/sbom/dagger.json index 813c98e..fbe0575 100644 --- a/sbom/dagger.json +++ b/sbom/dagger.json @@ -1,6 +1,6 @@ { "name": "sbom", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/sbom/main.go b/sbom/main.go index d1f904c..719721e 100644 --- a/sbom/main.go +++ b/sbom/main.go @@ -85,7 +85,7 @@ func (m *Sbom) Generate( // anchore/syft, CycloneDX JSON. Source dir or image. The anchore/syft // image is distroless (no shell), so copy the syft binary into alpine // — which has sh — for the mkdir + output redirect. - syftBin := dag.Container().From("anchore/syft:v1.18.1").File("/syft") + syftBin := dag.Container().From("anchore/syft:v1.56.0").File("/syft") return syftRegistryAuth(syftRegistryEnv(scanInput(dag.Container(). From("alpine:3.20"). WithFile("/usr/local/bin/syft", syftBin), source, auth), imageRef, registryInsecure), auth, registryPassword). @@ -98,7 +98,7 @@ func (m *Sbom) Generate( case "spdx-tools": // Practical SPDX generator: syft emitting SPDX JSON. Source or image. // anchore/syft is distroless; copy the binary into alpine for a shell. - syftBin := dag.Container().From("anchore/syft:v1.18.1").File("/syft") + syftBin := dag.Container().From("anchore/syft:v1.56.0").File("/syft") return syftRegistryAuth(syftRegistryEnv(scanInput(dag.Container(). From("alpine:3.20"). WithFile("/usr/local/bin/syft", syftBin), source, auth), imageRef, registryInsecure), auth, registryPassword). @@ -133,7 +133,7 @@ func (m *Sbom) Generate( target = imageRef } ctr := scanInput(dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). // Persist Trivy's vulnerability DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")), source, auth) script := fmt.Sprintf("mkdir -p /out && trivy %s --format cyclonedx --output /out/sbom.cdx.json %s", subcmd, target) diff --git a/secret-scan/dagger.json b/secret-scan/dagger.json index ef35d68..ee65358 100644 --- a/secret-scan/dagger.json +++ b/secret-scan/dagger.json @@ -1,11 +1,12 @@ { "name": "secret-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, "source": ".", "include": [ - "./main.go" + "./main.go", + "./history.go" ] } diff --git a/secret-scan/history.go b/secret-scan/history.go new file mode 100644 index 0000000..ef27d18 --- /dev/null +++ b/secret-scan/history.go @@ -0,0 +1,195 @@ +package main + +// History secret scan (ADR-0093 §10 item 1, WP-13 13a). +// +// Run ONCE, when a service is onboarded: gitleaks over every commit of every +// ref (`git log --all`), not only the working tree. A secret that was ever +// committed is in the history whatever the tree says now; a change cannot fix +// it, only a rotation can. So the findings are the service's BASELINE: posted +// with report_data.scope = "history", which the security verdict never reads +// as evidence about a change (security_verdict / prebuild_verdict), and the +// platform opens a rotation task for each one. +// +// What is posted is the finding's LOCATION and FINGERPRINT (gitleaks' +// `:::`), never the secret: `--redact` is on and the +// report's Secret / Match fields are dropped before anything leaves the job. +// +// The source MUST carry its .git directory (a full clone, not a shallow one; +// `fetch-depth: 0`). A tree without history is refused (could_not_run), never +// scanned as if it were the history: that would report "nothing ever leaked" +// for a repository whose past was not read. + +import ( + "bytes" + "context" + "dagger/secret-scan/internal/dagger" + "encoding/json" + "fmt" + "net/http" + "strings" + "time" +) + +// HistoryFinding is one secret found in the history, without the secret. +type HistoryFinding struct { + Fingerprint string `json:"fingerprint"` + Rule string `json:"rule"` + File string `json:"file"` + Line int `json:"line"` + Commit string `json:"commit"` +} + +// HistoryResult is what History returns and posts. +type HistoryResult struct { + Outcome string `json:"outcome"` // ran | could_not_run + Findings []HistoryFinding `json:"findings"` + Posted bool `json:"posted"` + Error string `json:"error,omitempty"` +} + +// historyArgs is the gitleaks argv for the history scan. A function so the +// test pins it: no `--no-git` (that would scan only the tree), every ref. +func historyArgs(reportPath string) []string { + return []string{ + "gitleaks", "detect", "--source=/src", + "--log-opts=--all", + "--redact", + "--exit-code", "0", + "--report-format", "json", "--report-path", reportPath, + } +} + +// parseHistoryReport turns gitleaks' JSON report into findings with no secret +// material. Unknown fields (Secret, Match, ...) are not decoded at all. +func parseHistoryReport(report string) ([]HistoryFinding, error) { + var raw []struct { + RuleID string `json:"RuleID"` + File string `json:"File"` + StartLine int `json:"StartLine"` + Commit string `json:"Commit"` + Fingerprint string `json:"Fingerprint"` + } + if strings.TrimSpace(report) == "" { + return []HistoryFinding{}, nil + } + if err := json.Unmarshal([]byte(report), &raw); err != nil { + return nil, fmt.Errorf("gitleaks report unreadable: %w", err) + } + out := make([]HistoryFinding, 0, len(raw)) + for _, r := range raw { + fp := r.Fingerprint + if fp == "" { + fp = fmt.Sprintf("%s:%s:%s:%d", r.Commit, r.File, r.RuleID, r.StartLine) + } + out = append(out, HistoryFinding{ + Fingerprint: fp, Rule: r.RuleID, File: r.File, Line: r.StartLine, Commit: r.Commit, + }) + } + return out, nil +} + +// History scans the full git history of source once and posts the findings as +// the service's baseline (scan_type=secret, report_data.scope=history). +func (m *SecretScan) History( + ctx context.Context, + // A FULL clone including .git (fetch-depth 0). + source *dagger.Directory, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // The commit the clone is at (the onboarding revision). + // +optional + version string, +) (*HistoryResult, error) { + res := &HistoryResult{Outcome: "ran", Findings: []HistoryFinding{}} + entries, err := source.Entries(ctx) + hasGit := false + for _, e := range entries { + if strings.TrimSuffix(e, "/") == ".git" { + hasGit = true + } + } + if err != nil || !hasGit { + res.Outcome = "could_not_run" + res.Error = "the source has no .git directory: clone with full history (fetch-depth 0)" + return res, m.postHistory(ctx, res, apiURL, token, serviceID, version) + } + const reportPath = "/tmp/gitleaks-history.json" + report, err := dag.Container(). + From("zricethezav/gitleaks:v8.21.2"). + WithMountedDirectory("/src", source). + WithWorkdir("/src"). + WithExec(historyArgs(reportPath)). + File(reportPath). + Contents(ctx) + if err == nil { + res.Findings, err = parseHistoryReport(report) + } + if err != nil { + res.Outcome = "could_not_run" + res.Error = fmt.Sprintf("gitleaks history scan could not run: %v", err) + res.Findings = []HistoryFinding{} + } + return res, m.postHistory(ctx, res, apiURL, token, serviceID, version) +} + +func (m *SecretScan) postHistory(ctx context.Context, res *HistoryResult, apiURL string, token *dagger.Secret, serviceID, version string) error { + if apiURL == "" || token == nil { + return nil + } + findings := res.Findings + if len(findings) > 1000 { + findings = findings[:1000] + } + data := map[string]any{ + // The onboarding revision, NOT "version": the deploy gate and the + // verdict bind scans by version, and a baseline is not evidence about + // any commit (deploying the onboarding commit must not be blocked by + // secrets that only a rotation can fix). + "revision": version, + "scope": "history", + "outcome": res.Outcome, + // NOT secret_count, and no critical_count: the deploy gate's legacy + // layer reads those on the newest row when a deploy names no version, + // and a baseline must not deny any deploy (only a rotation fixes it). + "history_secret_count": len(res.Findings), + "history_findings": findings, + } + if res.Error != "" { + data["error"] = res.Error + } + body, err := json.Marshal(map[string]any{ + "service_id": serviceID, + "scan_type": "secret", + "scanner": "gitleaks-history", + "report_format": "json", + "findings_count": len(res.Findings), + "report_data": data, + }) + if err != nil { + return fmt.Errorf("marshal history payload: %w", err) + } + req, err := http.NewRequestWithContext(ctx, http.MethodPost, strings.TrimRight(apiURL, "/")+"/api/v1/scans", bytes.NewReader(body)) + if err != nil { + return fmt.Errorf("build request: %w", err) + } + tok, err := token.Plaintext(ctx) + if err != nil { + return fmt.Errorf("read token secret: %w", err) + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer "+tok) + resp, err := (&http.Client{Timeout: 60 * time.Second}).Do(req) + if err != nil { + return fmt.Errorf("post history scan: %w", err) + } + defer resp.Body.Close() + if resp.StatusCode >= 300 { + return fmt.Errorf("post history scan returned %d", resp.StatusCode) + } + res.Posted = true + return nil +} diff --git a/secret-scan/history_test.go b/secret-scan/history_test.go new file mode 100644 index 0000000..8ff58fa --- /dev/null +++ b/secret-scan/history_test.go @@ -0,0 +1,54 @@ +package main + +import ( + "strings" + "testing" +) + +// Mutant (13a): put "--no-git" back into historyArgs -> this test fails. +func TestHistoryScansEveryCommitNotTheTree(t *testing.T) { + args := strings.Join(historyArgs("/tmp/r.json"), " ") + if strings.Contains(args, "--no-git") { + t.Fatalf("the history scan must read git history, got %q", args) + } + for _, want := range []string{"--log-opts=--all", "--redact", "--exit-code 0", "--report-format json"} { + if !strings.Contains(args, want) { + t.Errorf("history argv lacks %q: %q", want, args) + } + } +} + +func TestHistoryReportKeepsNoSecret(t *testing.T) { + report := `[{"RuleID":"aws-access-token","File":"old/config.py","StartLine":3, + "Commit":"0123456789abcdef0123456789abcdef01234567","Secret":"AKIAREALSECRET", + "Match":"key = AKIAREALSECRET","Fingerprint":"0123:old/config.py:aws-access-token:3"}]` + got, err := parseHistoryReport(report) + if err != nil || len(got) != 1 { + t.Fatalf("got %v, %v", got, err) + } + if got[0].File != "old/config.py" || got[0].Line != 3 || got[0].Rule != "aws-access-token" { + t.Errorf("location lost: %+v", got[0]) + } + if strings.Contains(strings.Join([]string{got[0].Fingerprint, got[0].File, got[0].Rule, got[0].Commit}, " "), "AKIAREALSECRET") { + t.Errorf("a secret value leaked into the finding: %+v", got[0]) + } +} + +func TestHistoryReportFallsBackToALocationFingerprint(t *testing.T) { + got, err := parseHistoryReport(`[{"RuleID":"r","File":"f","StartLine":9,"Commit":"c"}]`) + if err != nil || got[0].Fingerprint != "c:f:r:9" { + t.Fatalf("got %v, %v", got, err) + } +} + +func TestAnEmptyHistoryIsNoFindingAndJunkIsAnError(t *testing.T) { + if got, err := parseHistoryReport(""); err != nil || len(got) != 0 { + t.Errorf("empty: %v, %v", got, err) + } + if got, err := parseHistoryReport("[]"); err != nil || len(got) != 0 { + t.Errorf("[]: %v, %v", got, err) + } + if _, err := parseHistoryReport("gitleaks: fatal"); err == nil { + t.Error("an unreadable report must be an error (could_not_run), not zero findings") + } +} diff --git a/security-scan/dagger.json b/security-scan/dagger.json index ad05722..02395d1 100644 --- a/security-scan/dagger.json +++ b/security-scan/dagger.json @@ -1,11 +1,12 @@ { "name": "security-scan", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, "source": ".", "include": [ - "./main.go" + "./main.go", + "./vulndb.go" ] } diff --git a/security-scan/main.go b/security-scan/main.go index 00bb0c0..f3a20b3 100644 --- a/security-scan/main.go +++ b/security-scan/main.go @@ -44,18 +44,28 @@ type SecurityScan struct{} // ScanResult contains the output of a security scan. type ScanResult struct { - TrivyFindings int `json:"trivy_findings"` - GitleaksFindings int `json:"gitleaks_findings"` - LicenseFindings int `json:"license_findings"` - ForbiddenFound int `json:"forbidden_found"` - Critical int `json:"critical"` - High int `json:"high"` - Medium int `json:"medium"` - SecretCount int `json:"secret_count"` - IacCritical int `json:"iac_critical"` - IacHigh int `json:"iac_high"` - SarifPath string `json:"sarif_path,omitempty"` - Success bool `json:"success"` + TrivyFindings int `json:"trivy_findings"` + GitleaksFindings int `json:"gitleaks_findings"` + LicenseFindings int `json:"license_findings"` + ForbiddenFound int `json:"forbidden_found"` + Critical int `json:"critical"` + High int `json:"high"` + Medium int `json:"medium"` + SecretCount int `json:"secret_count"` + IacCritical int `json:"iac_critical"` + IacHigh int `json:"iac_high"` + // IacScanned is true only when the IaC misconfig scan RAN. The zeros in + // iac_critical/iac_high are posted either way, so the security verdict + // (ADR-0093) reads this flag to tell "nothing found" from "not scanned". + IacScanned bool `json:"iac_scanned"` + // Suppression files the scan of record removed from the scanned copy + // (ADR-0093 §4). Empty for every other scan. + IgnoredSuppressions []string `json:"ignored_suppressions,omitempty"` + SarifPath string `json:"sarif_path,omitempty"` + // Trivy's VulnerabilityDB.UpdatedAt for an image scan (vulndb.go); empty + // when Trivy reported none. + VulnDBUpdatedAt string `json:"vuln_db_updated_at,omitempty"` + Success bool `json:"success"` } // LicenseReport summarises Trivy's license scan output. @@ -95,12 +105,25 @@ func (m *SecurityScan) Scan( // +optional // +default="none" cis string, + // The analysis job of record (ADR-0093 §4, WP-05): suppression files the + // repository ships are removed from the scanned copy, gitleaks ignores + // `gitleaks:allow`, and what was ignored is posted as information. Off for + // every other caller, so branch and pull request jobs scan as before. + // +optional + scanOfRecord bool, ) (*ScanResult, error) { result := &ScanResult{} source = withoutCITooling(source) + if scanOfRecord { + var err error + source, result.IgnoredSuppressions, err = withoutSuppression(ctx, source) + if err != nil { + return nil, err + } + } // Run Trivy filesystem scan - critical, high, medium, err := m.runTrivy(ctx, source) + critical, high, medium, err := m.runTrivy(ctx, source, scanOfRecord) if err != nil { return nil, fmt.Errorf("trivy scan failed: %w", err) } @@ -110,7 +133,7 @@ func (m *SecurityScan) Scan( result.TrivyFindings = critical + high + medium // Run Gitleaks secret detection - secretCount, err := m.runGitleaks(ctx, source) + secretCount, err := m.runGitleaks(ctx, source, scanOfRecord) if err != nil { return nil, fmt.Errorf("gitleaks failed: %w", err) } @@ -121,14 +144,18 @@ func (m *SecurityScan) Scan( // insecure Dockerfiles / k8s manifests / Terraform (open ports, missing // encryption, privileged containers, ...). Counts land in report_data as // iac_critical/iac_high, which the deploy OPA gate reads. When disabled - // they stay 0 — identical to the pre-existing payload, so no flag day. + // they stay 0 — identical to the pre-existing payload, so no flag day — + // and iac_scanned stays false, so the security verdict (ADR-0093) reads + // those zeros as "not scanned", never as "nothing found". if iacScan != "" && iacScan != "none" { - iacCritical, iacHigh, err := m.runTrivyConfig(ctx, source) + iacCritical, iacHigh, inline, err := m.runTrivyConfig(ctx, source, scanOfRecord) if err != nil { return nil, fmt.Errorf("trivy config (iac misconfig) scan failed: %w", err) } + result.IgnoredSuppressions = append(result.IgnoredSuppressions, inline...) result.IacCritical = iacCritical result.IacHigh = iacHigh + result.IacScanned = true } // Optional CIS Benchmark / hardening scan (opt-in). Trivy's docker-cis @@ -202,17 +229,92 @@ func (m *SecurityScan) ImageScan( } args = append(args, imageRef) ctr := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")) if registryUsername != "" && registryPassword != nil { ctr = ctr. WithEnvVariable("TRIVY_USERNAME", registryUsername). WithSecretVariable("TRIVY_PASSWORD", registryPassword) } - report, err := ctr.WithExec(args).File(reportPath).Contents(ctx) + scanned := ctr.WithExec(args) + report, err := scanned.File(reportPath).Contents(ctx) if err != nil { return nil, fmt.Errorf("trivy image scan of %s failed: %w", imageRef, err) } + // The age of the DB that scan used, read from the same cache with no + // network call (ADR-0093 §8). A failure here is not a scan failure: the + // platform treats a missing date as `cve = unknown`. + versionJSON, _ := scanned.WithExec([]string{"trivy", "version", "--format", "json"}).Stdout(ctx) + critical, high, medium := countTrivySeverities(report) + result := &ScanResult{ + Critical: critical, + High: high, + Medium: medium, + TrivyFindings: critical + high + medium, + SecretCount: len(ruleIDPattern.FindAllStringIndex(report, -1)), + VulnDBUpdatedAt: vulnDBUpdatedAt(versionJSON), + } + if apiURL != "" && token != nil { + if err := m.postScan(ctx, apiURL, token, serviceID, version, "trivy-image", imageRef, result); err != nil { + return nil, fmt.Errorf("posting image scan to API failed: %w", err) + } + } + result.Success = true + return result, nil +} + +// ArchiveScan scans the image the build wrote as an OCI ARCHIVE, before +// anything is pushed (ADR-0093 §5 step 2, scan before push), and posts the +// counts as scanner "trivy-image" -- the same row ImageScan posts after a +// push, so the deploy gate and the security verdict read one scanner either +// way. The archive's manifest digest rides in report_data.image_ref as +// `archive:sha256:`, for the record only: the verdict does NOT match on +// it (a caller-chosen digest is never identity, WP-01 review); it reads the +// scan by --version, the tag the archive was built as. +// +// No registry, no credential: the layout is read from the directory the build +// exported. Same scanners and severities as ImageScan. +func (m *SecurityScan) ArchiveScan( + ctx context.Context, + // The OCI image layout `standard-build build --archive` exported + layout *dagger.Directory, + // The archive's manifest digest (standard-build `archive-digest`) + archiveDigest string, + // +optional + apiURL string, + // +optional + token *dagger.Secret, + // +optional + serviceID string, + // The tag the archive was built as + // +optional + version string, +) (*ScanResult, error) { + if !archiveDigestRE.MatchString(archiveDigest) { + return nil, fmt.Errorf("archive-scan: --archive-digest %q is not sha256", archiveDigest) + } + const reportPath = "/tmp/trivy-image.json" + ctr := dag.Container(). + From("aquasec/trivy:0.76.1"). + WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). + WithDirectory("/layout", layout). + // trivy reads an OCI archive (tar of the layout) with --input; the + // working directory is empty, so no trivy.yaml / .trivyignore from the + // checkout can change what it reports (ADR-0093 §4, condition 3). + WithWorkdir("/work"). + WithExec([]string{"sh", "-c", "tar -cf /tmp/image.tar -C /layout ."}) + report, err := ctr.WithExec([]string{ + "trivy", "image", + "--input", "/tmp/image.tar", + "--scanners", "vuln,secret", + "--format", "json", + "--severity", "CRITICAL,HIGH,MEDIUM", + "--exit-code", "0", + "--output", reportPath, + }).File(reportPath).Contents(ctx) + if err != nil { + return nil, fmt.Errorf("trivy scan of the archive %s failed: %w", archiveDigest, err) + } critical, high, medium := countTrivySeverities(report) result := &ScanResult{ Critical: critical, @@ -222,14 +324,17 @@ func (m *SecurityScan) ImageScan( SecretCount: len(ruleIDPattern.FindAllStringIndex(report, -1)), } if apiURL != "" && token != nil { - if err := m.postScan(ctx, apiURL, token, serviceID, version, "trivy-image", imageRef, result); err != nil { - return nil, fmt.Errorf("posting image scan to API failed: %w", err) + if err := m.postScan(ctx, apiURL, token, serviceID, version, "trivy-image", "archive:"+archiveDigest, result); err != nil { + return nil, fmt.Errorf("posting archive scan to API failed: %w", err) } } result.Success = true return result, nil } +// archiveDigestRE is the manifest digest grammar (lower-case sha256). +var archiveDigestRE = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`) + // withoutCITooling removes what the PIPELINE put into the checkout before the // scan: the dagger CLI (`./bin/dagger`, installed by every stage's install // script) and the platform's module mirror (`./.integraci-modules`). They are @@ -242,6 +347,107 @@ func withoutCITooling(source *dagger.Directory) *dagger.Directory { return source.WithoutFile("bin/dagger").WithoutDirectory(".integraci-modules") } +// suppressionFiles are the files a scanner reads from the tree it scans and +// obeys: each one can silence a finding in the very change that adds it. The +// scan of record (ADR-0093 §4, WP-05) removes them, wherever they are in the +// tree, and reports which. Suppression goes through the platform's waivers. +var suppressionFiles = []string{ + ".gitleaksignore", + ".gitleaks.toml", + ".trivyignore", + ".trivyignore.yaml", + "trivy.yaml", + "trivy.yml", + ".semgrepignore", + ".checkov.yaml", + ".checkov.yml", + // Trivy loads ./trivy-secret.yaml by default; it can disable built-in + // secret rules or allow-list a path. + "trivy-secret.yaml", + "trivy-secret.yml", +} + +// withoutSuppression removes every suppressionFiles entry from source and +// returns the paths it removed. A tree that cannot be listed is an error: a +// scan of record that could not drop the suppressions is not one. +func withoutSuppression(ctx context.Context, source *dagger.Directory) (*dagger.Directory, []string, error) { + return dropSuppression(ctx, source, + func(ctx context.Context, pattern string) ([]string, error) { return source.Glob(ctx, pattern) }, + func(d *dagger.Directory, paths []string) *dagger.Directory { return d.WithoutFiles(paths) }, + ) +} + +// dropSuppression is withoutSuppression over any tree: glob lists it by +// pattern, without returns it minus paths. A test passes an in-memory tree, +// so the DIRECTORY that comes back is checked, not just the reported names. +func dropSuppression[T any]( + ctx context.Context, + source T, + glob func(context.Context, string) ([]string, error), + without func(T, []string) T, +) (T, []string, error) { + var found []string + for _, name := range suppressionFiles { + for _, pattern := range []string{name, "**/" + name} { + matches, err := glob(ctx, pattern) + if err != nil { + var none T + return none, nil, fmt.Errorf("list %s for the scan of record: %w", name, err) + } + found = append(found, matches...) + } + } + seen := map[string]bool{} + var removed []string + for _, path := range found { + if !seen[path] { + seen[path] = true + removed = append(removed, path) + } + } + if len(removed) == 0 { + return source, nil, nil + } + return without(source, removed), removed, nil +} + +// trustedConfigArgs are the Trivy flags the scan of record adds: no +// configuration, ignore file or secret configuration is read from the tree +// it scans (Trivy 0.76 docs, "Disabling configuration files"). The files are +// removed from the scanned copy too; these flags also cover a renamed path a +// later Trivy might look up by default. +func trustedConfigArgs(scanOfRecord bool) []string { + if !scanOfRecord { + return nil + } + return []string{"--config=", "--ignorefile=", "--secret-config="} +} + +// inlineIgnoreScript neutralises Trivy/tfsec inline ignore comments +// (`#trivy:ignore:AVD-...`, `#tfsec:ignore:...`) in the IaC files of the +// scanned copy, and prints each file it changed. Trivy has no flag that turns +// inline ignores off, and a change could otherwise silence its own +// misconfiguration next to the resource it adds (ADR-0093 §4). Only the +// container's copy is rewritten. POSIX find/grep/sed: runs on the Trivy +// image's busybox. +const inlineIgnoreScript = `find . -type f \( -name '*.tf' -o -name '*.tf.json' -o -name '*.hcl' ` + + `-o -name '*.yaml' -o -name '*.yml' -o -name '*.json' -o -name '*.tpl' ` + + `-o -name 'Dockerfile*' -o -name '*.dockerfile' -o -name 'Containerfile*' \) ` + + `-exec grep -lE '(trivy|tfsec):ignore' {} \; ` + + `-exec sed -i -E 's/(trivy|tfsec):ignore/\1-ignore-disabled-by-scan-of-record/g' {} \;` + +// inlineIgnoredFiles turns inlineIgnoreScript's output into report entries. +func inlineIgnoredFiles(out string) []string { + var files []string + for _, line := range strings.Split(out, "\n") { + line = strings.TrimPrefix(strings.TrimSpace(line), "./") + if line != "" { + files = append(files, "inline:"+line) + } + } + return files +} + // postResults sends the security-scan result back to the IntegraCI scans // endpoint. Shape matches api/app/schemas/scan.py ScanResultCreate: typed // severity columns plus the report_data counters the deploy OPA gate reads @@ -280,19 +486,25 @@ func (m *SecurityScan) postScan( "high_count": result.High, "medium_count": result.Medium, "report_data": map[string]any{ - "secret_count": result.SecretCount, - "dast_high": 0, - "dast_critical": 0, - "sast_errors": 0, - "iac_critical": result.IacCritical, - "iac_high": result.IacHigh, - "sbom_present": false, - "signed": false, + "ignored_suppressions": result.IgnoredSuppressions, + "secret_count": result.SecretCount, + "dast_high": 0, + "dast_critical": 0, + "sast_errors": 0, + "iac_critical": result.IacCritical, + "iac_high": result.IacHigh, + "iac_scanned": result.IacScanned, + "sbom_present": false, + "signed": false, }, } if imageRef != "" { payload["report_data"].(map[string]any)["image_ref"] = imageRef } + if result.VulnDBUpdatedAt != "" { + // security/services/vuln_db_freshness.py VULN_DB_UPDATED_AT_KEY. + payload["report_data"].(map[string]any)["vuln_db_updated_at"] = result.VulnDBUpdatedAt + } body, err := json.Marshal(payload) if err != nil { @@ -346,7 +558,7 @@ func (m *SecurityScan) LicenseScan( } trivy := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). // Persist Trivy's vulnerability DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithDirectory("/src", withoutCITooling(source)). @@ -436,7 +648,7 @@ func (m *SecurityScan) Sarif( ) (*dagger.File, error) { const reportPath = "/tmp/trivy-results.sarif" report := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithDirectory("/src", source.WithoutFile("bin/dagger").WithoutDirectory(".integraci-modules")). WithWorkdir("/src"). @@ -459,22 +671,15 @@ func (m *SecurityScan) Sarif( // vulnerability counts parsed from the JSON report. Trivy may exit non-zero // when vulnerabilities are present, so counts are read from the report file // rather than the exit code. -func (m *SecurityScan) runTrivy(ctx context.Context, source *dagger.Directory) (int, int, int, error) { +func (m *SecurityScan) runTrivy(ctx context.Context, source *dagger.Directory, scanOfRecord bool) (int, int, int, error) { const reportPath = "/tmp/trivy-results.json" trivy := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). // Persist Trivy's vulnerability DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithDirectory("/src", source). WithWorkdir("/src"). - WithExec([]string{ - "trivy", "fs", - "--format", "json", - "--severity", "CRITICAL,HIGH,MEDIUM", - "--exit-code", "0", - "--output", reportPath, - ".", - }) + WithExec(trivyArgs("fs", reportPath, scanOfRecord)) report, err := trivy.File(reportPath).Contents(ctx) if err != nil { @@ -490,30 +695,52 @@ func (m *SecurityScan) runTrivy(ctx context.Context, source *dagger.Directory) ( // from the JSON report. Reuses countTrivySeverities — trivy config emits the // same "Severity":"" shape as the vuln scan. exit-code 0 so findings // don't fail the container step; gating is the deploy OPA gate's job. -func (m *SecurityScan) runTrivyConfig(ctx context.Context, source *dagger.Directory) (int, int, error) { +// +// For the scan of record, inline ignore comments are neutralised first +// (inlineIgnoreScript) and the files that carried one are returned, so they +// are posted as `ignored_suppressions`. +func (m *SecurityScan) runTrivyConfig(ctx context.Context, source *dagger.Directory, scanOfRecord bool) (int, int, []string, error) { const reportPath = "/tmp/trivy-config.json" - trivy := dag.Container(). - From("aquasec/trivy:0.58.1"). + base := dag.Container(). + From("aquasec/trivy:0.76.1"). // Persist Trivy's DB across runs (avoids re-downloading it). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithDirectory("/src", source). - WithWorkdir("/src"). - WithExec([]string{ - "trivy", "config", - "--format", "json", - "--severity", "CRITICAL,HIGH,MEDIUM", - "--exit-code", "0", - "--output", reportPath, - ".", - }) + WithWorkdir("/src") + var inline []string + if scanOfRecord { + base = base.WithExec([]string{"sh", "-c", inlineIgnoreScript}) + out, err := base.Stdout(ctx) + if err != nil { + // Not "nothing to neutralise": a scan of record that could not + // drop the inline ignores is not one. + return 0, 0, nil, fmt.Errorf("neutralise inline ignores for the scan of record: %w", err) + } + inline = inlineIgnoredFiles(out) + } + trivy := base.WithExec(trivyArgs("config", reportPath, scanOfRecord)) report, err := trivy.File(reportPath).Contents(ctx) if err != nil { - return 0, 0, fmt.Errorf("read trivy config output: %w", err) + return 0, 0, nil, fmt.Errorf("read trivy config output: %w", err) } critical, high, _ := countTrivySeverities(report) - return critical, high, nil + return critical, high, inline, nil +} + +// trivyArgs is the argv of `trivy fs` / `trivy config` with a JSON report at +// reportPath; the scan of record adds trustedConfigArgs. +func trivyArgs(sub, reportPath string, scanOfRecord bool) []string { + args := []string{ + "trivy", sub, + "--format", "json", + "--severity", "CRITICAL,HIGH,MEDIUM", + "--exit-code", "0", + "--output", reportPath, + } + args = append(args, trustedConfigArgs(scanOfRecord)...) + return append(args, ".") } // runTrivyCisCompliance runs `trivy config --compliance docker-cis-1.6.0` over @@ -521,7 +748,7 @@ func (m *SecurityScan) runTrivyConfig(ctx context.Context, source *dagger.Direct // failures don't fail the container step; gating is the deploy gate's job. func (m *SecurityScan) runTrivyCisCompliance(ctx context.Context, source *dagger.Directory) int { out, _ := dag.Container(). - From("aquasec/trivy:0.58.1"). + From("aquasec/trivy:0.76.1"). WithMountedCache("/root/.cache/trivy", dag.CacheVolume("trivy-db")). WithDirectory("/src", source). WithWorkdir("/src"). @@ -541,19 +768,13 @@ func (m *SecurityScan) runTrivyCisCompliance(ctx context.Context, source *dagger // runGitleaks runs Gitleaks secret detection and returns the number of // detected secrets, parsed from the SARIF report (one "ruleId" per finding). -func (m *SecurityScan) runGitleaks(ctx context.Context, source *dagger.Directory) (int, error) { +func (m *SecurityScan) runGitleaks(ctx context.Context, source *dagger.Directory, ignoreInlineAllow bool) (int, error) { const reportPath = "/tmp/gitleaks-results.sarif" gitleaks := dag.Container(). From("zricethezav/gitleaks:v8.21.2"). WithDirectory("/src", source). WithWorkdir("/src"). - WithExec([]string{ - "gitleaks", "detect", - "--source", ".", - "--report-format", "sarif", - "--report-path", reportPath, - "--exit-code", "0", - }) + WithExec(gitleaksArgs(reportPath, ignoreInlineAllow)) report, err := gitleaks.File(reportPath).Contents(ctx) if err != nil { @@ -563,6 +784,23 @@ func (m *SecurityScan) runGitleaks(ctx context.Context, source *dagger.Directory return countSarifResults(report), nil } +// gitleaksArgs is the gitleaks argv. For the scan of record it also ignores +// inline `gitleaks:allow` comments: a change could otherwise mark its own +// secret allowed (ADR-0093 §4). +func gitleaksArgs(reportPath string, ignoreInlineAllow bool) []string { + args := []string{ + "gitleaks", "detect", + "--source", ".", + "--report-format", "sarif", + "--report-path", reportPath, + "--exit-code", "0", + } + if ignoreInlineAllow { + args = append(args, "--ignore-gitleaks-allow") + } + return args +} + // countTrivySeverities tallies CRITICAL/HIGH/MEDIUM occurrences from Trivy's // JSON report: one "Severity" per finding (see severityPattern for why the // match is whitespace-tolerant). diff --git a/security-scan/main_test.go b/security-scan/main_test.go new file mode 100644 index 0000000..c4b3bf0 --- /dev/null +++ b/security-scan/main_test.go @@ -0,0 +1,186 @@ +package main + +// The scan of record (ADR-0093 §4, WP-05) drops the repository's suppression +// files from the tree it scans. These tests check the DIRECTORY that comes +// back, not the list of names: a dropSuppression that reports the files but +// returns the original tree (`return source, removed, nil`) still scans with +// them, and fails here. +// +// Written on the build VM, not run there (owner decision 2026-10-11). Runs +// with `go test ./...` after `dagger develop` has generated internal/dagger. + +import ( + "context" + "errors" + "path" + "reflect" + "sort" + "strings" + "testing" +) + +// memTree is an in-memory directory: Glob matches like Dagger's (`**/` is +// any depth below the top, a bare name is the top level only), WithoutFiles +// returns a NEW tree without the paths. +type memTree struct { + files map[string]bool + globErr error +} + +func newTree(paths ...string) memTree { + files := map[string]bool{} + for _, p := range paths { + files[p] = true + } + return memTree{files: files} +} + +func (t memTree) Glob(_ context.Context, pattern string) ([]string, error) { + if t.globErr != nil { + return nil, t.globErr + } + var out []string + for p := range t.files { + if name, ok := strings.CutPrefix(pattern, "**/"); ok { + if strings.Contains(p, "/") && path.Base(p) == name { + out = append(out, p) + } + } else if p == pattern { + out = append(out, p) + } + } + sort.Strings(out) + return out, nil +} + +func (t memTree) WithoutFiles(paths []string) memTree { + files := map[string]bool{} + for p := range t.files { + files[p] = true + } + for _, p := range paths { + delete(files, p) + } + return memTree{files: files} +} + +func drop(t memTree) (memTree, []string, error) { + return dropSuppression(context.Background(), t, t.Glob, memTree.WithoutFiles) +} + +func (t memTree) list() []string { + var out []string + for p := range t.files { + out = append(out, p) + } + sort.Strings(out) + return out +} + +func TestTheScanOfRecordTreeHasNoSuppressionFile(t *testing.T) { + tree := newTree( + "main.tf", + "src/app.py", + ".gitleaksignore", + ".trivyignore", + "trivy-secret.yaml", + "deploy/.trivyignore.yaml", + "svc/a/.semgrepignore", + "svc/a/trivy.yaml", + "infra/.checkov.yml", + ) + got, removed, err := drop(tree) + if err != nil { + t.Fatal(err) + } + if want := []string{"main.tf", "src/app.py"}; !reflect.DeepEqual(got.list(), want) { + t.Fatalf("scanned tree = %q, want %q (suppression files must be GONE from it)", got.list(), want) + } + sort.Strings(removed) + want := []string{ + ".gitleaksignore", + ".trivyignore", + "deploy/.trivyignore.yaml", + "infra/.checkov.yml", + "svc/a/.semgrepignore", + "svc/a/trivy.yaml", + "trivy-secret.yaml", + } + if !reflect.DeepEqual(removed, want) { + t.Fatalf("reported %q, want %q", removed, want) + } +} + +// Legal direction: a tree without suppression keeps every file, and the +// application's own config files of similar names are not touched. +func TestATreeWithoutSuppressionIsScannedWhole(t *testing.T) { + tree := newTree("main.tf", "config/trivy.json", "docs/gitleaks.md", "app/.semgrepignore.md") + got, removed, err := drop(tree) + if err != nil { + t.Fatal(err) + } + if len(removed) != 0 { + t.Fatalf("nothing to remove, reported %q", removed) + } + if !reflect.DeepEqual(got.list(), tree.list()) { + t.Fatalf("tree changed: %q", got.list()) + } +} + +func TestATreeThatCannotBeListedIsNotAScanOfRecord(t *testing.T) { + tree := newTree(".trivyignore") + tree.globErr = errors.New("engine gone") + if _, _, err := drop(tree); err == nil { + t.Fatal("a tree that cannot be listed must fail the scan of record") + } +} + +func TestTrivyReadsNoConfigFromTheTreeInTheScanOfRecord(t *testing.T) { + for _, sub := range []string{"fs", "config"} { + args := trivyArgs(sub, "/tmp/r.json", true) + for _, flag := range []string{"--config=", "--ignorefile=", "--secret-config="} { + if !contains(args, flag) { + t.Errorf("trivy %s of record lacks %s: %q", sub, flag, args) + } + } + if args[len(args)-1] != "." { + t.Errorf("the target must stay last: %q", args) + } + // Every other caller scans as before. + for _, a := range trivyArgs(sub, "/tmp/r.json", false) { + if strings.HasPrefix(a, "--config=") || strings.HasPrefix(a, "--ignorefile=") || + strings.HasPrefix(a, "--secret-config=") { + t.Errorf("trivy %s outside the scan of record must not change: %q", sub, a) + } + } + } +} + +func TestInlineIgnoresAreReportedPerFile(t *testing.T) { + got := inlineIgnoredFiles("./infra/main.tf\n\n./Dockerfile\n") + want := []string{"inline:infra/main.tf", "inline:Dockerfile"} + if !reflect.DeepEqual(got, want) { + t.Fatalf("got %q, want %q", got, want) + } + if got := inlineIgnoredFiles(""); len(got) != 0 { + t.Fatalf("no file changed, reported %q", got) + } +} + +// The neutraliser must rewrite both comment spellings, and only them. +func TestTheInlineIgnoreScriptRewritesBothSpellings(t *testing.T) { + for _, s := range []string{"(trivy|tfsec):ignore", "sed -i -E", "*.tf", "Dockerfile*", "*.yaml"} { + if !strings.Contains(inlineIgnoreScript, s) { + t.Errorf("inlineIgnoreScript lacks %q", s) + } + } +} + +func contains(xs []string, x string) bool { + for _, v := range xs { + if v == x { + return true + } + } + return false +} diff --git a/security-scan/vulndb.go b/security-scan/vulndb.go new file mode 100644 index 0000000..dfa9bf6 --- /dev/null +++ b/security-scan/vulndb.go @@ -0,0 +1,22 @@ +package main + +import "encoding/json" + +// vulnDBUpdatedAt returns VulnerabilityDB.UpdatedAt from `trivy version +// --format json`, or "" when the output carries none (no DB in the cache, an +// older Trivy, not JSON). The platform reads it from report_data +// ("vuln_db_updated_at") and treats a database older than +// secure_delivery_vuln_db_max_age_days, or an absent date, as `cve = unknown` +// (ADR-0093 §8). The value is passed through unparsed: judging it is the +// platform's job, and a runner clock must not decide it. +func vulnDBUpdatedAt(versionJSON string) string { + var v struct { + VulnerabilityDB *struct { + UpdatedAt string `json:"UpdatedAt"` + } `json:"VulnerabilityDB"` + } + if err := json.Unmarshal([]byte(versionJSON), &v); err != nil || v.VulnerabilityDB == nil { + return "" + } + return v.VulnerabilityDB.UpdatedAt +} diff --git a/security-scan/vulndb_test.go b/security-scan/vulndb_test.go new file mode 100644 index 0000000..eccc4d9 --- /dev/null +++ b/security-scan/vulndb_test.go @@ -0,0 +1,23 @@ +package main + +import "testing" + +func TestVulnDBUpdatedAt(t *testing.T) { + cases := []struct{ name, in, want string }{ + { + "trivy version --format json", + `{"Version":"0.76.1","VulnerabilityDB":{"Version":2,"NextUpdate":"2026-11-04T12:00:00Z","UpdatedAt":"2026-11-04T06:00:00.5Z","DownloadedAt":"2026-11-04T07:00:00Z"},"JavaDB":{"Version":1,"UpdatedAt":"2020-01-01T00:00:00Z"}}`, + "2026-11-04T06:00:00.5Z", + }, + // The Java DB's date is not the vulnerability DB's: never borrow it. + {"only the java db", `{"Version":"0.76.1","JavaDB":{"UpdatedAt":"2026-11-04T06:00:00Z"}}`, ""}, + {"no db in the cache", `{"Version":"0.76.1"}`, ""}, + {"not json", `Version: 0.76.1`, ""}, + {"empty", ``, ""}, + } + for _, c := range cases { + if got := vulnDBUpdatedAt(c.in); got != c.want { + t.Errorf("%s: got %q, want %q", c.name, got, c.want) + } + } +} diff --git a/serverless-deploy/dagger.json b/serverless-deploy/dagger.json index 79af427..aeba2f4 100644 --- a/serverless-deploy/dagger.json +++ b/serverless-deploy/dagger.json @@ -1,6 +1,6 @@ { "name": "serverless-deploy", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/standard-build/dagger.json b/standard-build/dagger.json index 75c9234..50f5df3 100644 --- a/standard-build/dagger.json +++ b/standard-build/dagger.json @@ -1,6 +1,6 @@ { "name": "standard-build", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, @@ -9,6 +9,7 @@ "./main.go", "./evidence/evidence.go", "./layout/layout.go", - "./layout/ignore.go" + "./layout/ignore.go", + "./pushgate/pushgate.go" ] } diff --git a/standard-build/evidence/evidence_test.go b/standard-build/evidence/evidence_test.go index 8454d1b..cb628ea 100644 --- a/standard-build/evidence/evidence_test.go +++ b/standard-build/evidence/evidence_test.go @@ -20,7 +20,7 @@ func validInput() ProvenanceInput { InvocationID: "42", StartedOn: "2026-10-11T08:00:00Z", FinishedOn: "2026-10-11T08:05:00Z", - EngineVersion: "v0.21.7", + EngineVersion: "v0.21.11", Language: "go", } } diff --git a/standard-build/main.go b/standard-build/main.go index a172556..3bf51ca 100644 --- a/standard-build/main.go +++ b/standard-build/main.go @@ -12,14 +12,19 @@ package main import ( + "bytes" "context" "dagger/standard-build/evidence" "dagger/standard-build/internal/dagger" "dagger/standard-build/layout" + "dagger/standard-build/pushgate" "encoding/json" "errors" "fmt" + "io" + "net/http" "strings" + "time" ) // StandardBuild is the IntegraCI standard build pipeline module. @@ -37,6 +42,17 @@ type BuildResult struct { ImageDigest string `json:"image_digest,omitempty"` TestOutput string `json:"test_output,omitempty"` LintOutput string `json:"lint_output,omitempty"` + // ArchiveDigest is `sha256:` of the image's manifest in the OCI + // archive written with --archive (scan before push, ADR-0093 §5): what the + // scan describes and the verdict judges. Empty when nothing was archived. + ArchiveDigest string `json:"archive_digest,omitempty"` + // Archive is the OCI image layout (index.json, oci-layout, blobs/) of the + // built image, read through `archive-layout`. EXPORTED on purpose: Dagger + // serializes a returned object between chained calls, and an unexported + // field would be empty by the time `archive-layout` runs. `+private` keeps + // it out of the module's API. + // +private + Archive *dagger.Directory `json:"archive,omitempty"` } // execDetail turns a failed step into something a person can act on. @@ -168,6 +184,13 @@ func (m *StandardBuild) Build( // packages, or a workspace whose lockfile lives at the root). // +optional buildContext string, + // Build to an OCI ARCHIVE and push nothing (scan before push, ADR-0093 §5). + // --image-ref still names the image (it is the archive's ref name); no + // registry is contacted. Chain `archive-layout export --path=` to + // write the layout, `archive-digest` to read its manifest digest. Then + // security-scan `archive-scan`, `push-verdict`, and `push-archive`. + // +optional + archive bool, ) (*BuildResult, error) { result := &BuildResult{Language: language, RuntimeVersion: runtimeVersion} ref, err := destinationRef(imageRef, registry, service, tag) @@ -179,6 +202,11 @@ func (m *StandardBuild) Build( username: registryUsername, password: registryPassword, insecure: registryInsecure, + archive: archive, + result: result, + } + if archive && ref == "" { + return nil, fmt.Errorf("--archive needs --image-ref: the archive names the image it will be pushed as") } // WHERE in the checkout, checked BEFORE any build step. The default layout // returns the checkout untouched and reads nothing. See applyLayout. @@ -829,6 +857,10 @@ type publishConfig struct { // testOnly does: the lane signatures stay as they are. Only the go and node // lanes read it (laneWorkdirProblem refuses the others). workdir string + // archive makes publishImage export an OCI layout into result instead of + // pushing (ADR-0093 §5, scan before push). Rides here for the same reason. + archive bool + result *BuildResult } // lintTestBase is the container a lane lints and tests in. @@ -900,6 +932,9 @@ func publishImage(ctx context.Context, image *dagger.Container, pub publishConfi if pub.imageRef == "" { return "", nil // build-only: no destination configured } + if pub.archive { + return archiveImage(ctx, image, pub) + } if pub.insecure { return publishInsecure(ctx, image, pub) } @@ -925,7 +960,7 @@ func publishImage(ctx context.Context, image *dagger.Container, pub publishConfi // Tags are checked against the registry's own list rather than assumed: v0.20.2 // looks like a plausible release and was never published, so an earlier build // failed with `not found` after every other stage had succeeded. -const craneImage = "gcr.io/go-containerregistry/crane/debug:v0.21.9" +const craneImage = "gcr.io/go-containerregistry/crane/debug:v0.22.1" // publishInsecure pushes to a registry that is served over plain HTTP. // @@ -1005,19 +1040,67 @@ func withDigest(result *BuildResult, err error) (*BuildResult, error) { if err != nil || result == nil { return result, err } + if result.Archive != nil { + // Nothing was pushed: the archive's digest is the only one there is. + result.ImageDigest = "" + return result, nil + } result.ImageDigest = evidence.DigestOf(result.ImageRef) return result, nil } +// archiveImage writes the built image as an OCI image layout and records its +// manifest digest (ADR-0093 §5 step 1). No registry is contacted. +// +// The layout is exported, not a tarball, so the digest is READ from +// index.json rather than recomputed: the bytes `push-archive` later sends are +// exactly these, and the registry's digest is compared with this one. +// OCI media types, one platform: pushgate.ManifestDigestFromIndex refuses an +// index of several manifests (the scan would describe one of them). +func archiveImage(ctx context.Context, image *dagger.Container, pub publishConfig) (string, error) { + // AsTarball's default media types are OCI (Dagger's ImageMediaTypes + // default), the layout crane and trivy read as a directory. + tar := image.AsTarball() + layout := dag.Container(). + From(craneImage). + WithFile("/tmp/image.tar", tar). + WithExec([]string{"sh", "-c", "mkdir -p /out && tar -xf /tmp/image.tar -C /out"}). + Directory("/out") + index, err := layout.File("index.json").Contents(ctx) + if err != nil { + return "", fmt.Errorf("the built image's OCI layout has no index.json: %w", err) + } + digest, err := pushgate.ManifestDigestFromIndex([]byte(index)) + if err != nil { + return "", err + } + if pub.result != nil { + pub.result.Archive = layout + pub.result.ArchiveDigest = digest + } + // The ref the image WILL be pushed as, unpinned: nothing is published yet. + return pub.imageRef, nil +} + +// ArchiveLayout is the OCI image layout `build --archive` wrote. Export it: +// +// dagger call build ... --archive=true archive-layout export --path=.integraci-image.oci +func (r *BuildResult) ArchiveLayout() (*dagger.Directory, error) { + if r.Archive == nil { + return nil, fmt.Errorf("no archive: call build with --archive=true") + } + return r.Archive, nil +} + // daggerEngineVersion is the engine every module's dagger.json pins. It is // recorded in the provenance `builder.version`, and // tools/scripts/dagger-mirror-manifest.py fails when it and dagger.json // disagree. -const daggerEngineVersion = "v0.21.7" +const daggerEngineVersion = "v0.21.11" // syftImage is the SBOM generator the evidence set uses — the same pin as the // sbom module, so both paths describe an image the same way. -const syftImage = "anchore/syft:v1.18.1" +const syftImage = "anchore/syft:v1.56.0" // Evidence writes the supply-chain evidence for ONE published image digest // (ADR-0068 Layer 2, #2143 phase 1) and returns it as a directory: @@ -1843,3 +1926,185 @@ func (m *StandardBuild) buildNode( result.Success = true return result, nil } + +// PushVerdict asks the platform whether the scanned archive may be pushed +// (ADR-0093 §5 step 3): POST /api/v1/secure-delivery/push-verdict with the +// archive's manifest digest and the tag it was built as. Prints one line: +// `push` or `refuse`, then the reason. The build pushes only on `push`. +// +// Only an explicit refusal stops the push (pushgate.Judge): an unreachable +// platform pushes and says so, because this step is hygiene and the deploy +// gate still judges the pushed digest. A refusal makes this call FAIL, so a +// pipeline that chains it before `push-archive` stops there with +// "verdict: block ()". +// +// +cache="never" +func (m *StandardBuild) PushVerdict( + ctx context.Context, + // IntegraCI API base URL + apiURL string, + // The pipeline's scans:ingest token. Absent = nothing can refuse (said). + // +optional + token *dagger.Secret, + serviceID string, + // The archive's manifest digest (`archive-digest`), sha256: + imageDigest string, + // The tag the archive was built as + version string, +) (string, error) { + body, err := pushgate.RequestBody(serviceID, imageDigest, version) + if err != nil { + return "", err + } + if strings.TrimSpace(apiURL) == "" || token == nil { + // No platform to ask: nothing can refuse, and the deploy gate judges + // the digest. Said, not silent. + return "push\nverdict NOT asked (no --api-url/--token): pushed; the deploy gate judges this digest\n", nil + } + tokenStr, err := token.Plaintext(ctx) + if err != nil { + return "", fmt.Errorf("read token secret: %w", err) + } + endpoint := strings.TrimRight(apiURL, "/") + "/api/v1/secure-delivery/push-verdict" + req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, bytes.NewReader(body)) + if err != nil { + return "", fmt.Errorf("build request: %w", err) + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Authorization", "Bearer "+tokenStr) + status, answer := 0, []byte(nil) + client := &http.Client{Timeout: 30 * time.Second} + if resp, err := client.Do(req); err == nil { + status = resp.StatusCode + answer, _ = io.ReadAll(io.LimitReader(resp.Body, 64<<10)) + resp.Body.Close() + } + out := pushgate.Judge(status, answer) + if !out.Push { + return "", fmt.Errorf("%s", out.Message) + } + return "push\n" + out.Message + "\n", nil +} + +// PushArchive pushes the OCI layout `build --archive` wrote, and fails unless +// the registry reports the SAME manifest digest the archive carries +// (ADR-0093 §5 step 2: a re-compressing registry fails the push rather than +// rebinding the evidence). Returns `@`, the shape Build +// returns after a push, so `build_digest_capture` keeps working. +// +// TLS registry: the layout is imported and published by the engine, with the +// same login the build's publish always used (--registry-username/-password, +// or the client's own docker login, which Dagger forwards). Plain-HTTP +// registry: crane (Apache-2.0) pushes the layout directory byte for byte, as +// publishInsecure does for a built image. Either way the digest the REGISTRY +// reports is compared with the archive's; nothing about it is trusted. +// +// +cache="never" +func (m *StandardBuild) PushArchive( + ctx context.Context, + // The exported OCI layout directory + layout *dagger.Directory, + // Destination, `/:`; the archive's own ref name + imageRef string, + // The archive's manifest digest the scan and the verdict described + archiveDigest string, + // +optional + registryUsername string, + // +optional + registryPassword *dagger.Secret, + // +optional + registryInsecure bool, +) (string, error) { + if !pushgate.IsDigest(archiveDigest) { + return "", fmt.Errorf("--archive-digest %q is not sha256", archiveDigest) + } + if strings.TrimSpace(imageRef) == "" || strings.Contains(imageRef, "@") { + return "", fmt.Errorf("--image-ref must be /:, got %q", imageRef) + } + index, err := layout.File("index.json").Contents(ctx) + if err != nil { + return "", fmt.Errorf("--layout is not an OCI image layout: %w", err) + } + inLayout, err := pushgate.ManifestDigestFromIndex([]byte(index)) + if err != nil { + return "", err + } + // The directory must be the archive that was scanned, not another one. + if err := pushgate.SameDigest(archiveDigest, inLayout); err != nil { + return "", fmt.Errorf("--layout is not the scanned archive: %w", err) + } + var registryDigest string + if registryInsecure { + registryDigest, err = pushLayoutInsecure(ctx, layout, imageRef, registryUsername, registryPassword) + if err != nil { + return "", err + } + } else { + tar := dag.Container(). + From(craneImage). + WithDirectory("/tmp/layout", layout). + WithExec([]string{"sh", "-c", "tar -cf /tmp/image.tar -C /tmp/layout ."}). + File("/tmp/image.tar") + ref, err := publishImage(ctx, dag.Container().Import(tar), publishConfig{ + imageRef: imageRef, + username: registryUsername, + password: registryPassword, + }) + if err != nil { + return "", err + } + registryDigest = evidence.DigestOf(ref) + } + if err := pushgate.SameDigest(archiveDigest, registryDigest); err != nil { + return "", err + } + return imageRef + "@" + archiveDigest, nil +} + +// pushLayoutInsecure pushes an OCI layout to a plain-HTTP registry with crane +// and returns the digest the registry then reports for the reference. Same +// reporting shape as publishInsecure: the step always exits 0 and the outcome +// is read from stdout, because a failing exec carries no reason. +func pushLayoutInsecure( + ctx context.Context, layout *dagger.Directory, imageRef, username string, password *dagger.Secret, +) (string, error) { + host := registryHost(imageRef) + if host == "" { + return "", fmt.Errorf("insecure push needs a registry host in %q", imageRef) + } + pusher := dag.Container().From(craneImage).WithDirectory("/tmp/layout", layout) + login := "echo 'no registry credential supplied; pushing anonymously'" + if password != nil { + pusher = pusher.WithMountedSecret("/tmp/registry-password", password) + login = fmt.Sprintf("crane auth login %s -u %s --password-stdin --insecure < /tmp/registry-password", + shellQuote(host), shellQuote(username)) + } + out, err := pusher.WithExec([]string{ + "sh", "-c", + fmt.Sprintf( + "{ %s && crane push --insecure /tmp/layout %s && echo PUSHED && "+ + "printf '%s%%s\\n' \"$(crane digest --insecure %s)\"; } 2>&1; echo \"crane exit=$?\"", + login, shellQuote(imageRef), pushgate.RegistryDigestPrefix, shellQuote(imageRef), + ), + }).Stdout(ctx) + if err != nil { + return "", fmt.Errorf("insecure push of %s failed: %s", imageRef, execDetail(err)) + } + if !strings.Contains(out, "PUSHED") { + return "", fmt.Errorf("insecure push of %s did not confirm:\n%s", imageRef, out) + } + return pushgate.RegistryDigestFrom(out), nil +} + +// ArchiveDigest reads the manifest digest of an exported OCI layout, so a +// pipeline that exported `archive-layout` can name it without parsing JSON. +func (m *StandardBuild) ArchiveDigest( + ctx context.Context, + layout *dagger.Directory, +) (string, error) { + index, err := layout.File("index.json").Contents(ctx) + if err != nil { + return "", fmt.Errorf("--layout is not an OCI image layout: %w", err) + } + return pushgate.ManifestDigestFromIndex([]byte(index)) +} diff --git a/standard-build/pushgate/pushgate.go b/standard-build/pushgate/pushgate.go new file mode 100644 index 0000000..c3423f2 --- /dev/null +++ b/standard-build/pushgate/pushgate.go @@ -0,0 +1,201 @@ +// Package pushgate holds the pure half of scan-before-push (ADR-0093 §5, +// WP-06): which digest an OCI archive carries, whether the registry kept it, +// and what the platform's pre-push verdict says. +// +// Standard library only, for the reason evidence/ is: the generated `dagger` +// package panics at init without a Dagger session, so nothing in package main +// runs under a plain `go test`. +// +// The order every rendered engine runs (ADR-0093 §5): +// +// build to an OCI archive -> scan the archive -> ask the verdict for the +// archive's manifest digest -> push only if the answer is not `refuse` -> +// the registry's digest must equal the archive's (mismatch fails). +// +// The push step runs in the build job, which has executed the change's code, +// so it is hygiene, not a control. The control is G3: the deploy gate judges +// the pushed DIGEST (ADR-0093 §5.4). +package pushgate + +import ( + "encoding/json" + "errors" + "fmt" + "regexp" + "strings" +) + +var digestRE = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`) + +// versionRE is the tag grammar of the platform's deploy endpoint and of the +// security verdict (`security_verdict._VERSION_RE`). +var versionRE = regexp.MustCompile(`^[A-Za-z0-9_][A-Za-z0-9._-]{0,127}$`) + +// manifestMediaTypes are the single-image manifests an archive may name. An +// image INDEX is refused: the scan describes one platform's image, and a +// pushed index would carry a digest no scan describes. +var manifestMediaTypes = map[string]bool{ + "application/vnd.oci.image.manifest.v1+json": true, + "application/vnd.docker.distribution.manifest.v2+json": true, +} + +// RegistryDigestPrefix starts the line the push script prints with the digest +// the REGISTRY reports for the pushed reference. +const RegistryDigestPrefix = "REGISTRY_DIGEST " + +// IsDigest reports whether s is `sha256:<64 lower-case hex>`. +func IsDigest(s string) bool { return digestRE.MatchString(s) } + +// ManifestDigestFromIndex returns the manifest digest an OCI image layout's +// index.json names. Exactly one manifest, of a single-image media type. +func ManifestDigestFromIndex(indexJSON []byte) (string, error) { + var index struct { + Manifests []struct { + MediaType string `json:"mediaType"` + Digest string `json:"digest"` + } `json:"manifests"` + } + if err := json.Unmarshal(indexJSON, &index); err != nil { + return "", fmt.Errorf("the archive's index.json is not JSON: %w", err) + } + if len(index.Manifests) != 1 { + return "", fmt.Errorf( + "the archive names %d manifests; one platform per digest is supported", len(index.Manifests)) + } + m := index.Manifests[0] + if !manifestMediaTypes[m.MediaType] { + return "", fmt.Errorf("the archive's manifest has media type %q, not a single image", m.MediaType) + } + if !IsDigest(m.Digest) { + return "", fmt.Errorf("the archive's manifest digest %q is not sha256", m.Digest) + } + return m.Digest, nil +} + +// RegistryDigestFrom returns the digest on the push script's +// RegistryDigestPrefix line, or "" when there is none (or it is not sha256). +func RegistryDigestFrom(out string) string { + for _, line := range strings.Split(out, "\n") { + line = strings.TrimSpace(line) + if rest, ok := strings.CutPrefix(line, RegistryDigestPrefix); ok { + rest = strings.TrimSpace(rest) + if IsDigest(rest) { + return rest + } + } + } + return "" +} + +// SameDigest fails unless the registry kept the archive's manifest byte for +// byte. On a mismatch the caller must FAIL and record nothing: the scan and +// the verdict described the archive's digest, never the registry's +// (ADR-0093 §5.2, "the push step fails rather than rebinding evidence"). +func SameDigest(archive, registry string) error { + if !IsDigest(archive) { + return fmt.Errorf("archive digest %q is not sha256", archive) + } + if !IsDigest(registry) { + return errors.New("the registry reported no sha256 digest for the pushed reference") + } + if archive != registry { + return fmt.Errorf( + "registry digest %s differs from the scanned archive's %s: the registry rewrote the image; "+ + "nothing is recorded for it", registry, archive) + } + return nil +} + +// Request is the body of POST /api/v1/secure-delivery/push-verdict. +type Request struct { + ServiceID string `json:"service_id"` + ImageDigest string `json:"image_digest"` + Version string `json:"version"` +} + +// RequestBody validates and encodes the verdict request. +func RequestBody(serviceID, digest, version string) ([]byte, error) { + if strings.TrimSpace(serviceID) == "" { + return nil, errors.New("push-verdict needs --service-id") + } + if !IsDigest(digest) { + return nil, fmt.Errorf("push-verdict: %q is not a sha256 digest", digest) + } + if !versionRE.MatchString(version) { + return nil, fmt.Errorf("push-verdict: version %q is not an image tag", version) + } + return json.Marshal(Request{ServiceID: serviceID, ImageDigest: digest, Version: version}) +} + +// Answer is the platform's reply (app/security/schemas/push_verdict.py +// PushVerdictRead). apps/api/tests/test_scan_before_push.py holds the JSON +// names equal on both sides. +type Answer struct { + Decision string `json:"decision"` + Result string `json:"result"` + Mode string `json:"mode"` + Reasons []string `json:"reasons"` + WouldBlock []string `json:"would_block"` +} + +// Outcome is what the push step does with an answer. +type Outcome struct { + Push bool + Message string +} + +// Judge turns the platform's HTTP answer into the push decision. +// +// An explicit, well-formed `refuse` stops the push, and so does an explicit +// AUTHORIZATION refusal (401/403): the caller configured a token, and the +// platform said this token may not ask about this service or revision +// (expired, revoked, `scan-token-wrong-revision`, `scan-token-unbound`). +// Pushing then would let a refused binding publish silently, with no server +// trace (WP-06 review, 2026-11-04). +// +// Anything else -- the platform unreachable (a Jenkins on a customer network +// often cannot call back), a 5xx or other non-2xx, an unreadable body, an +// unknown decision -- pushes and says so loudly: this step is hygiene, and the +// deploy gate (G3) still judges the pushed digest. Failing closed on transport +// errors would stop every build whose CI cannot reach the platform, without +// making anything safer. +func Judge(status int, body []byte) Outcome { + if status == 401 || status == 403 { + return Outcome{false, fmt.Sprintf( + "verdict refused the request (HTTP %d: the token may not ask for this service/revision): "+ + "image NOT pushed", status)} + } + if status < 200 || status >= 300 { + return Outcome{true, fmt.Sprintf( + "verdict NOT answered (HTTP %d): pushed; the deploy gate judges this digest", status)} + } + var a Answer + if err := json.Unmarshal(body, &a); err != nil { + return Outcome{true, "verdict NOT readable: pushed; the deploy gate judges this digest"} + } + switch a.Decision { + case "refuse": + families := "unknown" + if len(a.Reasons) > 0 { + names := make([]string, 0, len(a.Reasons)) + for _, r := range a.Reasons { + name, _, _ := strings.Cut(r, ":") + names = append(names, strings.TrimSpace(name)) + } + families = strings.Join(names, ", ") + } + return Outcome{false, fmt.Sprintf( + "verdict: block (%s): image NOT pushed. %s", families, strings.Join(a.Reasons, "; "))} + case "push": + msg := fmt.Sprintf("verdict: %s (mode %s): pushing", a.Result, a.Mode) + if len(a.WouldBlock) > 0 { + msg += fmt.Sprintf("; would block in enforce: %s (recorded as secure_delivery.would_block)", + strings.Join(a.WouldBlock, ", ")) + } + return Outcome{true, msg} + default: + return Outcome{true, fmt.Sprintf( + "verdict answered %q, which is not push/refuse: pushed; the deploy gate judges this digest", + a.Decision)} + } +} diff --git a/standard-build/pushgate/pushgate_test.go b/standard-build/pushgate/pushgate_test.go new file mode 100644 index 0000000..d11e126 --- /dev/null +++ b/standard-build/pushgate/pushgate_test.go @@ -0,0 +1,124 @@ +package pushgate + +import ( + "strings" + "testing" +) + +const ( + hexA = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + hexB = "fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210" +) + +func TestManifestDigestFromIndexTakesTheOneImage(t *testing.T) { + index := `{"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:` + hexA + `","size":1}]}` + got, err := ManifestDigestFromIndex([]byte(index)) + if err != nil || got != "sha256:"+hexA { + t.Fatalf("got %q, %v", got, err) + } + docker := strings.Replace(index, "application/vnd.oci.image.manifest.v1+json", + "application/vnd.docker.distribution.manifest.v2+json", 1) + if _, err := ManifestDigestFromIndex([]byte(docker)); err != nil { + t.Fatalf("a docker v2 manifest is a single image too: %v", err) + } +} + +func TestManifestDigestFromIndexRefusesWhatIsNotOneImage(t *testing.T) { + m := `{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:` + hexA + `"}` + for name, index := range map[string]string{ + "two manifests": `{"manifests":[` + m + `,` + m + `]}`, + "none": `{"manifests":[]}`, + "an index": `{"manifests":[{"mediaType":"application/vnd.oci.image.index.v1+json","digest":"sha256:` + hexA + `"}]}`, + "sha512": `{"manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha512:` + hexA + `"}]}`, + "upper hex": `{"manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:` + strings.ToUpper(hexA) + `"}]}`, + "not json": `manifests`, + } { + if _, err := ManifestDigestFromIndex([]byte(index)); err == nil { + t.Errorf("%s: accepted", name) + } + } +} + +func TestRegistryDigestFromReadsOnlyItsLine(t *testing.T) { + out := "logged in\npushed blob sha256:" + hexB + "\nPUSHED x\n" + RegistryDigestPrefix + "sha256:" + hexA + "\n" + if got := RegistryDigestFrom(out); got != "sha256:"+hexA { + t.Fatalf("got %q", got) + } + if got := RegistryDigestFrom("pushed blob sha256:" + hexA); got != "" { + t.Fatalf("a blob digest is not the registry's manifest digest, got %q", got) + } + if got := RegistryDigestFrom(RegistryDigestPrefix + "sha256:abc"); got != "" { + t.Fatalf("a short digest is not a digest, got %q", got) + } +} + +// Mutant: make SameDigest return nil unconditionally -> this test fails. +func TestSameDigestFailsOnAMismatch(t *testing.T) { + if err := SameDigest("sha256:"+hexA, "sha256:"+hexA); err != nil { + t.Fatalf("equal digests: %v", err) + } + err := SameDigest("sha256:"+hexA, "sha256:"+hexB) + if err == nil || !strings.Contains(err.Error(), "differs") { + t.Fatalf("mismatch accepted: %v", err) + } + if SameDigest("sha256:"+hexA, "") == nil { + t.Fatal("a registry that reported no digest was accepted") + } +} + +func TestRequestBodyValidates(t *testing.T) { + if _, err := RequestBody("svc", "sha256:"+hexA, "0123456789ab"); err != nil { + t.Fatalf("legitimate request refused: %v", err) + } + if _, err := RequestBody("svc", "sha256:"+hexA, "0123456789ab-rc-build.7"); err != nil { + t.Fatalf("a UAT rebuild tag is a legitimate version: %v", err) + } + for name, args := range map[string][3]string{ + "no service": {"", "sha256:" + hexA, "v1"}, + "tag digest": {"svc", "latest", "v1"}, + "bad version": {"svc", "sha256:" + hexA, "../x"}, + "empty version": {"svc", "sha256:" + hexA, ""}, + } { + if _, err := RequestBody(args[0], args[1], args[2]); err == nil { + t.Errorf("%s: accepted", name) + } + } +} + +// Mutant: make Judge push on `refuse` -> this test fails. +func TestJudgeRefusesOnlyAnExplicitRefusal(t *testing.T) { + refused := Judge(200, []byte(`{"decision":"refuse","result":"block","mode":"enforce","reasons":["cve: 2 critical"],"would_block":[]}`)) + if refused.Push || !strings.Contains(refused.Message, "verdict: block (cve)") { + t.Fatalf("refusal: %+v", refused) + } +} + +// Mutant (legal direction): make Judge refuse everything -> this test fails. +func TestJudgePushesInShadowAndSaysWhatWouldBlock(t *testing.T) { + shadow := Judge(200, []byte(`{"decision":"push","result":"block","mode":"shadow","reasons":[],"would_block":["cve"]}`)) + if !shadow.Push || !strings.Contains(shadow.Message, "would block in enforce: cve") { + t.Fatalf("shadow: %+v", shadow) + } + for name, o := range map[string]Outcome{ + "unreachable": Judge(0, nil), + "server error": Judge(503, nil), + "not found": Judge(404, nil), + "garbage": Judge(200, []byte(``)), + "unknown word": Judge(200, []byte(`{"decision":"maybe"}`)), + } { + if !o.Push { + t.Errorf("%s: refused a push without an explicit refusal (%s)", name, o.Message) + } + } +} + +// Mutant: drop the 401/403 branch in Judge -> this test fails (a refused token +// binding would push silently). WP-06 review, 2026-11-04. +func TestJudgeRefusesAnAuthorizationRefusal(t *testing.T) { + for _, status := range []int{401, 403} { + o := Judge(status, []byte(`{"type":"scan-token-wrong-revision"}`)) + if o.Push || !strings.Contains(o.Message, "image NOT pushed") { + t.Errorf("HTTP %d: %+v", status, o) + } + } +} diff --git a/static-deploy/dagger.json b/static-deploy/dagger.json index adaf7a1..f3e3bb2 100644 --- a/static-deploy/dagger.json +++ b/static-deploy/dagger.json @@ -1,6 +1,6 @@ { "name": "static-deploy", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/vm-deploy/dagger.json b/vm-deploy/dagger.json index 7e54e52..03a4afe 100644 --- a/vm-deploy/dagger.json +++ b/vm-deploy/dagger.json @@ -1,6 +1,6 @@ { "name": "vm-deploy", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" }, diff --git a/windows-deploy/dagger.json b/windows-deploy/dagger.json index 31d0d30..c2ae0d6 100644 --- a/windows-deploy/dagger.json +++ b/windows-deploy/dagger.json @@ -1,6 +1,6 @@ { "name": "windows-deploy", - "engineVersion": "v0.21.7", + "engineVersion": "v0.21.11", "sdk": { "source": "go" },