PDS Admin tool make it easier to moderate your PDS with labels
at main 86 lines 5.4 kB view raw view rendered
1# Label Watcher - PDS Moderation powered by labelers 2 3Subscribes to multiple labelers that you set in your [settings.toml](settings.toml.example) along with which labels you would like to watch for. If it sees the label is applied to a user on one of the PDSs you configure it will take an action. Either notify you by email (and/or webhook), or does an auto takedown of the account. 4 5The idea is we have some awesome labelers like [Blacksky's labeler](https://bsky.app/profile/moderation.blacksky.app), [Hailey's Labeler](https://bsky.app/profile/did:plc:saslbwamakedc4h6c5bmshvz), and [skywatch.blue](https://bsky.app/profile/skywatch.blue) that are doing an amazing job of moderating already, but we do not have a way as PDS admins to be able to use these labels in an easy way. The hope is that this gives an easy way to use these resources to help moderate your PDS. Pick your labelers to subscribe to and which labels from it you would like to to watch for. Then set an action like notify to get an email when a label is applied to an account on your PDS, or can even do an auto takedown of the account(beta and recommend trying the notify action first to get a hang of what accounts gets the label you expect). 6 7I think it will be great for PDSs that also run their own labeler to be able to issue a label for takedowns allowing moderates of an org to have the ability to remotely do takedowns with out the need of the PDS admin password. Should also work at catching bot accounts since the labelers have gotten very good at it 8 9 10 11# Setup 12Got some configs to setup. We use toml to config the PDSs and labelers. There is an example one at [settings.toml.example](./settings.toml.example). Here you can set 13- PDSs settings 14 - Can set the watch for multiple PDSs 15 - An array of email addresses to send the notifications to 16 - An optional webhook URL to send notifications to 17 - On startup should it query your PDS to find all the active accounts and add them to the watch list 18 - Should it subscribe to your PDS to auto pick up new accounts (cursor resume does not work for this since the startup backfill can usually handle most backfills) 19 - Admin password. __This is the keys to your PDS so please use this with caution. label watcher does not require this__. But it is needed for auto takedowns. 20- Which labelers and labels 21 - Can set multiple labelers 22 - Backfill (should mostly be supported in my test and does take a while to run) 23 - Which labels and which action to take when it is seen. Can set as many as you want, make sure to match it to the labeler key. 24 25Also have a .env for some shared secrets at [.env.example](.env.example). This sets up 26 27- How to email the notifications. Either via Resend's API or a smtp url like the PDS supports 28- Email address the email comes from 29- database location 30- migrations folder 31- logs level 32 33 34Can use pnpm or npm and run with 35```bash 36pnpm i 37pnpm run start 38``` 39or can use the docker compose file with. This will build and run label-watcher as a docker container. No release image yet. 40```bash 41docker compose up 42``` 43 44# How do I find the labeler info? 451. Find a labeler you like. Like [@skywatch.blue](https://bsky.app/profile/skywatch.blue) 462. Resolve it's did doc or use one of the atproto browsers to get the `atproto_labeler` service endpoint. sky watches is `https://ozone.skywatch.blue/` so `ozone.skywatch.blue` is the host 473. Each labeler has a record at `app.bsky.labeler.service` with a rkey of self. Like [here](https://blewit.us-west.host.bsky.network/xrpc/com.atproto.repo.getRecord?repo=did:plc:e4elbtctnfqocyfcml6h2lf7&collection=app.bsky.labeler.service&rkey=self). 484. The label values are found under policies -> labelValues. We are going to use `bluesky-elder` as an example and set an action of `notify`. 49 50Put it all together it looks like this 51```toml 52# Define the labeler 53[labeler.skywatch] 54host = "ozone.skywatch.blue" 55# Set if you want to replay labels. Takes a minute, or a few... 56# backfillLabels = true 57 58# Notifies if an account has the bluesky-elder label applied 59[labeler.skywatch.labels.bluesky-elder] 60label_name = "bluesky-elder" 61action = "notify" 62 63#Repeat the last one for as many labels as you want 64``` 65 66 67# Features 68 69## PDS 70- Can backfill and get all active accounts on start up 71- Can listen to the PDSs firehose to add new identities as they are created on the PDS 72- Does not keep a cursor of the firehose during reboots since it can backfill on start up 73- Can set a list of emails to send notifications to of actions taken 74- Works for multiple PDSs configured in the settings.toml 75 76## Labeler 77- Can subscribe to labels from a labeler. Multiple of each set up in the settings.toml 78- Does support backfilling of labels via the cursor on restart so you do not miss any 79- Should support full backfill if set 80- Can give each label an action like notify or takedown. It will take the action and send you an email 81- Auto takedowns are still new and should expect possible bugs. Takedowns have been reservable in my experience, but I highly recommend to start with notify first and do manual takedowns when needed while you find what labels work. 82- During auto takedowns if a label is negated(reversed) the takedown is also reversed 83 84 85# Future features? 86Not sure. Playing around with making a UI possibly, maybe even a multi instance that others can sign up for and not have to host?