Commit Graph

9106 Commits (2d4faa5cfd7247939b2228b29acfacdb5d60932a)

Author SHA1 Message Date
Claire 2d4faa5cfd Disable captcha if registrations are disabled for various reasons 2022-01-24 22:12:57 +01:00
Claire c209cf5a09 Renew Rails session ID on successful registration 2022-01-24 22:01:05 +01:00
Claire d36eb0503f Please CodeClimate 2022-01-24 21:29:50 +01:00
Claire 5c88cb1a67 Add optional hCaptcha support
Fixes #1649

This requires setting `HCAPTCHA_SECRET_KEY` and `HCAPTCHA_SITE_KEY`, then
enabling the admin setting at
`/admin/settings/edit#form_admin_settings_captcha_enabled`

Subsequently, a hCaptcha widget will be displayed on `/about` and
`/auth/sign_up` unless:
- the user is already signed-up already
- the user has used an invite link
- the user has already solved the captcha (and registration failed for another
  reason)

The Content-Security-Policy headers are altered automatically to allow the
third-party hCaptcha scripts on `/about` and `/auth/sign_up` following the same
rules as above.
2022-01-24 21:22:13 +01:00
Claire 73eeb58f10 [Glitch] Change `percent` to `rate` in retention metrics API
Port 41d64ee271 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-23 18:24:40 +01:00
Claire 1800e05513 [Glitch] Fix text being incorrectly pre-selected in composer textarea on /share
Port 335049cc33 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-23 18:24:34 +01:00
Claire 67028c4779 Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `spec/models/status_spec.rb`:
  Upstream added tests too close to glitch-soc-specific tests.
  Kept both tests.
2022-01-23 18:24:01 +01:00
Claire e92ac5b769 Fix error-prone SQL queries (#15828)
* Fix error-prone SQL queries in Account search

While this code seems to not present an actual vulnerability, one could
easily be introduced by mistake due to how the query is built.

This PR parameterises the `to_tsquery` input to make the query more robust.

* Harden code for Status#tagged_with_all and Status#tagged_with_none

Those two scopes aren't used in a way that could be vulnerable to an SQL
injection, but keeping them unchanged might be a hazard.

* Remove unneeded spaces surrounding tsquery term

* Please CodeClimate

* Move advanced_search_for SQL template to its own function

This avoids one level of indentation while making clearer that the SQL template
isn't build from all the dynamic parameters of advanced_search_for.

* Add tests covering tagged_with, tagged_with_all and tagged_with_none

* Rewrite tagged_with_none to avoid multiple joins and make it more robust

* Remove obsolete brakeman warnings

* Revert "Remove unneeded spaces surrounding tsquery term"

The two queries are not strictly equivalent.

This reverts commit 86f16c537e06c6ba4a8b250f25dcce9f049023ff.
2022-01-23 18:10:10 +01:00
Claire 41d64ee271 Change `percent` to `rate` in retention metrics API (#16910) 2022-01-23 16:01:25 +01:00
Claire 06f653972a Add OMNIAUTH_ONLY environment variable to enforce externa log-in (#17288)
* Remove support for OAUTH_REDIRECT_AT_SIGN_IN

Fixes #15959

Introduced in #6540, OAUTH_REDIRECT_AT_SIGN_IN allowed skipping the log-in form
to instead redirect to the external OmniAuth login provider.

However, it did not prevent the log-in form on /about introduced by #10232 from
appearing, and completely broke with the introduction of #15228.

As I restoring that previous log-in flow without introducing a security
vulnerability may require extensive care and knowledge of how OmniAuth works,
this commit removes support for OAUTH_REDIRECT_AT_SIGN_IN instead for the time
being.

* Add OMNIAUTH_ONLY environment variable to enforce external log-in only

* Disable user registration when OMNIAUTH_ONLY is set to true

* Replace log-in links When OMNIAUTH_ONLY is set with exactly one OmniAuth provider
2022-01-23 15:52:58 +01:00
Claire 12bb24ea35 Remove support for OAUTH_REDIRECT_AT_SIGN_IN (#17287)
Fixes #15959

Introduced in #6540, OAUTH_REDIRECT_AT_SIGN_IN allowed skipping the log-in form
to instead redirect to the external OmniAuth login provider.

However, it did not prevent the log-in form on /about introduced by #10232 from
appearing, and completely broke with the introduction of #15228.

As I restoring that previous log-in flow without introducing a security
vulnerability may require extensive care and knowledge of how OmniAuth works,
this commit removes support for OAUTH_REDIRECT_AT_SIGN_IN instead for the time
being.
2022-01-23 15:50:41 +01:00
Claire 8114f4208f Remove leftover database columns from Devise::Models::Rememberable (#17191)
* Remove leftover database columns from Devise::Models::Rememberable

* Update fix-duplication maintenance script

* Improve errors/warnings in the fix-duplicates maintenance script
2022-01-23 15:46:30 +01:00
Claire 335049cc33 Fix text being incorrectly pre-selected in composer textarea on /share (#17339)
Fixes #17295
2022-01-20 20:56:21 +01:00
Claire 68a9057420 Add post edited notice in admin and public UIs (#17335)
* Add edited toot flag on public pages

* Add toot edit flag to admin pages
2022-01-20 13:37:31 +01:00
Claire 458f232d21 Add content-type to status source in glitch-soc 2022-01-20 00:03:44 +01:00
Eugen Rochko cb8ec71677 [Glitch] Add support for editing for published statuses
Port front-end changes from 06b698a723 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-20 00:03:41 +01:00
Claire 01e495563e Merge branch 'main' into glitch-soc/merge-upstream 2022-01-19 23:52:53 +01:00
Claire 686eaacbc8 Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/lib/activitypub/activity/create.rb`:
  Upstream refactored how `Create` activities are handled and how values are
  extracted from `Create`d objects. This conflicted with how glitch-soc
  supported the `directMessage` flag to explicitly distinguish between
  limited and direct messages.
  Ported glitch-soc's changes to latest upstream changes.
- `app/services/fan_out_on_write_service.rb`:
  Upstream largely refactored that file and changed some of the logic.
  This conflicted with glitch-soc's handling of the direct timeline and
  the options to allow replies and boosts in public feeds.
  Ported those glitch-soc changes on top of latest upstream changes.
- `app/services/process_mentions_service.rb`:
  Upstream refactored to move mention-related ActivityPub deliveries to
  `ActivityPub::DeliveryWorker`, while glitch-soc contained an extra check
  to not send local-only toots to remote mentioned users.
  Took upstream's version, as the check is not needed anymore, since it is
  performed at the `ActivityPub::DeliveryWorker` call site already.
- `app/workers/feed_insert_worker.rb`:
  Upstream added support for `update` toot events, while glitch-soc had
  support for an extra timeline support, `direct`.
  Ported upstream changes and extended them to the `direct` timeline.

Additional changes:
- `app/lib/activitypub/parser/status_parser.rb`:
  Added code to handle the `directMessage` flag and take it into account
  to compute visibility.
- `app/lib/feed_manager.rb`:
  Extended upstream's support of `update` toot events to glitch-soc's
  `direct` timeline.
2022-01-19 23:52:48 +01:00
Eugen Rochko a427958026 Fix error when using raw distribution worker (#17334)
Regression from #16697
2022-01-19 23:05:59 +01:00
Eugen Rochko bfbfbf5032 Fix error when processing poll updates (#17333)
Regression from #16697
2022-01-19 22:50:01 +01:00
Eugen Rochko 06b698a723 Add support for editing for published statuses (#16697)
* Add support for editing for published statuses

* Fix references to stripped-out code

* Various fixes and improvements

* Further fixes and improvements

* Fix updates being potentially sent to unauthorized recipients

* Various fixes and improvements

* Fix wrong words in test

* Fix notifying accounts that were tagged but were not in the audience

* Fix mistake
2022-01-19 22:37:27 +01:00
Claire 6ae170697a Merge pull request #1662 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
2022-01-19 14:22:59 +01:00
Claire ad5fd97277 Merge branch 'main' into glitch-soc/merge-upstream 2022-01-19 12:32:44 +01:00
Jeong Arm be15674215 Fix NameError on ActivityPub::FetchFeaturedCollectionService (#17326)
Related: #16954
2022-01-19 04:08:46 +01:00
Claire 8904dac905 Merge pull request #1660 from ClearlyClaire/glitch-soc/features/themes-multiple-packs
Refactor glitch-soc's theme handling
2022-01-18 00:18:07 +01:00
Claire 5d38a8573c Please CodeClimate 2022-01-17 13:06:06 +01:00
Claire a250aefe77 Move controller theming code to concern 2022-01-17 12:50:52 +01:00
Claire 833a5e4e52 Fix `pinned` attribute not being set for private self-posts (#17304) 2022-01-17 11:59:46 +01:00
Eugen Rochko a5cb48879d [Glitch] Add notifications for statuses deleted by moderators
Port front-end changes from 2fb76550a9 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-17 11:19:44 +01:00
Claire 485cf5c0c1 Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/views/admin/reports/show.html.haml`:
  Conflicts due to glitch-soc's theming system.
2022-01-17 10:45:25 +01:00
Claire a10833e909 Fix `pinned` attribute not being set for private self-posts 2022-01-17 09:52:19 +01:00
Eugen Rochko 2fb76550a9 Add notifications for statuses deleted by moderators (#17204) 2022-01-17 09:41:33 +01:00
Claire b20dafb566 [Glitch] Add support for private pinned posts
Port JS changes from 5aade2baac to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-17 08:35:27 +01:00
Claire de7f936b96 Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/controllers/accounts_controller.rb`:
  Upstream introduced support for private pinned toots, but glitch-soc's query
  was a bit different as it filtered out local-only toots.
  Used upstream's query, while adding local-only filtering back.
- `app/controllers/activitypub/collections_controller.rb`:
  Same thing with regards to local-only posts.
- `app/validators/status_pin_validator.rb`:
  Not a real conflict, but the line below was different in glitch-soc due to
  the configurable pinned toots limit.
2022-01-17 08:28:52 +01:00
Claire 5aade2baac Add support for private pinned posts (#16954)
* Add support for private pinned toots

* Allow local user to pin private toots

* Change wording to avoid "direct message"
2022-01-17 00:49:55 +01:00
Claire 21828806b3 Merge branch 'main' into glitch-soc/merge-upstream 2022-01-16 22:29:05 +01:00
Claire 91c1fbf714 Fix missing media: 'all' on default skins 2022-01-16 22:26:18 +01:00
Claire a3a9d4d789 Refactor theming HAML template a bit 2022-01-16 22:26:18 +01:00
Claire c8973773bc Refactor theme config loading 2022-01-16 22:26:18 +01:00
Claire 37dadd4512 Refactor some more 2022-01-16 22:26:18 +01:00
Claire 10bef4493c Refactor glitch-soc's theme handling 2022-01-16 22:12:11 +01:00
Claire 928890bd38 Fix admin interface crash when displaying deleted user (#17301) 2022-01-16 20:57:37 +01:00
Jeong Arm 923eda5cd5 [Glitch] Gradually increase retry waiting for media processing
Port 52b05dad34 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-16 18:14:33 +01:00
Claire 577c74d422 Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `README.md`:
  Upstream added some text, but our README is completely different.
  Kept our README unchanged.
2022-01-16 18:11:20 +01:00
Eugen Rochko 7b3972c270 Remove IP tracking columns from users table (#16409) 2022-01-16 13:23:50 +01:00
Jeong Arm 52b05dad34 Gradually increase retry waiting for media processing (#17271) 2022-01-10 14:25:08 +01:00
Claire 817072e9c7 [Glitch] Fix media descriptions not being used for client-side filtering
Port 651e997a98 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2022-01-07 19:54:58 +01:00
Claire 338c47b6c6 Merge branch 'main' into glitch-soc/merge-upstream 2022-01-07 19:51:47 +01:00
Jeong Arm db10cd8d15 Remove custom emojis on domain purge (#17210) 2021-12-30 08:41:09 +01:00
Claire 651e997a98 Fix media descriptions not being used for client-side filtering (#17206)
Fix oversight in #13837
2021-12-28 23:25:50 +01:00