Skip to content

Commit b9eb877

Browse files
Update Security-Notification.yml
Adjusting title
1 parent 581c968 commit b9eb877

1 file changed

Lines changed: 16 additions & 23 deletions

File tree

.github/workflows/Security-Notification.yml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,39 @@ jobs:
1717
GH_TOKEN: ${{ secrets.DEPENDABOT_PAT }}
1818
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
1919
run: |
20-
echo "--- TEST MODE ACTIVE (Ignoring Time Threshold) ---"
20+
echo "--- TEST MODE ACTIVE (Fetching open alerts) ---"
2121
22-
# 1. Fetch ALL open alerts (Raw JSON)
22+
# 1. Fetch ALL open alerts
2323
RAW_DATA=$(gh api "/repos/${{ github.repository }}/dependabot/alerts?state=open")
2424
25-
# 2. Filter locally using jq
26-
# --- CHANGE IS HERE ---
27-
# I removed "| select(.created_at > $TIME)" so it finds OLD alerts too.
28-
# I also removed the Severity check so it finds ANY open alert (Low/Med/High).
25+
# 2. Filter locally (Select ANY open alert for testing)
2926
ALERTS=$(echo "$RAW_DATA" | jq '[ .[] | select(.state == "open") ]')
3027
31-
# 3. Debugging structure
32-
echo "New alerts detected! Debugging structure..."
33-
34-
# Check if we actually have data now
28+
# 3. Check results
3529
LENGTH=$(echo "$ALERTS" | jq 'length')
3630
if [ "$LENGTH" -eq 0 ]; then
37-
echo "::error:: Still no alerts found! check if your PAT has 'repo' or 'security_events' scope."
31+
echo "::error:: No alerts found."
3832
exit 1
3933
fi
4034
41-
# Print keys to confirm we can read the data
42-
echo "Top-level keys found in first alert:"
43-
echo "$ALERTS" | jq '.[0] | keys'
35+
echo "Found alerts. Extracting details..."
4436
4537
# 4. Extract details
46-
# We use the raw data keys.
47-
# Note: If keys output shows 'security_vulnerability' instead of 'security_advisory', we might need to adjust below.
38+
# NEW: Extract the 'summary' (The description of the vulnerability)
39+
SUMMARY=$(echo "$ALERTS" | jq -r '.[0].security_advisory.summary // "Security Vulnerability"')
4840
PACKAGE=$(echo "$ALERTS" | jq -r '.[0].dependency.package.name // "Unknown Package"')
49-
SEVERITY=$(echo "$ALERTS" | jq -r '.[0].security_advisory.severity // "Unknown Severity"')
50-
51-
# Fallback URL logic
41+
SEVERITY=$(echo "$ALERTS" | jq -r '.[0].security_advisory.severity // "Unknown"')
5242
ISSUE_URL=$(echo "$ALERTS" | jq -r '.[0].html_url // .[0].url // "https://github.com"')
5343
54-
# Prepare text
5544
REPO_NAME="${{ github.repository }}"
56-
ISSUE_TITLE="${PACKAGE} (${SEVERITY})"
5745
ISSUE_USER="Dependabot"
5846
59-
# 5. Build Slack Message
47+
# 5. Format the Title
48+
# OLD: next (high)
49+
# NEW: Cross-site Scripting - next (high)
50+
ISSUE_TITLE="${SUMMARY} - ${PACKAGE} (${SEVERITY})"
51+
52+
# 6. Build Slack Message
6053
MESSAGE_TEXT=$(jq -n \
6154
--arg repo "$REPO_NAME" \
6255
--arg title "$ISSUE_TITLE" \
@@ -65,7 +58,7 @@ jobs:
6558
--arg template "*📢 New Dependabot Alert ($REPO_NAME) 📢*\n\n*Issue Title:* $ISSUE_TITLE\n*Opened By:* $ISSUE_USER\n\n*View Issue:* $ISSUE_URL" \
6659
'$template')
6760
68-
# 6. Build Payload & Send
61+
# 7. Build Payload & Send
6962
SLACK_PAYLOAD=$(jq -n \
7063
--arg text "$MESSAGE_TEXT" \
7164
'{

0 commit comments

Comments
 (0)