|
| 1 | +/** |
| 2 | + * @name Secret In Artifacts |
| 3 | + * @description Secrets are exposed in GitHub Artifacts |
| 4 | + * @kind problem |
| 5 | + * @problem.severity error |
| 6 | + * @security-severity 9.0 |
| 7 | + * @precision high |
| 8 | + * @id actions/secrets-in-artifacts |
| 9 | + * @tags actions |
| 10 | + * security |
| 11 | + * external/cwe/cwe-312 |
| 12 | + */ |
| 13 | + |
| 14 | +import actions |
| 15 | + |
| 16 | +from UsesStep checkout, UsesStep upload |
| 17 | +where |
| 18 | + checkout.getCallee() = "actions/checkout" and |
| 19 | + upload.getCallee() = "actions/upload-artifact" and |
| 20 | + checkout.getAFollowingStep() = upload and |
| 21 | + ( |
| 22 | + not exists(checkout.getArgument("persist-credentials")) or |
| 23 | + checkout.getArgument("persist-credentials") = "true" |
| 24 | + ) and |
| 25 | + upload.getVersion() = |
| 26 | + [ |
| 27 | + "v4.3.6", "834a144ee995460fba8ed112a2fc961b36a5ec5a", // |
| 28 | + "v4.3.5", "89ef406dd8d7e03cfd12d9e0a4a378f454709029", // |
| 29 | + "v4.3.4", "0b2256b8c012f0828dc542b3febcab082c67f72b", // |
| 30 | + "v4.3.3", "65462800fd760344b1a7b4382951275a0abb4808", // |
| 31 | + "v4.3.2", "1746f4ab65b179e0ea60a494b83293b640dd5bba", // |
| 32 | + "v4.3.1", "5d5d22a31266ced268874388b861e4b58bb5c2f3", // |
| 33 | + "v4.3.0", "26f96dfa697d77e81fd5907df203aa23a56210a8", // |
| 34 | + "v4.2.0", "694cdabd8bdb0f10b2cea11669e1bf5453eed0a6", // |
| 35 | + "v4.1.0", "1eb3cb2b3e0f29609092a73eb033bb759a334595", // |
| 36 | + "v4.0.0", "c7d193f32edcb7bfad88892161225aeda64e9392", // |
| 37 | + ] and |
| 38 | + ( |
| 39 | + not exists(checkout.getArgument("path")) and |
| 40 | + upload.getArgument("path") = [".", "*"] |
| 41 | + or |
| 42 | + checkout.getArgument("path") + ["", "/*"] = upload.getArgument("path") |
| 43 | + ) |
| 44 | +select upload, "A secret is exposed in an artifact uploaded by $@", upload, |
| 45 | + "actions/upload-artifact" |
0 commit comments