Skip to content

Implement anti-spam measures and improve content handling#559

Merged
asim merged 2 commits intomainfrom
claude/add-wallet-transfers-74PHC
Apr 15, 2026
Merged

Implement anti-spam measures and improve content handling#559
asim merged 2 commits intomainfrom
claude/add-wallet-transfers-74PHC

Conversation

@asim
Copy link
Copy Markdown
Member

@asim asim commented Apr 15, 2026

No description provided.

claude added 2 commits April 15, 2026 04:09
Inline image/audio/video parts (Content-Disposition not 'attachment')
were falling through to the 'Unknown part type' branch and being
appended to the body as raw bytes — visible as [image/jpeg] followed
by binary garbage after the text content. Treat them as attachments
instead, and skip non-utf8 unknown parts entirely.
Background: free credits and missing payment gates made it cheap for an
attacker to create accounts and have agents flood the platform with
status updates, replies, comments, and AI-generated apps. This adds
several layers of defence:

Anti-spam pricing — every content-creating action now costs credits,
making spam economically expensive (1p per status update, reply, and
blog comment).

Web AI generation — /apps/build/generate and the framework variant now
charge CostAppBuild / CostAppEdit. Previously these endpoints called the
LLM with no quota check, mirroring the MCP apps_build tool's behaviour.

Signup rate limiting — at most 3 signups per IP per 24 hours by default
(SIGNUP_MAX_PER_IP, SIGNUP_WINDOW_HOURS). Applied to both the web
/signup form and the MCP signup tool via a new api.ToolGuard hook.
Localhost is exempt for self-hosters and dev.

System auto-flag now hides immediately — flag.CheckContent was calling
Add() (which only flags after 3 user reports), so LLM-detected spam
stayed visible. Now it calls AdminFlag() to hide the content on the
first system flag.

Comment moderation — blog comments now go through flag.CheckContent and
are hidden from non-admin viewers when flagged. CreateComment now
returns the comment so the moderator gets the right ID.

CanPost on comments — new accounts must wait 30 minutes before
commenting, matching the existing rule for blog posts and threads.
@asim asim merged commit 4beeda0 into main Apr 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants