the-draupnir-project / Draupnir

A Matrix moderation bot
https://the-draupnir-project.github.io/draupnir-documentation/
82 stars 14 forks source link

Spam police policies still causing decode errors to be shown on the error log level #444

Open Gnuxie opened 4 months ago

Gnuxie commented 4 months ago

I'm pretty sure that we made changes to the code base to treat these policies as redacted, but it's confusing people that they are still logged at the error level.

modbot32-1  | Thu, 30 May 2024 21:41:52 GMT [INFO] [index] Starting bot...
modbot32-1  | Thu, 30 May 2024 21:41:52 GMT [ERROR] [ActionException] ActionException Unknown a81d1245-a31a-47bd-9923-aacbd9985846 Unable to decode an event TransformDecodeCheckError: Unable to decode value as it does not match the expected schema
modbot32-1  |     at TypeCheck.Decode (/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js:50:19)
modbot32-1  |     at Value.Decode (/node_modules/matrix-protection-suite/dist/Interface/Value.js:36:45)
modbot32-1  |     at decodePolicyEvent (/node_modules/matrix-protection-suite/dist/MatrixTypes/PolicyEvents.js:151:26)
modbot32-1  |     at StandardEventDecoder.decodeEvent (/node_modules/matrix-protection-suite/dist/MatrixTypes/EventDecoder.js:38:20)
modbot32-1  |     at StandardEventDecoder.decodeStateEvent (/node_modules/matrix-protection-suite/dist/MatrixTypes/EventDecoder.js:42:29)
modbot32-1  |     at /node_modules/matrix-protection-suite-for-matrix-bot-sdk/dist/ClientManagement/RoomStateManagerFactory.js:67:100
modbot32-1  |     at Array.map (<anonymous>)
modbot32-1  |     at /node_modules/matrix-protection-suite-for-matrix-bot-sdk/dist/ClientManagement/RoomStateManagerFactory.js:67:72
modbot32-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
modbot32-1  |     at async RoomStateManagerFactory.getRoomRoomState (/node_modules/matrix-protection-suite-for-matrix-bot-sdk/dist/ClientManagement/RoomStateManagerFactory.js:65:31) {
modbot32-1  |   schema: {
modbot32-1  |     anyOf: [ [Object], [Object], [Object] ],
modbot32-1  |     [Symbol(TypeBox.Kind)]: 'Union'
modbot32-1  |   },
modbot32-1  |   value: {
modbot32-1  |     content: { reason: 'im a dumbass, wrong user' },
modbot32-1  |     origin_server_ts: 1704756933912,
modbot32-1  |     room_id: '!QzNmKfDhzCQFDqmUhl:matrix.org',
modbot32-1  |     sender: '@anti-scam:matrix.org',
modbot32-1  |     state_key: 'rule:@jamie87:matrix.org',
modbot32-1  |     type: 'm.policy.rule.user',
modbot32-1  |     unsigned: { replaces_state: '$FH0B8zJVE49PnVX_VkyNm4jCl_LEfVCVFzTCCRoUxzc' },
modbot32-1  |     event_id: '$bDyXrhGlcgBLcf3omGohAVKFNX-CqUO5AaP77Lal7Lk',
modbot32-1  |     user_id: '@anti-scam:matrix.org',
modbot32-1  |     replaces_state: '$FH0B8zJVE49PnVX_VkyNm4jCl_LEfVCVFzTCCRoUxzc'
modbot32-1  |   },
modbot32-1  |   error: {
modbot32-1  |     type: 62,
modbot32-1  |     schema: { anyOf: [Array], [Symbol(TypeBox.Kind)]: 'Union' },
modbot32-1  |     path: '',
modbot32-1  |     value: {
modbot32-1  |       content: [Object],
modbot32-1  |       origin_server_ts: 1704756933912,
modbot32-1  |       room_id: '!QzNmKfDhzCQFDqmUhl:matrix.org',
modbot32-1  |       sender: '@anti-scam:matrix.org',
modbot32-1  |       state_key: 'rule:@jamie87:matrix.org',
modbot32-1  |       type: 'm.policy.rule.user',
modbot32-1  |       unsigned: [Object],
modbot32-1  |       event_id: '$bDyXrhGlcgBLcf3omGohAVKFNX-CqUO5AaP77Lal7Lk',
modbot32-1  |       user_id: '@anti-scam:matrix.org',
modbot32-1  |       replaces_state: '$FH0B8zJVE49PnVX_VkyNm4jCl_LEfVCVFzTCCRoUxzc'
modbot32-1  |     },
modbot32-1  |     message: 'Expected union value'
modbot32-1  |   }
modbot32-1  | }
modbot32-1  | Thu, 30 May 2024 21:41:52 GMT [ERROR] [DecodeException] a81d1245-a31a-47bd-9923-aacbd9985846 {
modbot32-1  |   type: 62,
modbot32-1  |   schema: {
modbot32-1  |     anyOf: [ [Object], [Object], [Object] ],
modbot32-1  |     [Symbol(TypeBox.Kind)]: 'Union'
modbot32-1  |   },
modbot32-1  |   path: '',
modbot32-1  |   value: {
modbot32-1  |     content: { reason: 'im a dumbass, wrong user' },
modbot32-1  |     origin_server_ts: 1704756933912,
modbot32-1  |     room_id: '!QzNmKfDhzCQFDqmUhl:matrix.org',
modbot32-1  |     sender: '@anti-scam:matrix.org',
modbot32-1  |     state_key: 'rule:@jamie87:matrix.org',
modbot32-1  |     type: 'm.policy.rule.user',
modbot32-1  |     unsigned: { replaces_state: '$FH0B8zJVE49PnVX_VkyNm4jCl_LEfVCVFzTCCRoUxzc' },
modbot32-1  |     event_id: '$bDyXrhGlcgBLcf3omGohAVKFNX-CqUO5AaP77Lal7Lk',
modbot32-1  |     user_id: '@anti-scam:matrix.org',
modbot32-1  |     replaces_state: '$FH0B8zJVE49PnVX_VkyNm4jCl_LEfVCVFzTCCRoUxzc'
modbot32-1  |   },
modbot32-1  |   message: 'Expected union value'
modbot32-1  | }
modbot32-1  | Thu, 30 May 2024 21:41:52 GMT [ERROR] [ActionException] ActionException Unknown 2c5f64dd-dbb8-4f38-9fa0-5db8ae4e85b0 Unable to decode an event TransformDecodeCheckError: Unable to decode value as it does not match the expected schema
modbot32-1  |     at TypeCheck.Decode (/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js:50:19)
modbot32-1  |     at Value.Decode (/node_modules/matrix-protection-suite/dist/Interface/Value.js:36:45)
modbot32-1  |     at decodePolicyEvent (/node_modules/matrix-protection-suite/dist/MatrixTypes/PolicyEvents.js:151:26)
modbot32-1  |     at StandardEventDecoder.decodeEvent (/node_modules/matrix-protection-suite/dist/MatrixTypes/EventDecoder.js:38:20)
modbot32-1  |     at StandardEventDecoder.decodeStateEvent (/node_modules/matrix-protection-suite/dist/MatrixTypes/EventDecoder.js:42:29)
modbot32-1  |     at /node_modules/matrix-protection-suite-for-matrix-bot-sdk/dist/ClientManagement/RoomStateManagerFactory.js:67:100
modbot32-1  |     at Array.map (<anonymous>)
modbot32-1  |     at /node_modules/matrix-protection-suite-for-matrix-bot-sdk/dist/ClientManagement/RoomStateManagerFactory.js:67:72
modbot32-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
modbot32-1  |     at async RoomStateManagerFactory.getRoomRoomState (/node_modules/matrix-protection-suite-for-matrix-bot-sdk/dist/ClientManagement/RoomStateManagerFactory.js:65:31) {
modbot32-1  |   schema: {
modbot32-1  |     anyOf: [ [Object], [Object], [Object] ],
modbot32-1  |     [Symbol(TypeBox.Kind)]: 'Union'
modbot32-1  |   },
modbot32-1  |   value: {
modbot32-1  |     content: { reason: 'not a scammer, no fucking idea what he was thinking' },
modbot32-1  |     origin_server_ts: 1693351663899,
modbot32-1  |     room_id: '!QzNmKfDhzCQFDqmUhl:matrix.org',
modbot32-1  |     sender: '@anti-scam:matrix.org',
modbot32-1  |     state_key: 'rule:@stoere:projectsegfau.lt',
modbot32-1  |     type: 'm.policy.rule.user',
modbot32-1  |     unsigned: {
modbot32-1  |       age: 7065302610,
modbot32-1  |       replaces_state: '$oyUATFoZDKOF6csFDXBWAkv38-VCLuMw3UTwVcNT6D0'
modbot32-1  |     },
modbot32-1  |     event_id: '$1bcs953wT9lf_aXNEjxPOS9I94GvZvWs-TdXJTxDn6w',
modbot32-1  |     user_id: '@anti-scam:matrix.org',
modbot32-1  |     age: 7065302610,
modbot32-1  |     replaces_state: '$oyUATFoZDKOF6csFDXBWAkv38-VCLuMw3UTwVcNT6D0'
modbot32-1  |   },
modbot32-1  |   error: {
modbot32-1  |     type: 62,
modbot32-1  |     schema: { anyOf: [Array], [Symbol(TypeBox.Kind)]: 'Union' },
modbot32-1  |     path: '',
modbot32-1  |     value: {
modbot32-1  |       content: [Object],
modbot32-1  |       origin_server_ts: 1693351663899,
modbot32-1  |       room_id: '!QzNmKfDhzCQFDqmUhl:matrix.org',
modbot32-1  |       sender: '@anti-scam:matrix.org',
modbot32-1  |       state_key: 'rule:@stoere:projectsegfau.lt',
modbot32-1  |       type: 'm.policy.rule.user',
modbot32-1  |       unsigned: [Object],
modbot32-1  |       event_id: '$1bcs953wT9lf_aXNEjxPOS9I94GvZvWs-TdXJTxDn6w',
modbot32-1  |       user_id: '@anti-scam:matrix.org',
modbot32-1  |       age: 7065302610,
modbot32-1  |       replaces_state: '$oyUATFoZDKOF6csFDXBWAkv38-VCLuMw3UTwVcNT6D0'
modbot32-1  |     },
modbot32-1  |     message: 'Expected union value'
modbot32-1  |   }
modbot32-1  | }
modbot32-1  | Thu, 30 May 2024 21:41:52 GMT [ERROR] [DecodeException] 2c5f64dd-dbb8-4f38-9fa0-5db8ae4e85b0 {
modbot32-1  |   type: 62,
modbot32-1  |   schema: {
modbot32-1  |     anyOf: [ [Object], [Object], [Object] ],
modbot32-1  |     [Symbol(TypeBox.Kind)]: 'Union'
modbot32-1  |   },
modbot32-1  |   path: '',
modbot32-1  |   value: {
modbot32-1  |     content: { reason: 'not a scammer, no fucking idea what he was thinking' },
modbot32-1  |     origin_server_ts: 1693351663899,
modbot32-1  |     room_id: '!QzNmKfDhzCQFDqmUhl:matrix.org',
modbot32-1  |     sender: '@anti-scam:matrix.org',
modbot32-1  |     state_key: 'rule:@stoere:projectsegfau.lt',
modbot32-1  |     type: 'm.policy.rule.user',
modbot32-1  |     unsigned: {
modbot32-1  |       age: 7065302610,
modbot32-1  |       replaces_state: '$oyUATFoZDKOF6csFDXBWAkv38-VCLuMw3UTwVcNT6D0'
modbot32-1  |     },
modbot32-1  |     event_id: '$1bcs953wT9lf_aXNEjxPOS9I94GvZvWs-TdXJTxDn6w',
modbot32-1  |     user_id: '@anti-scam:matrix.org',
modbot32-1  |     age: 7065302610,
modbot32-1  |     replaces_state: '$oyUATFoZDKOF6csFDXBWAkv38-VCLuMw3UTwVcNT6D0'
modbot32-1  |   },
modbot32-1  |   message: 'Expected union value'
modbot32-1  | }
modbot32-1  | Thu, 30 May 2024 21:41:52 GMT [ERROR] [RoomStateManagerFactory] There were multiple errors while decoding state events for https://matrix.to/#/!QzNmKfDhzCQFDqmUhl%3Amatrix.org?via=matrix.org {
modbot32-1  |   error: MultipleErrors {
modbot32-1  |     message: 'Unable to decode state events in https://matrix.to/#/!QzNmKfDhzCQFDqmUhl%3Amatrix.org?via=matrix.org',
modbot32-1  |     elaborations: [],
modbot32-1  |     errors: [ [DecodeException], [DecodeException] ]
modbot32-1  |   },
modbot32-1  |   isOkay: false,
modbot32-1  |   match: [Function: match],
modbot32-1  |   elaborate: [Function: elaborate]
modbot32-1  | }