server: block Create activites from blocked hosts #298

Closed
norm wants to merge 1 commit from block-creates into main
Owner

This should prevent notes from blocked instances from slipping through.

Changelog: Fixed

This should prevent notes from blocked instances from slipping through. Changelog: Fixed
norm added 1 commit 2022-12-23 23:35:15 +00:00
server: block Create activites from blocked hosts
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-sw Pipeline failed
ci/woodpecker/pr/test Pipeline failed
e772bf098a
This should prevent notes from blocked instances from slipping through.

Changelog: Fixed
Johann150 reviewed 2022-12-24 09:59:48 +00:00
@ -7,3 +9,4 @@
export default async (actor: CacheableRemoteUser, activity: ICreate, resolver: Resolver): Promise<void> => {
const uri = getApId(activity);
if (await shouldBlockInstance(extractDbHost(uri))) return;
Owner

Shouldn't this already be covered by resolving the activity object further down? The object being created must be from the same host, otherwise it would have been caught by this check

if (extractDbHost(actor.uri) !== extractDbHost(note.id)) {
return 'skip: host in actor.uri !== note.id';
}

. I guess it was already embedded as an object so the usual checks aren't performed due to this short circuit

if (typeof value !== 'string') {
return value;
}

. Maybe a better idea to add the matching id/url and instance blocks in that case too.

Maybe also check this at a higher level, i.e. in performOneActivity.

Shouldn't this already be covered by resolving the activity object further down? The object being created must be from the same host, otherwise it would have been caught by this check https://akkoma.dev/FoundKeyGang/FoundKey/src/commit/85419326f868291036681cc9ddfbbc545d37f77d/packages/backend/src/remote/activitypub/kernel/create/note.ts#L21-L23. I guess it was already embedded as an object so the usual checks aren't performed due to this short circuit https://akkoma.dev/FoundKeyGang/FoundKey/src/commit/85419326f868291036681cc9ddfbbc545d37f77d/packages/backend/src/remote/activitypub/resolver.ts#L53-L55. Maybe a better idea to add the matching id/url and instance blocks in that case too. Maybe also check this at a higher level, i.e. in `performOneActivity`.
Author
Owner

Superseded by #299.

Superseded by #299.
norm closed this pull request 2022-12-24 17:03:42 +00:00
norm deleted branch block-creates 2022-12-24 17:03:52 +00:00
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-sw Pipeline failed
ci/woodpecker/pr/test Pipeline failed

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#298
No description provided.