Skip to content

ci: add security scan workflow#1305

Open
imran-siddique wants to merge 2 commits intogithub:stagedfrom
imran-siddique:governance/add-security-scan
Open

ci: add security scan workflow#1305
imran-siddique wants to merge 2 commits intogithub:stagedfrom
imran-siddique:governance/add-security-scan

Conversation

@imran-siddique
Copy link
Copy Markdown
Contributor

Adds a standard security scan workflow with:

  • Dependency review on PRs
  • Secret scanning (AWS keys, GitHub tokens, private keys, hardcoded passwords)
  • File permission checks
  • Weekly scheduled full-repo scan

Part of governance standardization across repos.

github-actions bot and others added 2 commits April 1, 2026 23:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 5, 2026 17:52
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This PR targets main, but PRs should target staged.

The main branch is auto-published from staged and should not receive direct PRs.
Please close this PR and re-open it against the staged branch.

You can change the base branch using the Edit button at the top of this PR,
or run: gh pr edit 1305 --base staged

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new GitHub Actions workflow intended to standardize security scanning across repositories by running checks on pull requests and on a weekly schedule.

Changes:

  • Introduces a PR-only dependency review job using actions/dependency-review-action.
  • Adds a repo-wide grep-based secret scan intended to detect common credential patterns.
  • Adds a “file permissions” job intended to catch overly permissive files, plus a weekly scheduled run.

Comment on lines +12 to +13
pull-requests: write
issues: write
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow-level token permissions are broader than needed and include issues: write even though this workflow never creates/updates issues. Consider least-privilege defaults (e.g., contents: read, pull-requests: read) and only granting pull-requests: write/issues: write at job-level when a step actually posts a comment/issue (especially important for PR events).

Suggested change
pull-requests: write
issues: write
pull-requests: read

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +22
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v4
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo appears to pin GitHub Actions by full commit SHA (e.g., .github/workflows/codespell.yml:16). Using floating tags like actions/checkout@v4 and actions/dependency-review-action@v4 weakens supply-chain security and makes runs non-reproducible. Please pin these uses: references to specific SHAs (optionally with a # vX.Y.Z comment).

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +23
- uses: actions/dependency-review-action@v4
continue-on-error: true
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dependency-review-action is configured with continue-on-error: true, so dependency issues won't fail the workflow. This contradicts the PR description of adding a dependency review check on PRs; if this is intended to gate merges, remove continue-on-error (or configure the action to fail only above a chosen severity).

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +43
echo "::warning::Potential secrets detected:"
echo "$FOUND"
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The secret scan currently prints the full grep matches to the Actions log (echo "$FOUND"). If a real secret is present, this can further expose it in CI logs. Prefer redacting match contents (e.g., only output file:line without the matched substring) and consider failing the job (exit non-zero) so leaks can't be ignored.

Suggested change
echo "::warning::Potential secrets detected:"
echo "$FOUND"
REDACTED_FOUND=$(printf '%s\n' "$FOUND" | sed -E 's/^([^:]+:[0-9]+):.*/\1/')
echo "::error::Potential secrets detected at:"
echo "$REDACTED_FOUND"
exit 1

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +60
- name: Check for overly permissive files
run: |
echo "Checking for world-writable or executable scripts..."
find . -type f \( -name "*.sh" -o -name "*.ps1" \) -not -path "*/.git/*" | while read f; do
echo "Script found: $f"
done
echo "✅ File permission check complete"
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "File permission check" job doesn't actually inspect permissions; it only lists *.sh/*.ps1 files and always succeeds. This doesn't implement the PR description's "File permission checks". Update the script to check mode bits (e.g., world-writable files and unexpected executables) and fail the job when violations are found.

Copilot uses AI. Check for mistakes.
@imran-siddique imran-siddique changed the base branch from main to staged April 5, 2026 20:27
@imran-siddique imran-siddique requested a review from dvelton as a code owner April 5, 2026 20:27
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.

2 participants