finish adding an initial draft of the nollamas security check

This commit is contained in:
kim 2025-04-22 19:26:41 +01:00
commit 86e342c443
4 changed files with 64 additions and 128 deletions

View file

@ -499,6 +499,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
s2sLimit := middleware.RateLimit(rlLimit, exceptions) // server-to-server (AP)
fsMainLimit := middleware.RateLimit(rlLimit, exceptions) // fileserver / web templates
fsEmojiLimit := middleware.RateLimit(rlLimit*2, exceptions) // fileserver (emojis only, use high limit)
nollamas := middleware.NoLLaMas(state.DB)
// throttling
cpuMultiplier := config.GetAdvancedThrottlingMultiplier()
@ -544,7 +545,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
nodeInfoModule.Route(route, s2sLimit, s2sThrottle, gzip)
activityPubModule.Route(route, s2sLimit, s2sThrottle, robotsDisallowAll, gzip)
activityPubModule.RoutePublicKey(route, s2sLimit, pkThrottle, robotsDisallowAll, gzip)
webModule.Route(route, fsMainLimit, fsThrottle, robotsDisallowAIOnly, gzip)
webModule.Route(route, fsMainLimit, fsThrottle, robotsDisallowAIOnly, nollamas, gzip)
// Finally start the main http server!
if err := route.Start(); err != nil {

View file

@ -257,6 +257,8 @@ var Start action.GTSAction = func(ctx context.Context) error {
nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint
activityPubModule = api.NewActivityPub(state.DB, processor) // ActivityPub endpoints
webModule = web.New(state.DB, processor) // web pages + user profiles + settings panels etc
nollamas = middleware.NoLLaMas(state.DB)
)
// these should be routed in order
@ -271,7 +273,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
nodeInfoModule.Route(route)
activityPubModule.Route(route)
activityPubModule.RoutePublicKey(route)
webModule.Route(route)
webModule.Route(route, nollamas)
// Create background cleaner.
cleaner := cleaner.New(state)