Skip to content

Conversation

@kszarek
Copy link
Member

@kszarek kszarek commented Jan 8, 2026

Add required secrets scanning workflow that runs on pull requests to detect accidentally committed secrets.

Changes

  • Added .github/workflows/secrets-scan-on-pr.yaml
  • Uses detect-secrets-action to scan for secrets in PRs
  • Runs on pull requests to main/master branches
  • Required check for all PRs as per repository requirements

Testing

The workflow will automatically run on this PR to verify it works correctly.

@kszarek kszarek requested a review from a team as a code owner January 8, 2026 10:38
- Add secrets-scan-on-pr.yaml workflow that runs on pull requests
- Uses detect-secrets-action to scan for accidentally committed secrets
- Required for all PRs as per repository requirements
@kszarek kszarek force-pushed the add-secrets-scanning-workflow branch from cc92838 to 9c469e4 Compare January 8, 2026 10:40
Comment on lines +8 to +9
uses: AirHelp/gh-actions/.github/workflows/secrets-scan-on-pr.yaml@master
secrets: inherit

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 3 days ago

In general, the problem is fixed by explicitly adding a permissions block to the workflow or to the specific job so that the GITHUB_TOKEN has only the minimum required access. Since this workflow only defines a single job that calls a reusable workflow, and we don’t know any need for write access from this file, we can safely restrict permissions to read-only for repository contents.

The best minimal change is to add a permissions block at the workflow (top) level, just under name: Secrets Scan. This will apply to all jobs in this workflow (including scan) unless they override permissions themselves. A conservative least-privilege choice is contents: read, which allows the reusable workflow to read repository contents while preventing write operations with the GITHUB_TOKEN from this workflow’s context.

Concretely, in .github/workflows/secrets-scan-on-pr.yaml, insert:

permissions:
  contents: read

between line 1 (name: Secrets Scan) and line 3 (on:). No additional imports, methods, or definitions are needed because this is purely a YAML configuration change.

Suggested changeset 1
.github/workflows/secrets-scan-on-pr.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/secrets-scan-on-pr.yaml b/.github/workflows/secrets-scan-on-pr.yaml
--- a/.github/workflows/secrets-scan-on-pr.yaml
+++ b/.github/workflows/secrets-scan-on-pr.yaml
@@ -1,4 +1,6 @@
 name: Secrets Scan
+permissions:
+  contents: read
 
 on:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: Secrets Scan
permissions:
contents: read

on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
@jadrol jadrol self-requested a review January 8, 2026 10:47
@kszarek kszarek closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants