Skip to content

Commit 807b617

Browse files
Update security-bot.yml
1 parent 73601c0 commit 807b617

1 file changed

Lines changed: 39 additions & 46 deletions

File tree

.github/workflows/security-bot.yml

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,55 @@
1-
name: "🛡️ Triage: Malicious Link Detector"
1+
name: "📡 Blogger Bot Tracker"
22

33
on:
4-
issue_comment:
5-
types: [created]
6-
issues:
7-
types: [opened, edited]
4+
schedule:
5+
- cron: '0 * * * *' # Runs every hour, on the hour
6+
workflow_dispatch: # Allows you to click "Run" whenever you want
87

98
jobs:
10-
triage-links:
9+
scrape-blogger:
1110
runs-on: ubuntu-latest
12-
# Only run if the commenter is not you (to prevent self-flagging)
13-
if: github.event.sender.login != 'DeveloperTryingToCodeLikeOtherOfThem'
1411
permissions:
1512
issues: write
16-
contents: read
1713

1814
steps:
19-
- name: "Identify Malice"
20-
id: check
21-
env:
22-
BODY: ${{ github.event.comment.body || github.event.issue.body }}
23-
AUTHOR: ${{ github.event.sender.login }}
15+
- name: "Forensic Fetch"
2416
run: |
25-
# 1. Define the targets
26-
LINK="enablesmartspirit.blogspot.com"
27-
BOT_PATTERN="USER[0-9]{4}"
28-
PHRASE="PLEASE LIKE ME"
17+
TARGET="https://enablesmartspirit.blogspot.com/"
2918
30-
# 2. Search for signatures
31-
if echo "$BODY" | grep -qE "$LINK|$BOT_PATTERN|$PHRASE"; then
32-
echo "MATCH_FOUND=true" >> $GITHUB_ENV
33-
echo "REASON=Malicious Link or Bot Signature detected from $AUTHOR" >> $GITHUB_ENV
34-
fi
19+
# We use stealth headers so the Blogger bot doesn't hide the "USER####" text from us
20+
curl -s -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/123.0.0.0" \
21+
-H "Referer: https://www.google.com/" \
22+
--compressed "$TARGET" > blogger_dump.html
3523
36-
- name: "Lock and Flag"
37-
if: env.MATCH_FOUND == 'true'
38-
env:
39-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
40-
ISSUE_URL: ${{ github.event.issue.html_url }}
41-
COMMENT_ID: ${{ github.event.comment.id }}
24+
- name: "Identify Bot Response"
25+
id: detector
4226
run: |
43-
# Close and Lock the issue immediately to stop the spam flood
44-
gh issue close "$ISSUE_URL" --reason "not planned"
45-
gh issue lock "$ISSUE_URL" --reason "spam"
46-
47-
# Add a warning label
48-
gh issue edit "$ISSUE_URL" --add-label "threat-detected"
27+
# Look for the specific pattern you saw: "Answer: It seems that your repository..."
28+
# Also look for any USER#### IDs appearing on the page
29+
if grep -qE "Answer:|USER[0-9]{4}|failed" blogger_dump.html; then
30+
echo "BOT_RESPONDED=true" >> $GITHUB_ENV
31+
32+
# Extract the specific text the bot wrote to show you in the report
33+
# This grabs 2 lines of context around the "Answer"
34+
grep -C 2 "Answer:" blogger_dump.html > bot_message.txt || echo "Pattern found but hidden in script" > bot_message.txt
35+
fi
4936
50-
- name: "Report to Watchdog"
51-
if: env.MATCH_FOUND == 'true'
37+
- name: "Report Bot to GitHub"
38+
if: env.BOT_RESPONDED == 'true'
5239
env:
53-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
54-
# Path to your private forensic repo
55-
WATCHDOG_REPO: "DeveloperTryingToCodeLikeOtherOfThem/workflow-testing"
40+
GH_TOKEN: ${{ secrets.GH_TOKEN}}
41+
REPO: "DeveloperTryingToCodeLikeOtherOfThem/pxt-hardware-programming-docs"
5642
run: |
57-
gh issue create --repo "$WATCHDOG_REPO" \
58-
--title "🚨 BOT NEUTRALIZED: $REASON" \
59-
--body "A bot tried to post a malicious link in the public repo.
60-
**Bot User:** ${{ github.event.sender.login }}
61-
**Issue:** ${{ github.event.issue.html_url }}
62-
**Action Taken:** Issue Closed and Locked."
43+
MSG=$(cat bot_message.txt)
44+
gh issue create --repo "$REPO" \
45+
--title "📢 NEW BOT ACTIVITY ON BLOGGER" \
46+
--body "### The Tracker caught a bot update on the suspicious site:
47+
48+
**Detected Text:**
49+
\`\`\`text
50+
$MSG
51+
\`\`\`
52+
53+
**Target Site:** https://enablesmartspirit.blogspot.com/
54+
**Status:** Bot is actively generating fake triage reports." \
55+
--label "threat-detected"

0 commit comments

Comments
 (0)