rCTF Docs
Overview

Moderation providers

Configure avatar content moderation with OpenAI's moderation API.

Moderation providers check uploaded avatar images for inappropriate content. It’s optional, and without a moderation provider, every avatar gets accepted.

Configuration#

avatarsModeration:
provider:
name: moderation/openai
options:
apiKey: sk-...
allowOnInternalError: true
FieldTypeDefaultDescription
avatarsModeration.providerobject-Moderation provider configuration
avatarsModeration.allowOnInternalErrorbooleantrueWhether to allow avatar uploads when the moderation API fails
Tip

Setting allowOnInternalError to true (the default) means a temporary OpenAI API outage doesn’t block avatar uploads. Set it to false if you need strict moderation.

Providers#

moderation/openai#

Uses OpenAI’s moderation API to check avatar images for policy violations.

avatarsModeration:
provider:
name: moderation/openai
options:
apiKey: sk-...
model: omni-moderation-latest # Optional
OptionEnvironment VariableDefaultDescription
apiKeyRCTF_MODERATION_OPENAI_API_KEY or OPENAI_API_KEY-OpenAI API key
modelRCTF_MODERATION_OPENAI_MODELomni-moderation-latestOpenAI moderation model

The provider sends the avatar image (resized to 256x256 WebP) to the OpenAI moderation endpoint. If the image gets flagged as inappropriate, the upload is rejected with an error.

Moderation pipeline#

When a user uploads an avatar, the pipeline runs in this order:

  1. Check the image against maxAvatarSize (default 1 MB).
  2. Resize to 256x256 pixels and convert to WebP.
  3. If a moderation provider is configured, run the image through it.
  4. If approved (or no provider configured), hand the image to the upload provider.
  5. Delete the previous avatar, if any.
Esc

Start typing to search the docs.