Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yet more rule tweaks #745

Merged
merged 5 commits into from
Sep 5, 2024
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
1 change: 1 addition & 0 deletions automod/rules/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func DefaultRules() automod.RuleSet {
HarassmentTargetInteractionPostRule,
HarassmentTrivialPostRule,
NostrSpamPostRule,
TrivialSpamPostRule,
},
ProfileRules: []automod.ProfileRuleFunc{
GtubeProfileRule,
Expand Down
9 changes: 6 additions & 3 deletions automod/rules/interaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

var interactionDailyThreshold = 800
var followsDailyThreshold = 3000

var _ automod.RecordRuleFunc = InteractionChurnRule

Expand All @@ -26,6 +27,7 @@ func InteractionChurnRule(c *automod.RecordContext) error {
c.AddAccountFlag("high-like-churn")
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("interaction churn: %d likes, %d unlikes today (so far)", created, deleted))
c.Notify("slack")
return nil
}
case "app.bsky.graph.follow":
c.Increment("follow", did)
Expand All @@ -37,14 +39,15 @@ func InteractionChurnRule(c *automod.RecordContext) error {
c.AddAccountFlag("high-follow-churn")
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("interaction churn: %d follows, %d unfollows today (so far)", created, deleted))
c.Notify("slack")
return nil
}
// just generic bulk following
followRatio := float64(c.Account.FollowersCount) / float64(c.Account.FollowsCount)
if created > interactionDailyThreshold && c.Account.FollowsCount > 2000 && followRatio < 0.2 {
if created > followsDailyThreshold {
c.Logger.Info("bulk-follower", "created-today", created)
c.AddAccountFlag("bulk-follower")
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("bulk following: %d follows today (so far)", created))
//c.Notify("slack")
c.Notify("slack")
return nil
}
}
return nil
Expand Down
25 changes: 25 additions & 0 deletions automod/rules/quick.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,28 @@ func NewAccountBotEmailRule(c *automod.AccountContext) error {
}
return nil
}

var _ automod.PostRuleFunc = TrivialSpamPostRule

// looks for new accounts, which frequently post the same type of content
func TrivialSpamPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error {
if c.Account.Identity == nil || !AccountIsYoungerThan(&c.AccountContext, 8*24*time.Hour) {
return nil
}

// only posts with dumb patterns (for now)
txt := strings.ToLower(post.Text)
if !c.InSet("trivial-spam-text", txt) {
return nil
}

// only accounts with empty profile (for now)
if c.Account.Profile.HasAvatar {
return nil
}

c.ReportAccount(automod.ReportReasonOther, fmt.Sprintf("trivial spam account (also labeled; remove label if this isn't spam!)"))
c.AddAccountLabel("!hide")
c.Notify("slack")
return nil
}
10 changes: 8 additions & 2 deletions automod/rules/replies.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func ReplyCountPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error
// var identicalReplyLimit = 6
// TODO: bumping temporarily
var identicalReplyLimit = 20
var identicalReplyActionLimit = 75

var _ automod.PostRuleFunc = IdenticalReplyPostRule

Expand Down Expand Up @@ -71,7 +72,12 @@ func IdenticalReplyPostRule(c *automod.RecordContext, post *appbsky.FeedPost) er
count := c.GetCount("reply-text", bucket, period)
if count >= identicalReplyLimit {
c.AddAccountFlag("multi-identical-reply")
c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (new account, %d identical reply-posts today)", count))
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible spam (new account, %d identical reply-posts today)", count))
c.Notify("slack")
}
if count >= identicalReplyActionLimit && utf8.RuneCountInString(post.Text) > 100 {
c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("likely spam/harassment (new account, %d identical reply-posts today), actioned (remove label urgently if account is ok)", count))
c.AddAccountLabel("!warn")
c.Notify("slack")
}

Expand All @@ -80,7 +86,7 @@ func IdenticalReplyPostRule(c *automod.RecordContext, post *appbsky.FeedPost) er

// TODO: bumping temporarily
// var youngReplyAccountLimit = 12
var youngReplyAccountLimit = 30
var youngReplyAccountLimit = 200
var _ automod.PostRuleFunc = YoungAccountDistinctRepliesRule

func YoungAccountDistinctRepliesRule(c *automod.RecordContext, post *appbsky.FeedPost) error {
Expand Down
Loading