@atproto/ozone 0.1.154 → 0.1.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/api/moderation/emitEvent.d.ts.map +1 -1
- package/dist/api/moderation/emitEvent.js +2 -1
- package/dist/api/moderation/emitEvent.js.map +1 -1
- package/dist/daemon/materialized-view-refresher.d.ts.map +1 -1
- package/dist/daemon/materialized-view-refresher.js +0 -1
- package/dist/daemon/materialized-view-refresher.js.map +1 -1
- package/package.json +2 -2
- package/src/api/moderation/emitEvent.ts +3 -1
- package/src/daemon/materialized-view-refresher.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atproto/ozone
|
|
2
2
|
|
|
3
|
+
## 0.1.155
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4330](https://github.com/bluesky-social/atproto/pull/4330) [`3628cebfb`](https://github.com/bluesky-social/atproto/commit/3628cebfbb04ba49f326bbf411a2d15de2900302) Thanks [@mistydemeo](https://github.com/mistydemeo)! - adjust explicit-slurs regex
|
|
8
|
+
|
|
9
|
+
- [#4335](https://github.com/bluesky-social/atproto/pull/4335) [`82e75bf6c`](https://github.com/bluesky-social/atproto/commit/82e75bf6c1b31daa834386edce35c8aa4c787229) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove non-existing `reporter_stats` from materliaziled view to refresh
|
|
10
|
+
|
|
3
11
|
## 0.1.154
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitEvent.d.ts","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"emitEvent.d.ts","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AA4RtC,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAqCvD"}
|
|
@@ -69,7 +69,8 @@ const handleModerationEvent = async ({ ctx, input, auth, }) => {
|
|
|
69
69
|
...(event.negateLabelVals ?? []),
|
|
70
70
|
]);
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
const isTakedownOrReverseTakedownEvent = isTakedownEvent || isReverseTakedownEvent;
|
|
73
|
+
if (isTakedownOrReverseTakedownEvent || isLabelEvent) {
|
|
73
74
|
const status = await moderationService.getStatus(subject);
|
|
74
75
|
if (status?.takendown && isTakedownEvent) {
|
|
75
76
|
throw new xrpc_server_1.InvalidRequestError(`Subject is already taken down`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitEvent.js","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":";;AA8RA,4BAqCC;AAnUD,qFAA6F;AAC7F,sDAA6E;AAI7E,qDAA4C;AAC5C,0EAcwD;AAExD,uDAA4D;AAE5D,mDAA8C;AAC9C,iDAAwD;AACxD,qCAAsC;AACtC,kCAAsC;AACtC,iCAAmE;AAEnE,MAAM,qBAAqB,GAAG,KAAK,EAAE,EACnC,GAAG,EACH,KAAK,EACL,IAAI,GAKL,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;IAC/B,MAAM,SAAS,GACb,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,WAAW;QACnC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG;QACtB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAA;IAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,EA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AC,kBAAkB,KAAK,EAAE,CAAC,CAAA;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA","sourcesContent":["import { isModEventDivert } from '@atproto/api/dist/client/types/tools/ozone/moderation/defs'\nimport { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'\nimport { AdminTokenOutput, ModeratorOutput } from '../../auth-verifier'\nimport { AppContext } from '../../context'\nimport { Server } from '../../lexicon'\nimport { ids } from '../../lexicon/lexicons'\nimport {\n ModEventTag,\n isAgeAssuranceEvent,\n isAgeAssuranceOverrideEvent,\n isModEventAcknowledge,\n isModEventEmail,\n isModEventLabel,\n isModEventMuteReporter,\n isModEventReport,\n isModEventReverseTakedown,\n isModEventTag,\n isModEventTakedown,\n isModEventUnmuteReporter,\n isRevokeAccountCredentialsEvent,\n} from '../../lexicon/types/tools/ozone/moderation/defs'\nimport { HandlerInput } from '../../lexicon/types/tools/ozone/moderation/emitEvent'\nimport { subjectFromInput } from '../../mod-service/subject'\nimport { SettingService } from '../../setting/service'\nimport { TagService } from '../../tag-service'\nimport { getTagForReport } from '../../tag-service/util'\nimport { retryHttp } from '../../util'\nimport { getEventType } from '../util'\nimport { assertProtectedTagAction, getProtectedTags } from './util'\n\nconst handleModerationEvent = async ({\n ctx,\n input,\n auth,\n}: {\n ctx: AppContext\n input: HandlerInput\n auth: ModeratorOutput | AdminTokenOutput\n}) => {\n const access = auth.credentials\n const createdBy =\n auth.credentials.type === 'moderator'\n ? auth.credentials.iss\n : input.body.createdBy\n const db = ctx.db\n const moderationService = ctx.modService(db)\n const settingService = ctx.settingService(db)\n const { event, externalId } = input.body\n const isAcknowledgeEvent = isModEventAcknowledge(event)\n const isTakedownEvent = isModEventTakedown(event)\n const isReverseTakedownEvent = isModEventReverseTakedown(event)\n const isLabelEvent = isModEventLabel(event)\n const subject = subjectFromInput(\n input.body.subject,\n input.body.subjectBlobCids,\n )\n\n if (isAgeAssuranceEvent(event) && !subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (isAgeAssuranceOverrideEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n if (!auth.credentials.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to override age assurance',\n )\n }\n }\n\n if (isRevokeAccountCredentialsEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (!auth.credentials.isAdmin) {\n throw new AuthRequiredError(\n 'Must be an admin to revoke account credentials',\n )\n }\n\n if (!ctx.pdsAgent) {\n throw new InvalidRequestError('PDS not configured')\n }\n\n await ctx.pdsAgent.com.atproto.temp.revokeAccountCredentials(\n { account: subject.did },\n await ctx.pdsAuth(ids.ComAtprotoTempRevokeAccountCredentials),\n )\n }\n\n // if less than moderator access then can only take ack and escalation actions\n if (isTakedownEvent || isReverseTakedownEvent) {\n if (!access.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to take this type of action',\n )\n }\n\n // Non admins should not be able to take down feed generators\n if (\n !access.isAdmin &&\n subject.recordPath?.includes('app.bsky.feed.generator/')\n ) {\n throw new AuthRequiredError(\n 'Must be a full admin to take this type of action on feed generators',\n )\n }\n }\n // if less than moderator access then can not apply labels\n if (!access.isModerator && isLabelEvent) {\n throw new AuthRequiredError('Must be a full moderator to label content')\n }\n\n if (isLabelEvent) {\n validateLabels([\n ...(event.createLabelVals ?? []),\n ...(event.negateLabelVals ?? []),\n ])\n }\n\n if (isTakedownEvent || isReverseTakedownEvent) {\n const status = await moderationService.getStatus(subject)\n\n if (status?.takendown && isTakedownEvent) {\n throw new InvalidRequestError(`Subject is already taken down`)\n }\n\n if (!status?.takendown && isReverseTakedownEvent) {\n throw new InvalidRequestError(`Subject is not taken down`)\n }\n\n if (status?.tags?.length) {\n const protectedTags = await getProtectedTags(\n settingService,\n ctx.cfg.service.did,\n )\n\n if (protectedTags) {\n assertProtectedTagAction({\n protectedTags,\n subjectTags: status.tags,\n actionAuthor: createdBy,\n isAdmin: auth.credentials.isAdmin,\n isModerator: auth.credentials.isModerator,\n isTriage: auth.credentials.isTriage,\n })\n }\n }\n\n if (status?.takendown && isReverseTakedownEvent && subject.isRecord()) {\n // due to the way blob status is modeled, we should reverse takedown on all\n // blobs for the record being restored, which aren't taken down on another record.\n subject.blobCids = status.blobCids ?? []\n }\n }\n\n if (isModEventEmail(event) && event.content) {\n // sending email prior to logging the event to avoid a long transaction below\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Email can only be sent to a repo subject')\n }\n const { content, subjectLine } = event\n await retryHttp(() =>\n ctx.modService(db).sendEmail({\n subject: subjectLine,\n content,\n recipientDid: subject.did,\n }),\n )\n }\n\n if (isModEventDivert(event) && subject.isRecord()) {\n if (!ctx.blobDiverter) {\n throw new InvalidRequestError(\n 'BlobDiverter not configured for this service',\n )\n }\n await ctx.blobDiverter.uploadBlobOnService(subject.info())\n }\n\n if (\n (isModEventMuteReporter(event) || isModEventUnmuteReporter(event)) &&\n !subject.isRepo()\n ) {\n throw new InvalidRequestError('Subject must be a repo when muting reporter')\n }\n\n if (isModEventTag(event)) {\n await assertTagAuth(settingService, ctx.cfg.service.did, event, auth)\n }\n\n if (isModEventReport(event)) {\n await ctx.moderationServiceProfile().validateReasonType(event.reportType)\n }\n\n const moderationEvent = await db.transaction(async (dbTxn) => {\n const moderationTxn = ctx.modService(dbTxn)\n\n if (externalId) {\n const existingEvent = await moderationTxn.getEventByExternalId(\n getEventType(event.$type),\n externalId,\n subject,\n )\n\n if (existingEvent) {\n throw new InvalidRequestError(\n `An event with the same external ID already exists for the subject.`,\n 'DuplicateExternalId',\n )\n }\n }\n\n const result = await moderationTxn.logEvent({\n event,\n subject,\n createdBy,\n modTool: input.body.modTool,\n externalId,\n })\n\n const tagService = new TagService(\n subject,\n result.subjectStatus,\n ctx.cfg.service.did,\n moderationTxn,\n )\n\n const initialTags = isModEventReport(event)\n ? [getTagForReport(event.reportType)]\n : undefined\n await tagService.evaluateForSubject(initialTags)\n\n if (subject.isRepo()) {\n if (isTakedownEvent) {\n const isSuspend = !!result.event.durationInHours\n await moderationTxn.takedownRepo(subject, result.event.id, isSuspend)\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRepo(subject)\n }\n }\n\n if (subject.isRecord()) {\n if (isTakedownEvent) {\n await moderationTxn.takedownRecord(subject, result.event.id)\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRecord(subject)\n }\n }\n\n if (\n (isTakedownEvent || isAcknowledgeEvent) &&\n result.event.meta?.acknowledgeAccountSubjects\n ) {\n await moderationTxn.resolveSubjectsForAccount(\n subject.did,\n createdBy,\n result.event,\n )\n }\n\n if (isLabelEvent) {\n await moderationTxn.formatAndCreateLabels(\n result.event.subjectUri ?? result.event.subjectDid,\n result.event.subjectCid,\n {\n create: result.event.createLabelVals?.length\n ? result.event.createLabelVals.split(' ')\n : undefined,\n negate: result.event.negateLabelVals?.length\n ? result.event.negateLabelVals.split(' ')\n : undefined,\n },\n result.event.durationInHours ?? undefined,\n )\n }\n\n return result.event\n })\n\n return moderationService.views.formatEvent(moderationEvent)\n}\n\nexport default function (server: Server, ctx: AppContext) {\n server.tools.ozone.moderation.emitEvent({\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const moderationEvent = await handleModerationEvent({\n input,\n auth,\n ctx,\n })\n\n // On divert events, we need to automatically take down the blobs\n if (isModEventDivert(input.body.event)) {\n await handleModerationEvent({\n auth,\n ctx,\n input: {\n ...input,\n body: {\n ...input.body,\n event: {\n ...input.body.event,\n $type: 'tools.ozone.moderation.defs#modEventTakedown',\n comment:\n '[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',\n },\n modTool: input.body.modTool,\n },\n },\n })\n }\n\n return {\n encoding: 'application/json',\n body: moderationEvent,\n }\n },\n })\n}\n\nconst assertTagAuth = async (\n settingService: SettingService,\n serviceDid: string,\n event: ModEventTag,\n auth: ModeratorOutput | AdminTokenOutput,\n) => {\n // admins can add/remove any tag\n if (auth.credentials.isAdmin) return\n\n const protectedTags = await getProtectedTags(settingService, serviceDid)\n\n if (!protectedTags) {\n return\n }\n\n for (const tag of Object.keys(protectedTags)) {\n if (event.add.includes(tag) || event.remove.includes(tag)) {\n // if specific moderators are configured to manage this tag but the current user\n // is not one of them, then throw an error\n const configuredModerators = protectedTags[tag]?.['moderators']\n if (\n configuredModerators &&\n !configuredModerators.includes(auth.credentials.iss)\n ) {\n throw new InvalidRequestError(`Not allowed to manage tag: ${tag}`)\n }\n\n const configuredRoles = protectedTags[tag]?.['roles']\n if (configuredRoles) {\n // admins can already do everything so we only check for moderator and triage role config\n if (\n auth.credentials.isModerator &&\n !configuredRoles.includes('tools.ozone.team.defs#roleModerator')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with moderator role`,\n )\n } else if (\n auth.credentials.isTriage &&\n !configuredRoles.includes('tools.ozone.team.defs#roleTriage')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with triage role`,\n )\n }\n }\n }\n }\n}\n\nconst validateLabels = (labels: string[]) => {\n for (const label of labels) {\n for (const char of badChars) {\n if (label.includes(char)) {\n throw new InvalidRequestError(`Invalid label: ${label}`)\n }\n }\n }\n}\n\nconst badChars = [' ', ',', ';', `'`, `\"`]\n"]}
|
|
1
|
+
{"version":3,"file":"emitEvent.js","sourceRoot":"","sources":["../../../src/api/moderation/emitEvent.ts"],"names":[],"mappings":";;AAgSA,4BAqCC;AArUD,qFAA6F;AAC7F,sDAA6E;AAI7E,qDAA4C;AAC5C,0EAcwD;AAExD,uDAA4D;AAE5D,mDAA8C;AAC9C,iDAAwD;AACxD,qCAAsC;AACtC,kCAAsC;AACtC,iCAAmE;AAEnE,MAAM,qBAAqB,GAAG,KAAK,EAAE,EACnC,GAAG,EACH,KAAK,EACL,IAAI,GAKL,EAAE,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AC7C,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,MAAgB,EAAE,EAAE;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,iCAAmB,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAA;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA","sourcesContent":["import { isModEventDivert } from '@atproto/api/dist/client/types/tools/ozone/moderation/defs'\nimport { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'\nimport { AdminTokenOutput, ModeratorOutput } from '../../auth-verifier'\nimport { AppContext } from '../../context'\nimport { Server } from '../../lexicon'\nimport { ids } from '../../lexicon/lexicons'\nimport {\n ModEventTag,\n isAgeAssuranceEvent,\n isAgeAssuranceOverrideEvent,\n isModEventAcknowledge,\n isModEventEmail,\n isModEventLabel,\n isModEventMuteReporter,\n isModEventReport,\n isModEventReverseTakedown,\n isModEventTag,\n isModEventTakedown,\n isModEventUnmuteReporter,\n isRevokeAccountCredentialsEvent,\n} from '../../lexicon/types/tools/ozone/moderation/defs'\nimport { HandlerInput } from '../../lexicon/types/tools/ozone/moderation/emitEvent'\nimport { subjectFromInput } from '../../mod-service/subject'\nimport { SettingService } from '../../setting/service'\nimport { TagService } from '../../tag-service'\nimport { getTagForReport } from '../../tag-service/util'\nimport { retryHttp } from '../../util'\nimport { getEventType } from '../util'\nimport { assertProtectedTagAction, getProtectedTags } from './util'\n\nconst handleModerationEvent = async ({\n ctx,\n input,\n auth,\n}: {\n ctx: AppContext\n input: HandlerInput\n auth: ModeratorOutput | AdminTokenOutput\n}) => {\n const access = auth.credentials\n const createdBy =\n auth.credentials.type === 'moderator'\n ? auth.credentials.iss\n : input.body.createdBy\n const db = ctx.db\n const moderationService = ctx.modService(db)\n const settingService = ctx.settingService(db)\n const { event, externalId } = input.body\n const isAcknowledgeEvent = isModEventAcknowledge(event)\n const isTakedownEvent = isModEventTakedown(event)\n const isReverseTakedownEvent = isModEventReverseTakedown(event)\n const isLabelEvent = isModEventLabel(event)\n const subject = subjectFromInput(\n input.body.subject,\n input.body.subjectBlobCids,\n )\n\n if (isAgeAssuranceEvent(event) && !subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (isAgeAssuranceOverrideEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n if (!auth.credentials.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to override age assurance',\n )\n }\n }\n\n if (isRevokeAccountCredentialsEvent(event)) {\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Invalid subject type')\n }\n\n if (!auth.credentials.isAdmin) {\n throw new AuthRequiredError(\n 'Must be an admin to revoke account credentials',\n )\n }\n\n if (!ctx.pdsAgent) {\n throw new InvalidRequestError('PDS not configured')\n }\n\n await ctx.pdsAgent.com.atproto.temp.revokeAccountCredentials(\n { account: subject.did },\n await ctx.pdsAuth(ids.ComAtprotoTempRevokeAccountCredentials),\n )\n }\n\n // if less than moderator access then can only take ack and escalation actions\n if (isTakedownEvent || isReverseTakedownEvent) {\n if (!access.isModerator) {\n throw new AuthRequiredError(\n 'Must be a full moderator to take this type of action',\n )\n }\n\n // Non admins should not be able to take down feed generators\n if (\n !access.isAdmin &&\n subject.recordPath?.includes('app.bsky.feed.generator/')\n ) {\n throw new AuthRequiredError(\n 'Must be a full admin to take this type of action on feed generators',\n )\n }\n }\n // if less than moderator access then can not apply labels\n if (!access.isModerator && isLabelEvent) {\n throw new AuthRequiredError('Must be a full moderator to label content')\n }\n\n if (isLabelEvent) {\n validateLabels([\n ...(event.createLabelVals ?? []),\n ...(event.negateLabelVals ?? []),\n ])\n }\n\n const isTakedownOrReverseTakedownEvent =\n isTakedownEvent || isReverseTakedownEvent\n if (isTakedownOrReverseTakedownEvent || isLabelEvent) {\n const status = await moderationService.getStatus(subject)\n\n if (status?.takendown && isTakedownEvent) {\n throw new InvalidRequestError(`Subject is already taken down`)\n }\n\n if (!status?.takendown && isReverseTakedownEvent) {\n throw new InvalidRequestError(`Subject is not taken down`)\n }\n\n if (status?.tags?.length) {\n const protectedTags = await getProtectedTags(\n settingService,\n ctx.cfg.service.did,\n )\n\n if (protectedTags) {\n assertProtectedTagAction({\n protectedTags,\n subjectTags: status.tags,\n actionAuthor: createdBy,\n isAdmin: auth.credentials.isAdmin,\n isModerator: auth.credentials.isModerator,\n isTriage: auth.credentials.isTriage,\n })\n }\n }\n\n if (status?.takendown && isReverseTakedownEvent && subject.isRecord()) {\n // due to the way blob status is modeled, we should reverse takedown on all\n // blobs for the record being restored, which aren't taken down on another record.\n subject.blobCids = status.blobCids ?? []\n }\n }\n\n if (isModEventEmail(event) && event.content) {\n // sending email prior to logging the event to avoid a long transaction below\n if (!subject.isRepo()) {\n throw new InvalidRequestError('Email can only be sent to a repo subject')\n }\n const { content, subjectLine } = event\n await retryHttp(() =>\n ctx.modService(db).sendEmail({\n subject: subjectLine,\n content,\n recipientDid: subject.did,\n }),\n )\n }\n\n if (isModEventDivert(event) && subject.isRecord()) {\n if (!ctx.blobDiverter) {\n throw new InvalidRequestError(\n 'BlobDiverter not configured for this service',\n )\n }\n await ctx.blobDiverter.uploadBlobOnService(subject.info())\n }\n\n if (\n (isModEventMuteReporter(event) || isModEventUnmuteReporter(event)) &&\n !subject.isRepo()\n ) {\n throw new InvalidRequestError('Subject must be a repo when muting reporter')\n }\n\n if (isModEventTag(event)) {\n await assertTagAuth(settingService, ctx.cfg.service.did, event, auth)\n }\n\n if (isModEventReport(event)) {\n await ctx.moderationServiceProfile().validateReasonType(event.reportType)\n }\n\n const moderationEvent = await db.transaction(async (dbTxn) => {\n const moderationTxn = ctx.modService(dbTxn)\n\n if (externalId) {\n const existingEvent = await moderationTxn.getEventByExternalId(\n getEventType(event.$type),\n externalId,\n subject,\n )\n\n if (existingEvent) {\n throw new InvalidRequestError(\n `An event with the same external ID already exists for the subject.`,\n 'DuplicateExternalId',\n )\n }\n }\n\n const result = await moderationTxn.logEvent({\n event,\n subject,\n createdBy,\n modTool: input.body.modTool,\n externalId,\n })\n\n const tagService = new TagService(\n subject,\n result.subjectStatus,\n ctx.cfg.service.did,\n moderationTxn,\n )\n\n const initialTags = isModEventReport(event)\n ? [getTagForReport(event.reportType)]\n : undefined\n await tagService.evaluateForSubject(initialTags)\n\n if (subject.isRepo()) {\n if (isTakedownEvent) {\n const isSuspend = !!result.event.durationInHours\n await moderationTxn.takedownRepo(subject, result.event.id, isSuspend)\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRepo(subject)\n }\n }\n\n if (subject.isRecord()) {\n if (isTakedownEvent) {\n await moderationTxn.takedownRecord(subject, result.event.id)\n } else if (isReverseTakedownEvent) {\n await moderationTxn.reverseTakedownRecord(subject)\n }\n }\n\n if (\n (isTakedownEvent || isAcknowledgeEvent) &&\n result.event.meta?.acknowledgeAccountSubjects\n ) {\n await moderationTxn.resolveSubjectsForAccount(\n subject.did,\n createdBy,\n result.event,\n )\n }\n\n if (isLabelEvent) {\n await moderationTxn.formatAndCreateLabels(\n result.event.subjectUri ?? result.event.subjectDid,\n result.event.subjectCid,\n {\n create: result.event.createLabelVals?.length\n ? result.event.createLabelVals.split(' ')\n : undefined,\n negate: result.event.negateLabelVals?.length\n ? result.event.negateLabelVals.split(' ')\n : undefined,\n },\n result.event.durationInHours ?? undefined,\n )\n }\n\n return result.event\n })\n\n return moderationService.views.formatEvent(moderationEvent)\n}\n\nexport default function (server: Server, ctx: AppContext) {\n server.tools.ozone.moderation.emitEvent({\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const moderationEvent = await handleModerationEvent({\n input,\n auth,\n ctx,\n })\n\n // On divert events, we need to automatically take down the blobs\n if (isModEventDivert(input.body.event)) {\n await handleModerationEvent({\n auth,\n ctx,\n input: {\n ...input,\n body: {\n ...input.body,\n event: {\n ...input.body.event,\n $type: 'tools.ozone.moderation.defs#modEventTakedown',\n comment:\n '[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',\n },\n modTool: input.body.modTool,\n },\n },\n })\n }\n\n return {\n encoding: 'application/json',\n body: moderationEvent,\n }\n },\n })\n}\n\nconst assertTagAuth = async (\n settingService: SettingService,\n serviceDid: string,\n event: ModEventTag,\n auth: ModeratorOutput | AdminTokenOutput,\n) => {\n // admins can add/remove any tag\n if (auth.credentials.isAdmin) return\n\n const protectedTags = await getProtectedTags(settingService, serviceDid)\n\n if (!protectedTags) {\n return\n }\n\n for (const tag of Object.keys(protectedTags)) {\n if (event.add.includes(tag) || event.remove.includes(tag)) {\n // if specific moderators are configured to manage this tag but the current user\n // is not one of them, then throw an error\n const configuredModerators = protectedTags[tag]?.['moderators']\n if (\n configuredModerators &&\n !configuredModerators.includes(auth.credentials.iss)\n ) {\n throw new InvalidRequestError(`Not allowed to manage tag: ${tag}`)\n }\n\n const configuredRoles = protectedTags[tag]?.['roles']\n if (configuredRoles) {\n // admins can already do everything so we only check for moderator and triage role config\n if (\n auth.credentials.isModerator &&\n !configuredRoles.includes('tools.ozone.team.defs#roleModerator')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with moderator role`,\n )\n } else if (\n auth.credentials.isTriage &&\n !configuredRoles.includes('tools.ozone.team.defs#roleTriage')\n ) {\n throw new InvalidRequestError(\n `Can not manage tag ${tag} with triage role`,\n )\n }\n }\n }\n }\n}\n\nconst validateLabels = (labels: string[]) => {\n for (const label of labels) {\n for (const char of badChars) {\n if (label.includes(char)) {\n throw new InvalidRequestError(`Invalid label: ${label}`)\n }\n }\n }\n}\n\nconst badChars = [' ', ',', ';', `'`, `\"`]\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materialized-view-refresher.d.ts","sourceRoot":"","sources":["../../src/daemon/materialized-view-refresher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEvE,qBAAa,yBAA0B,SAAQ,sBAAsB;gBACvD,eAAe,EAAE,eAAe,EAAE,QAAQ,SAAc;
|
|
1
|
+
{"version":3,"file":"materialized-view-refresher.d.ts","sourceRoot":"","sources":["../../src/daemon/materialized-view-refresher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEvE,qBAAa,yBAA0B,SAAQ,sBAAsB;gBACvD,eAAe,EAAE,eAAe,EAAE,QAAQ,SAAc;CAqBrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materialized-view-refresher.js","sourceRoot":"","sources":["../../src/daemon/materialized-view-refresher.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,4CAAwC;AACxC,8CAAuE;AAEvE,MAAa,yBAA0B,SAAQ,mCAAsB;IACnE,YAAY,eAAgC,EAAE,QAAQ,GAAG,EAAE,GAAG,eAAM;QAClE,KAAK,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;YACxD,KAAK,MAAM,IAAI,IAAI;gBACjB,sBAAsB;gBACtB,qBAAqB;gBACrB,6BAA6B;gBAC7B,6BAA6B;
|
|
1
|
+
{"version":3,"file":"materialized-view-refresher.js","sourceRoot":"","sources":["../../src/daemon/materialized-view-refresher.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,4CAAwC;AACxC,8CAAuE;AAEvE,MAAa,yBAA0B,SAAQ,mCAAsB;IACnE,YAAY,eAAgC,EAAE,QAAQ,GAAG,EAAE,GAAG,eAAM;QAClE,KAAK,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;YACxD,KAAK,MAAM,IAAI,IAAI;gBACjB,sBAAsB;gBACtB,qBAAqB;gBACrB,6BAA6B;gBAC7B,6BAA6B;aAC9B,EAAE,CAAC;gBACF,IAAI,MAAM,CAAC,OAAO;oBAAE,MAAK;gBAEzB,sEAAsE;gBACtE,uEAAuE;gBACvE,qEAAqE;gBACrE,qEAAqE;gBACrE,kBAAkB;gBAClB,MAAM,IAAA,YAAG,EAAA,0CAA0C,YAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CACvE,EAAE,CACH,CAAA;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtBD,8DAsBC","sourcesContent":["import { sql } from 'kysely'\nimport { MINUTE } from '@atproto/common'\nimport { BackgroundQueue, PeriodicBackgroundTask } from '../background'\n\nexport class MaterializedViewRefresher extends PeriodicBackgroundTask {\n constructor(backgroundQueue: BackgroundQueue, interval = 30 * MINUTE) {\n super(backgroundQueue, interval, async ({ db }, signal) => {\n for (const view of [\n 'account_events_stats',\n 'record_events_stats',\n 'account_record_events_stats',\n 'account_record_status_stats',\n ]) {\n if (signal.aborted) break\n\n // Kysely does not provide a way to cancel a running query. Because of\n // this, killing the process during a refresh will cause the process to\n // wait for the current refresh to finish before exiting. This is not\n // ideal, but it is the best we can do until Kysely provides a way to\n // cancel a query.\n await sql`REFRESH MATERIALIZED VIEW CONCURRENTLY ${sql.id(view)}`.execute(\n db,\n )\n }\n })\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/ozone",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.155",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Backend service for moderating the Bluesky network.",
|
|
6
6
|
"keywords": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"ts-node": "^10.8.2",
|
|
56
56
|
"typescript": "^5.6.3",
|
|
57
57
|
"@atproto/lex-cli": "^0.9.6",
|
|
58
|
-
"@atproto/pds": "^0.4.
|
|
58
|
+
"@atproto/pds": "^0.4.193"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/*",
|
|
@@ -121,7 +121,9 @@ const handleModerationEvent = async ({
|
|
|
121
121
|
])
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
const isTakedownOrReverseTakedownEvent =
|
|
125
|
+
isTakedownEvent || isReverseTakedownEvent
|
|
126
|
+
if (isTakedownOrReverseTakedownEvent || isLabelEvent) {
|
|
125
127
|
const status = await moderationService.getStatus(subject)
|
|
126
128
|
|
|
127
129
|
if (status?.takendown && isTakedownEvent) {
|