Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Dependabot version updates. Security (CVE) updates are enabled separately in
# repo Settings > Code security and do not require an entry here.
version: 2
updates:
# Java — root pom plus the nested v2 reactor (module dirs enumerated so every
# child pom is scanned; grouping keeps it to one PR per run).
- package-ecosystem: maven
directories:
- "/"
- "/v2"
- "/v2/*"
- "/v2/cdc-parent/*"
schedule:
interval: cron
cronjob: "0 11 * * 1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Schedule style looks different from what I've seen, are you sure this works? If yes, all good

timezone: "Asia/Kolkata"
open-pull-requests-limit: 10
labels:
- dependencies
commit-message:
prefix: "build"
include: "scope"
groups:
maven-minor-and-patch:
update-types:
- minor
- patch

# GitHub Actions — keeps the SHA-pinned actions in workflows current.
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: cron
cronjob: "0 11 * * 1"
timezone: "Asia/Kolkata"
open-pull-requests-limit: 5
labels:
- dependencies
- github-actions
commit-message:
prefix: "build"
include: "scope"
groups:
github-actions:
patterns:
- "*"

# Docker
- package-ecosystem: docker
directory: "/v2/flex-wordcount-python"
schedule:
interval: cron
cronjob: "0 11 * * 1"
timezone: "Asia/Kolkata"
open-pull-requests-limit: 5
labels:
- dependencies
- docker
commit-message:
prefix: "build"
include: "scope"
103 changes: 103 additions & 0 deletions .github/workflows/security_scan_pr_schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Security Scan

on:
pull_request:
branches: [master, main]
pull_request_target:
types: [opened, reopened]
schedule:
# Every day at 11:30 AM IST (6:00 AM UTC)
- cron: "0 6 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
trivy-fork-pr:
name: Trivy security scan (fork PR)
# Fork PRs are untrusted: run scan with read-only permissions and no secrets.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
with:
scan-type: fs
ignore-unfixed: true
severity: 'HIGH,CRITICAL'
format: 'table'
exit-code: '1'
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does it have JAVA code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes


trivy:
name: Trivy security scan (trusted contexts)
# Skip on pull_request_target — that event runs with full secrets and must
# never check out / execute PR-supplied code. See dependabot-notify below.
# This trusted job handles non-fork pull_request, schedule, and manual runs.
if: github.event_name != 'pull_request_target' && (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork)
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
with:
scan-type: fs
ignore-unfixed: true
severity: 'HIGH,CRITICAL'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
exit-code: '1'
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@b22c66273205240d86582638b860f9b25772b4d3 # v3
# Fork PRs have restricted GITHUB_TOKEN permissions and cannot upload
# SARIF to Security tab. Keep scan behavior, but skip upload in forks.
if: always() && (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork)
with:
sarif_file: 'trivy-results.sarif'

- name: Notify Slack on scheduled scan failure
if: failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with:
payload: |
{
"text": ":rotating_light: Trivy detected HIGH/CRITICAL CVEs on ${{ github.ref_name }} in ${{ github.repository }}\nRun: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\nFindings: ${{ github.server_url }}/${{ github.repository }}/security/code-scanning?query=is%3Aopen+tool%3ATrivy"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TRIVY_WEBHOOK_URL }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Which channel we are using?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

logging-integrations-notifications


dependabot-notify:
name: Notify Slack on Dependabot PR
# IMPORTANT: This job uses pull_request_target which has full secrets access.
# Do NOT add a `checkout` step here — that would run PR-supplied code with secrets.
# This job's only purpose is to POST to Slack with metadata; nothing else.
if: github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with:
payload: |
{
"text": ":robot_face: Dependabot opened a PR in ${{ github.repository }}\nTitle: ${{ github.event.pull_request.title }}\nPR: ${{ github.event.pull_request.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TRIVY_WEBHOOK_URL }}
Loading