Skip to content

Commit d3f0e8a

Browse files
committed
Add spam detection & auto assignment
1 parent 94668ac commit d3f0e8a

File tree

4 files changed

+130
-21
lines changed

4 files changed

+130
-21
lines changed

.github/workflows/auto-assign.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Auto Assign Issues
2+
3+
permissions:
4+
issues: write
5+
6+
on:
7+
issues:
8+
types: [opened]
9+
10+
jobs:
11+
assign_issue:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Assign issue to maintainer
15+
uses: actions/github-script@v6
16+
with:
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
script: |
19+
await github.rest.issues.addAssignees({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
issue_number: context.issue.number,
23+
assignees: ['akegaviar']
24+
});
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Suspicious Comment Detection
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
9+
jobs:
10+
check_comment:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check for suspicious patterns
14+
uses: actions/github-script@v6
15+
with:
16+
github-token: ${{ secrets.GITHUB_TOKEN }}
17+
script: |
18+
const comment = context.payload.comment;
19+
const body = comment.body.toLowerCase();
20+
const author = comment.user.login;
21+
22+
// Suspicious patterns
23+
const suspiciousPatterns = [
24+
'support team',
25+
'customer service',
26+
'telegram',
27+
'whatsapp',
28+
'contact us',
29+
'click here',
30+
'support group',
31+
't.me/',
32+
'wa.me/',
33+
'support chat',
34+
'live chat',
35+
'support ticket',
36+
'ticket id',
37+
'live support',
38+
'support line',
39+
'support agent',
40+
'support network',
41+
'dedicated support',
42+
'personalized assistance',
43+
'opened for you',
44+
'kindly talk to',
45+
'we apologize',
46+
'live chat with an agent',
47+
'chat button',
48+
'dapp portal',
49+
'decentralized dapp',
50+
'access the portal',
51+
'report your request',
52+
'start a conversation',
53+
'click the chat',
54+
'for assistance',
55+
'reach out to',
56+
'through the chat',
57+
'portal',
58+
];
59+
60+
// Check for external links (excluding common legitimate domains)
61+
const hasExternalLinks = body.includes('http') || body.includes('www');
62+
const hasGithubLinks = body.includes('github.com');
63+
const suspiciousLinks = hasExternalLinks && !hasGithubLinks;
64+
65+
// Check for suspicious patterns
66+
const foundPatterns = suspiciousPatterns.filter(pattern =>
67+
body.includes(pattern)
68+
);
69+
70+
if (foundPatterns.length > 0 || suspiciousLinks) {
71+
// Create a warning comment
72+
const warningMessage = `⚠️ Potential scam detected in comment by ${author}:
73+
- Suspicious patterns found: ${foundPatterns.join(', ')}
74+
${suspiciousLinks ? '- Contains external links' : ''}
75+
76+
@${context.repo.owner} Please review this comment.`;
77+
78+
await github.rest.issues.createComment({
79+
owner: context.repo.owner,
80+
repo: context.repo.repo,
81+
issue_number: context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number,
82+
body: warningMessage
83+
});
84+
85+
// Add 'potential-scam' label
86+
await github.rest.issues.addLabels({
87+
owner: context.repo.owner,
88+
repo: context.repo.repo,
89+
issue_number: context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number,
90+
labels: ['potential-scam']
91+
});
92+
}

MAINTAINERS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The maintainers are:
2+
* [@akegaviar](https://github.com/akegaviar) (primary contact, issue manager)
3+
* [@smypmsa](https://github.com/smypmsa)

README.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
1-
<img width="1200" alt="Labs" src="https://user-images.githubusercontent.com/99700157/213291931-5a822628-5b8a-4768-980d-65f324985d32.png">
2-
3-
<p>
4-
<h3 align="center">Chainstack is the leading suite of services connecting developers with Web3 infrastructure</h3>
5-
</p>
6-
7-
<p align="center">
8-
<a target="_blank" href="https://chainstack.com/build-better-with-ethereum/"><img src="https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Ethereum.svg" /></a>&nbsp;
9-
<a target="_blank" href="https://chainstack.com/build-better-with-bnb-smart-chain/"><img src="https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/BNB.svg" /></a>&nbsp;
10-
<a target="_blank" href="https://chainstack.com/build-better-with-polygon/"><img src="https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Polygon.svg" /></a>&nbsp;
11-
<a target="_blank" href="https://chainstack.com/build-better-with-avalanche/"><img src="https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Avalanche.svg" /></a>&nbsp;
12-
<a target="_blank" href="https://chainstack.com/build-better-with-solana/"><img src="https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Solana.svg" /></a>&nbsp;
13-
</p>
14-
15-
<p align="center">
16-
<a target="_blank" href="https://chainstack.com/protocols/">Supported protocols</a> •
17-
<a target="_blank" href="https://chainstack.com/blog/">Chainstack blog</a> •
18-
<a target="_blank" href="https://docs.chainstack.com/quickstart/">Chainstack docs</a> •
19-
<a target="_blank" href="https://docs.chainstack.com/quickstart/">Blockchain API reference</a> •
20-
<a target="_blank" href="https://console.chainstack.com/user/account/create">Start for free</a>
21-
</p>
1+
**>>WARNNING ON SCAMS IN ISSUES COMMENT SECTION<<**
2+
3+
The issues comment section is often targeted by scam bots willing to redirect you to an external resource and drain your funds.
4+
5+
I have enabled a GitHub actions script to detect the common patterns and tag them, which obviously is not 100% accurate.
6+
7+
The official maintainers are in the [MAINTAINERS.md](MAINTAINERS.md) file.
8+
9+
Not everyone is a scammer though, sometimes there are helpful outside devs who comment and I absolutely appreciate it.
10+
11+
**>>END OF WARNING<<**
2212

2313
# TLDR quick run
2414

0 commit comments

Comments
 (0)