Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: community restricted to mods/admins for postings can cause problems for remote federation instances when the admin user is not a mod #3571

Closed
4 tasks done
RocketDerp opened this issue Jul 9, 2023 · 2 comments
Labels
area: federation support federation via activitypub bug Something isn't working

Comments

@RocketDerp
Copy link
Contributor

RocketDerp commented Jul 9, 2023

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

Lemmy server logs show frequent error:

 WARN lemmy_server::root_span_builder: not_a_mod_or_admin: not_a_mod_or_admin
   0: lemmy_api_common::utils::is_mod_or_admin
              at crates/api_common/src/utils.rs:51
    1: lemmy_apub::objects::post::from_json
              at crates/apub/src/objects/post.rs:161
    2: lemmy_apub::fetcher::post_or_comment::from_json
              at crates/apub/src/fetcher/post_or_comment.rs:80
    3: lemmy_apub::objects::comment::verify
              at crates/apub/src/objects/comment.rs:124
    4: lemmy_apub::fetcher::post_or_comment::verify
              at crates/apub/src/fetcher/post_or_comment.rs:68
    5: lemmy_apub::activities::voting::vote::verify
              at crates/apub/src/activities/voting/vote.rs:57
    6: lemmy_apub::activities::community::announce::receive
              at crates/apub/src/activities/community/announce.rs:157
    7: lemmy_server::root_span_builder::HTTP request
            with http.method=POST http.scheme="http" http.host=bulletintree.com http.target=/inbox otel.kind="server" request_id=e4ec5973-49b3-4454-8690-aa539ba20fa1
              at src/root_span_builder.rs:16

 LemmyError { message: Some("not_a_mod_or_admin"), inner: not_a_mod_or_admin, context: SpanTrace [{ target: "lemmy_api_common::utils", name: "is_mod_or_admin", file: "crates/api_common/src/utils.rs", line: 51 }, { target: "lemmy_apub::objects::post", name: "from_json", file: "crates/apub/src/objects/post.rs", line: 161 }, { target: "lemmy_apub::fetcher::post_or_comment", name: "from_json", file: "crates/apub/src/fetcher/post_or_comment.rs", line: 80 }, { target: "lemmy_apub::objects::comment", name: "verify", file: "crates/apub/src/objects/comment.rs", line: 124 }, { target: "lemmy_apub::fetcher::post_or_comment", name: "verify", file: "crates/apub/src/fetcher/post_or_comment.rs", line: 68 }, { target: "lemmy_apub::activities::voting::vote", name: "verify", file: "crates/apub/src/activities/voting/vote.rs", line: 57 }, { target: "lemmy_apub::activities::community::announce", name: "receive", file: "crates/apub/src/activities/community/announce.rs", line: 157 }, { target: "lemmy_server::root_span_builder", name: "HTTP request", fields: "http.method=POST http.scheme=\"http\" http.host=bulletintree.com http.target=/inbox otel.kind=\"server\" request_id=e4ec5973-49b3-4454-8690-aa539ba20fa1", file: "src/root_span_builder.rs", line: 16 }] }

Hacking in additional logging in the Rust code reveals that this post is the problem:

https://lemmy.world/post/1274909

The interesting thing about this post is that the user https://lemmy.world/u/lwadmin who posted it is an admin of the remote Instance, but not a moderator for the restricted community. So my instance does not recognize them as an admin of my own server nor as a moderator of the community, rejecting the post.

Screen shot showing the user is "A"dmin, but no "M" for moderator.
image

Steps to Reproduce

  1. On Instance-A create a user who is admin
  2. Have the user create a post in a community for which they are not a moderator, but the community is set to only allow moderators and admins to post.
  3. Instance-B receives the post but does not recognize an admin of another instance as an admin. Nor was the user set as a moderator of the specific community, with that community set to require admin or moderator.

Technical Details

See above

Version

BE 0.18.1

Lemmy Instance URL

lemmy.world

@RocketDerp RocketDerp added the bug Something isn't working label Jul 9, 2023
@RocketDerp

This comment was marked as abuse.

@RocketDerp RocketDerp changed the title [Bug]: community restricted to mods/admins for postings can cause problems for federation instances when the user is not a mod [Bug]: community restricted to mods/admins for postings can cause problems for remote federation instances when the admin user is not a mod Jul 9, 2023
@lionirdeadman lionirdeadman added the area: federation support federation via activitypub label Jul 20, 2023
@Nutomic
Copy link
Member

Nutomic commented Feb 7, 2024

Easiest fix for this might be changing the setting to "only mods can post". Then admins cant post in the community either, unless they make themselves mod first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: federation support federation via activitypub bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants