-
Notifications
You must be signed in to change notification settings - Fork 27
Testing out changes #1234
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
Closed
Closed
Testing out changes #1234
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8dbc6c0
Testing out changes
isaiah-grafana 790283d
Testing out changes
isaiah-grafana 1868c0f
Modified workflows
isaiah-grafana 4b96833
Updated workflows
isaiah-grafana 5a5a828
Made changes
isaiah-grafana 4fb20fe
More updates
isaiah-grafana 1a17b20
Testing
isaiah-grafana 066b505
More testing
isaiah-grafana 90b5330
chore(deps): update astral-sh/setup-uv action to v6.5.0 (#1233)
grafanarenovatebot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Reusable Trufflehog Scan | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
fail-on-secrets: | ||
description: "Fail the workflow if secrets are found" | ||
required: false | ||
default: "true" | ||
type: string | ||
|
||
jobs: | ||
trufflehog-scan: | ||
runs-on: ubuntu-x64-small | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
Comment on lines
+20
to
+22
Check warningCode scanning / zizmor credential persistence through GitHub Actions artifacts Warning
credential persistence through GitHub Actions artifacts
|
||
|
||
- name: Run Trufflehog and print findings | ||
id: trufflehog | ||
run: | | ||
docker run --rm -v ${{ github.workspace }}:/pwd ghcr.io/trufflesecurity/trufflehog:latest \ | ||
filesystem --directory=/pwd --json | tee trufflehog-results.tmp | ||
if [ -s trufflehog-results.tmp ]; then | ||
echo "### Trufflehog Findings" >> $GITHUB_STEP_SUMMARY | ||
jq -r '.[] | "- \(.SourceMetadata.Data.path):\(.SourceMetadata.Data.line // "?") \(.Raw | @json)"' trufflehog-results.tmp >> $GITHUB_STEP_SUMMARY | ||
echo "found_secrets=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "No secrets found." >> $GITHUB_STEP_SUMMARY | ||
echo "found_secrets=false" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Comment on PR with findings | ||
if: ${{ steps.trufflehog.outputs.found_secrets == 'true' && github.event_name == 'pull_request' }} | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
let findings = []; | ||
try { | ||
const data = JSON.parse(fs.readFileSync('trufflehog-results.tmp', 'utf8')); | ||
for (const finding of data) { | ||
if (finding.SourceMetadata && finding.SourceMetadata.Data) { | ||
findings.push(`- \`${finding.SourceMetadata.Data.path}\` line ${finding.SourceMetadata.Data.line || '?'}: \`${finding.Raw.slice(0, 80)}...\``); | ||
} | ||
} | ||
} catch (e) { | ||
findings = ['(Could not parse Trufflehog report)']; | ||
} | ||
const body = findings.length | ||
? `🚨 **Trufflehog found potential secrets in this PR!**\n\n${findings.join('\n')}` | ||
: "Trufflehog ran but no findings were parsed."; | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body | ||
}); | ||
|
||
- name: Fail if secrets found | ||
if: ${{ inputs.fail-on-secrets == 'true' && steps.trufflehog.outputs.found_secrets == 'true' }} | ||
run: exit 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.