GitHub Actions security insights
Recipe ID
org.openrewrite.github.security.GitHubActionsSecurityArtifactorg.openrewrite.recipe:rewrite-github-actionsFinds potential security issues in GitHub Actions workflows, based on Zizmor security analysis rules.
Composite recipesupply-chaingithubsecurityMSAL
Add to your build
Get a download tokenThis recipe is Moderne licensed, so the token must belong to a Moderne customer. It replaces YOUR_DOWNLOAD_TOKEN below.
~/.gradle/gradle.properties
codeGenomeUsername=you@example.com
codeGenomeToken=YOUR_DOWNLOAD_TOKEN
build.gradle.kts
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}
rewrite {
activeRecipe("org.openrewrite.github.security.GitHubActionsSecurity")
}
repositories {
mavenCentral()
maven {
url = uri("https://artifacts.codegenomeproject.org/maven")
credentials {
username = providers.gradleProperty("codeGenomeUsername").get()
password = providers.gradleProperty("codeGenomeToken").get()
}
}
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-github-actions:3.32.0")
}
Then run
./gradlew rewriteRunUsage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.github.security.GitHubActionsSecurityIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-github-actions:RELEASEDefinition
This recipe runs the following recipes in order.
- Find credential persistence through GitHub Actions artifacts
org.openrewrite.github.security.ArtifactSecurity - Find spoofable bot actor checks
org.openrewrite.github.security.BotConditions - Find cache poisoning vulnerabilities
org.openrewrite.github.security.CachePoisoning - Find dangerous workflow triggers
org.openrewrite.github.security.DangerousTriggers - Find excessive permissions
org.openrewrite.github.security.ExcessivePermissions - Find forbidden action usage
org.openrewrite.github.security.ForbiddenUses - Find dangerous GITHUB_ENV usage
org.openrewrite.github.security.GitHubEnv - Find hardcoded container credentials
org.openrewrite.github.security.HardcodedCredentials - Find insecure commands configuration
org.openrewrite.github.security.InsecureCommands - Find obfuscated GitHub Actions features
org.openrewrite.github.security.Obfuscation - Find commit SHAs with potentially mismatched version comments
org.openrewrite.github.security.RefVersionMismatch - Find unconditional secrets inheritance
org.openrewrite.github.security.SecretsInherit - Find usage of self-hosted runners
org.openrewrite.github.security.SelfHostedRunner - Find template injection vulnerabilities
org.openrewrite.github.security.TemplateInjection - Find manual credentials instead of trusted publishing
org.openrewrite.github.security.TrustedPublishing - Document permissions usage
org.openrewrite.github.security.UndocumentedPermissions - Pin GitHub Actions to specific commits
org.openrewrite.github.security.UnpinnedActions - Pin Docker images to digests
org.openrewrite.github.security.UnpinnedDockerImages
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats