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

Fix process of receiving posts with bearcaps is not working #26527

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

kmycode
Copy link
Contributor

@kmycode kmycode commented Aug 17, 2023

Currently, Mastodon is unable to receive post with Bearcaps from ActivityPub.
Originally @object['content'] should be used as the status text, but @json['content'] is currently used.

First, received json is saved to @json and @object.

  # activity.rb
  def initialize(json, account, **options)
    @json    = json
    @account = account
    @object  = @json['object']
    @options = options
  end
@json <= Received json
@object <= Received json

Next, the program reads the signature post and sets the data in the @object.

  # activity.rb
  def dereference_object!
    return unless @object.is_a?(String)

    dereferencer = ActivityPub::Dereferencer.new(@object, permitted_origin: @account.uri, signature_actor: signed_fetch_actor)

    @object = dereferencer.object unless dereferencer.object.nil?
  end
@json <= Received json
@object <= Dereferenced json

Finally, StatusParser uses data from @json.

  # create.rb
  def process_status_params
    @status_parser = ActivityPub::Parser::StatusParser.new(@json, followers_collection: @account.followers_url)

Therefore, @json['content'] is read as status text.
This is fine for normal posts, but an empty string is always returned for signed posts (Bearcaps posts).

I fixed calling StatusParser.new on this pull request.

@renchap renchap added the activitypub Protocol-related changes, federation label Aug 17, 2023
@kmycode kmycode changed the title Fix process of receiving signatured posts (Bearcaps) was not working Fix process of receiving signatured posts was not working Aug 17, 2023
@kmycode kmycode changed the title Fix process of receiving signatured posts was not working Fix process of receiving dereferenced posts was not working Aug 23, 2023
@noellabo
Copy link
Contributor

@Gargron @ClearlyClaire This bug made it incompatible with Fedibird's circles feature (yes, it's a remnant of a previously unmerged Mastodon feature). Could you please merge this PR into v4.2?

@ClearlyClaire
Copy link
Contributor

Sorry it slipped through. I'm not confident in having it in 4.2.0, which is scheduled for today, but I will try to have a deeper look at it in the near future, to have it in 4.3.0 and possibly in a backport for 4.2 and 4.1

@noellabo
Copy link
Contributor

Please merge this fix into the v4.3 release.
For a long time, servers using Bearcaps have been having trouble communicating with Mastodon.
@ClearlyClaire

@kmycode kmycode changed the title Fix process of receiving dereferenced posts was not working Fix process of receiving posts with bearcaps is not working Jan 25, 2024
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forgot about this again!

Looks good to me, I'll add tests in a follow-up PR.

@ClearlyClaire ClearlyClaire added this pull request to the merge queue Jan 25, 2024
Merged via the queue into mastodon:main with commit 9a8293f Jan 25, 2024
30 checks passed
@kmycode kmycode deleted the topic_receiving_bearcaps_post branch January 25, 2024 10:46
neatchee pushed a commit to neatchee/mastodon that referenced this pull request Feb 4, 2024
* Add confirmation when redirecting logged-out requests to permalink (mastodon#27792)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* chore(deps): update dependency rubocop to v1.60.1 (mastodon#28731)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix `Rails/WhereExists` cop in app/lib (mastodon#28862)

* Use active variants for boost icons and increase icon size (mastodon#27924)

* chore(deps): update dependency haml_lint to v0.55.0 (mastodon#28856)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency selenium-webdriver to v4.17.0 (mastodon#28858)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update artifact actions (major) to v4 (major) (mastodon#28415)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency dotenv to v16.4.0 (mastodon#28872)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency chewy to v7.5.0 (mastodon#28730)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Tidy up association declaration in `Instance` model (mastodon#28880)

* Fix process of receiving posts with bearcaps is not working (mastodon#26527)

* Fix redirect confirmation for accounts (mastodon#28902)

* Add tests for redirect confirmations (mastodon#28903)

* Add tests for processing statuses using bearcap URIs (mastodon#28904)

* chore(deps): update dependency rspec-rails to v6.1.1 (mastodon#28905)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency axios to v1.6.6 (mastodon#28895)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix remaining `Rails/WhereExists` cop violations, regenerate todo (mastodon#28892)

* fix(deps): update dependency dotenv to v16.4.1 (mastodon#28889)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add `CustomFilterKeyword#to_regex` method (mastodon#28893)

* New Crowdin Translations (automated) (mastodon#28899)

Co-authored-by: GitHub Actions <noreply@github.com>

* Consolidate db test prep steps to rake task (mastodon#28886)

* Fix `Style/TernaryParentheses` cop (mastodon#28387)

* Reduce factory creation in `spec/models/account_statuses_cleanup_policy` (mastodon#28361)

* Extract helper methods for db connection and table existence check in `CLI::Maintenance` task (mastodon#28281)

* Refactor conversations components in web UI (mastodon#28833)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* Fix `Style/GuardClause` cop in app/controllers (mastodon#28420)

* Update paperclip and climate_control gems (mastodon#28379)

* Extract `rebuild_index` method in maintenance CLI (mastodon#28911)

* Add specs for `Instance` model scopes and add `with_domain_follows` scope (mastodon#28767)

* [Glitch] Add confirmation when redirecting logged-out requests to permalink

Port SCSS changes from b19ae52 to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Use active variants for boost icons and increase icon size

Port 5a838ce to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* Fix CSS loading in redirect controller

* [Glitch] Refactor conversations components in web UI (glitch-soc#2589)

Port 3205a65 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>

* Fix crash in private mention conversations in glitch-soc flavor (glitch-soc#2595)

* Remove obsolete locale file (glitch-soc#2596)

* Add github action workflow for manual security builds (mastodon#29040)

* Adapt workflow to glitch-soc

* Fix missing `workflow_dispatch` trigger for `build-security` (mastodon#29041)

* Configure selenium to use Chrome version 120 (mastodon#29038)

* Fix security builds not being marked latest

* Merge pull request from GHSA-3fjr-858r-92rw

* Fix insufficient origin validation

* Bump version to 4.3.0-alpha.1

* Fix build-security workflow for glitch-soc

* Restore -streaming suffix for security builds (glitch-soc#2602)

* Temporary hack to correctly tag the security docker image…

* Fix build-security docker tags

* fix lint issues in conversation.jsx

---------

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matt Jankowski <matt@jankowski.online>
Co-authored-by: KMY(雪あすか) <tt@kmycode.net>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <noreply@github.com>
Co-authored-by: Aaron Brady <aaron@insom.me.uk>
neatchee added a commit to neatchee/mastodon that referenced this pull request Feb 4, 2024
* Add confirmation when redirecting logged-out requests to permalink (mastodon#27792)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* chore(deps): update dependency rubocop to v1.60.1 (mastodon#28731)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix `Rails/WhereExists` cop in app/lib (mastodon#28862)

* Use active variants for boost icons and increase icon size (mastodon#27924)

* chore(deps): update dependency haml_lint to v0.55.0 (mastodon#28856)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency selenium-webdriver to v4.17.0 (mastodon#28858)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update artifact actions (major) to v4 (major) (mastodon#28415)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency dotenv to v16.4.0 (mastodon#28872)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency chewy to v7.5.0 (mastodon#28730)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Tidy up association declaration in `Instance` model (mastodon#28880)

* Fix process of receiving posts with bearcaps is not working (mastodon#26527)

* Fix redirect confirmation for accounts (mastodon#28902)

* Add tests for redirect confirmations (mastodon#28903)

* Add tests for processing statuses using bearcap URIs (mastodon#28904)

* chore(deps): update dependency rspec-rails to v6.1.1 (mastodon#28905)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency axios to v1.6.6 (mastodon#28895)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix remaining `Rails/WhereExists` cop violations, regenerate todo (mastodon#28892)

* fix(deps): update dependency dotenv to v16.4.1 (mastodon#28889)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add `CustomFilterKeyword#to_regex` method (mastodon#28893)

* New Crowdin Translations (automated) (mastodon#28899)

Co-authored-by: GitHub Actions <noreply@github.com>

* Consolidate db test prep steps to rake task (mastodon#28886)

* Fix `Style/TernaryParentheses` cop (mastodon#28387)

* Reduce factory creation in `spec/models/account_statuses_cleanup_policy` (mastodon#28361)

* Extract helper methods for db connection and table existence check in `CLI::Maintenance` task (mastodon#28281)

* Refactor conversations components in web UI (mastodon#28833)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* Fix `Style/GuardClause` cop in app/controllers (mastodon#28420)

* Update paperclip and climate_control gems (mastodon#28379)

* Extract `rebuild_index` method in maintenance CLI (mastodon#28911)

* Add specs for `Instance` model scopes and add `with_domain_follows` scope (mastodon#28767)

* [Glitch] Add confirmation when redirecting logged-out requests to permalink

Port SCSS changes from b19ae52 to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Use active variants for boost icons and increase icon size

Port 5a838ce to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* Fix CSS loading in redirect controller

* [Glitch] Refactor conversations components in web UI (glitch-soc#2589)

Port 3205a65 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>

* Fix crash in private mention conversations in glitch-soc flavor (glitch-soc#2595)

* Remove obsolete locale file (glitch-soc#2596)

* Add github action workflow for manual security builds (mastodon#29040)

* Adapt workflow to glitch-soc

* Fix missing `workflow_dispatch` trigger for `build-security` (mastodon#29041)

* Configure selenium to use Chrome version 120 (mastodon#29038)

* Fix security builds not being marked latest

* Merge pull request from GHSA-3fjr-858r-92rw

* Fix insufficient origin validation

* Bump version to 4.3.0-alpha.1

* Fix build-security workflow for glitch-soc

* Restore -streaming suffix for security builds (glitch-soc#2602)

* Temporary hack to correctly tag the security docker image…

* Fix build-security docker tags

---------

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matt Jankowski <matt@jankowski.online>
Co-authored-by: KMY(雪あすか) <tt@kmycode.net>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <noreply@github.com>
Co-authored-by: Aaron Brady <aaron@insom.me.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activitypub Protocol-related changes, federation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants