-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitleaks GitHub Action Rule #250
base: main
Are you sure you want to change the base?
Changes from 5 commits
b719cb7
27810ee
5626ef2
a432c20
9fc3bd8
a35be44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tests: | ||
- name: "Should have Gitleaks enabled" | ||
def: {} | ||
params: {} | ||
expect: "pass" | ||
git: | ||
repo_base: github_action_with_gitleaks | ||
- name: "Should not have Gitleaks enabled" | ||
def: {} | ||
params: {} | ||
expect: "fail" | ||
git: | ||
repo_base: github_action_without_gitleaks |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: gitleaks | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Run every 15 minutes | ||
- cron: '0/15 * * * *' | ||
jobs: | ||
gitleaks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Self-hosted Gitleaks | ||
uses: gitleaks/gitleaks-action@v2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Just Checkout | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Run every 15 minutes | ||
- cron: '0/15 * * * *' | ||
jobs: | ||
gitleaks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
version: v1 | ||
release_phase: alpha | ||
type: rule-type | ||
name: gitleaks_github_action | ||
display_name: Enable Gitleak to prevent leakage of passwords or keys | ||
short_failure_message: Gitleak is not configured via a GitHub action | ||
severity: | ||
value: medium | ||
context: {} | ||
description: | | ||
Verifies that Gitleak is configured via a GitHub action for the repository. | ||
guidance: | | ||
Ensure that Gitleak is configured and enabled for the repository. | ||
Gitleaks is an open-source secret scanner for git repositories, files, and directories. | ||
For more information, see the [GitHub Action Gitleaks](https://github.com/gitleaks/gitleaks-action) documentation. | ||
def: | ||
in_entity: repository | ||
rule_schema: | ||
type: object | ||
properties: {} | ||
ingest: | ||
type: git | ||
git: {} | ||
eval: | ||
type: rego | ||
rego: | ||
type: deny-by-default | ||
def: | | ||
package minder | ||
|
||
import rego.v1 | ||
|
||
actions := github_workflow.ls_actions("./.github/workflows") | ||
|
||
default message := "Gitleaks GitHub action is not configured" | ||
default allow := false | ||
allow if contains(actions[_], "gitleaks/gitleaks-action") | ||
Comment on lines
+36
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to check that the workflow is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, do you want to add a remediation using the usage example from either the action or the repo? |
||
|
||
# Defines the configuration for alerting on the rule | ||
alert: | ||
type: security_advisory | ||
security_advisory: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Gitleak/Gitleaks/
https://github.com/gitleaks/gitleaks seems to be consistently plural
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good eyes. Updated text to be consistently plural