tangled
alpha
login
or
join now
skywatch.blue
/
skywatch-automod
7
fork
atom
A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules
7
fork
atom
overview
issues
pulls
pipelines
Add facet spam allowlist (to allow for test scenarios)
D. Scarnecchia
5 months ago
7cf3180b
a1048515
+15
-1
2 changed files
expand all
collapse all
unified
split
src
rules
facets
facets.ts
tests
facets.test.ts
+14
src/rules/facets/facets.ts
reviewed
···
10
10
export const FACET_SPAM_COMMENT =
11
11
"Abusive facet usage detected (hidden mentions)";
12
12
13
13
+
// Allowlist for DIDs with legitimate duplicate facet use cases
14
14
+
export const FACET_SPAM_ALLOWLIST: string[] = [
15
15
+
// Add DIDs here that should be exempt from facet spam detection
16
16
+
];
17
17
+
13
18
/**
14
19
* Checks if a post contains facet spam by detecting multiple facets
15
20
* with identical byte positions (indicating hidden/abusive mentions)
···
20
25
atURI: string,
21
26
facets: Facet[],
22
27
): Promise<void> => {
28
28
+
// Check allowlist
29
29
+
if (FACET_SPAM_ALLOWLIST.includes(did)) {
30
30
+
logger.debug(
31
31
+
{ process: "FACET_SPAM", did, atURI },
32
32
+
"Allowlisted DID",
33
33
+
);
34
34
+
return;
35
35
+
}
36
36
+
23
37
if (!facets || facets.length === 0) {
24
38
return;
25
39
}
+1
-1
src/rules/facets/tests/facets.test.ts
reviewed
···
1
1
import { describe, it, expect, vi, beforeEach } from "vitest";
2
2
-
import { checkFacetSpam, FACET_SPAM_THRESHOLD, FACET_SPAM_LABEL, FACET_SPAM_COMMENT } from "../facets.js";
2
2
+
import { checkFacetSpam, FACET_SPAM_THRESHOLD, FACET_SPAM_LABEL, FACET_SPAM_COMMENT, FACET_SPAM_ALLOWLIST } from "../facets.js";
3
3
import { Facet } from "../../../types.js";
4
4
5
5
// Mock dependencies