You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/spec/models
Claire 0a120d86d2
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 86f16c537e.
3 years ago
..
admin Add account sensitized (#14361) 4 years ago
concerns Add remove from followers api (#16864) 3 years ago
trends Add trending links (#16917) 3 years ago
web Add `policy` param to `POST /api/v1/push/subscriptions` (#16040) 4 years ago
account_alias_spec.rb Add account migration UI (#11846) 5 years ago
account_conversation_spec.rb
account_deletion_request_spec.rb Change account suspensions to be reversible by default (#14726) 4 years ago
account_domain_block_spec.rb
account_filter_spec.rb Add batch suspend for accounts in admin UI (#17009) 3 years ago
account_migration_spec.rb Add account migration UI (#11846) 5 years ago
account_moderation_note_spec.rb
account_spec.rb Fix error when suspending user with an already-existing canonical email block (#17036) 3 years ago
account_statuses_cleanup_policy_spec.rb Allow keeping only 1 boosts/favs on auto deleting posts (#16653) 3 years ago
announcement_mute_spec.rb Add announcements (#12662) 5 years ago
announcement_reaction_spec.rb Add announcements (#12662) 5 years ago
announcement_spec.rb Add announcements (#12662) 5 years ago
backup_spec.rb
block_spec.rb
canonical_email_block_spec.rb Add canonical e-mail blocks for suspended accounts (#16049) 4 years ago
conversation_mute_spec.rb
conversation_spec.rb Revert "Remove conversation URI (#11423)" (#11424) 6 years ago
custom_emoji_category_spec.rb Add categories for custom emojis (#11196) 6 years ago
custom_emoji_filter_spec.rb
custom_emoji_spec.rb
custom_filter_spec.rb
device_spec.rb Add E2EE API (#13820) 5 years ago
domain_allow_spec.rb Add whitelist mode (#11291) 6 years ago
domain_block_spec.rb Allow blocking TLDs, and fix TLD blocks not being editable (#12805) 5 years ago
email_domain_block_spec.rb
encrypted_message_spec.rb Add E2EE API (#13820) 5 years ago
export_spec.rb Export and import show_reblogs together with following list (#10495) 6 years ago
favourite_spec.rb
featured_tag_spec.rb Add featured hashtags to profiles (#9755) 6 years ago
follow_recommendation_suppression_spec.rb Add cold-start follow recommendations (#15945) 4 years ago
follow_request_spec.rb Fix edge case where accepted follow cannot be processed because of follow limit (#16098) 4 years ago
follow_spec.rb Fix follow limit preventing re-following of a moved account (#14207) 4 years ago
home_feed_spec.rb Fix performance of home feed regeneration (#12084) 5 years ago
identity_spec.rb
import_spec.rb Fix follow limit preventing re-following of a moved account (#14207) 4 years ago
invite_spec.rb Change account suspensions to be reversible by default (#14726) 4 years ago
ip_block_spec.rb Add IP-based rules (#14963) 4 years ago
list_account_spec.rb
list_spec.rb
login_activity_spec.rb Add authentication history (#16408) 4 years ago
marker_spec.rb Add timeline read markers API (#11762) 5 years ago
media_attachment_spec.rb Fix error when rendering public pages with media attachments (#16763) 3 years ago
mention_spec.rb
mute_spec.rb
notification_spec.rb Improved performance of notification preloading (#15640) 4 years ago
one_time_key_spec.rb Add E2EE API (#13820) 5 years ago
poll_spec.rb Add polls (#10111) 6 years ago
poll_vote_spec.rb Implement pending tests (#11415) 6 years ago
preview_card_spec.rb
public_feed_spec.rb Refactor how public and tag timelines are queried (#14728) 4 years ago
relationship_filter_spec.rb Fix followings list order | Issue #13538 (#13676) 5 years ago
relay_spec.rb
remote_follow_spec.rb Fix uncaught domain normalization error in remote follow (#11703) 5 years ago
report_filter_spec.rb
report_spec.rb Add notifications for statuses deleted by moderators (#17204) 3 years ago
rule_spec.rb Add server rules (#15769) 4 years ago
scheduled_status_spec.rb
session_activation_spec.rb Add Ruby 3.0 support (#16046) 4 years ago
setting_spec.rb Update Mastodon to Rails 6.1 (#15910) 4 years ago
site_upload_spec.rb
status_edit_spec.rb Add support for editing for published statuses (#16697) 3 years ago
status_pin_spec.rb Add support for private pinned posts (#16954) 3 years ago
status_spec.rb Fix error-prone SQL queries (#15828) 3 years ago
status_stat_spec.rb
system_key_spec.rb Add E2EE API (#13820) 5 years ago
tag_feed_spec.rb Fix typo in tag_feed_spec.rb (#16466) 4 years ago
tag_spec.rb Improve tag search query (#16104) 4 years ago
unavailable_domain_spec.rb Change delivery failure tracking to work with hostnames instead of URLs (#13437) 5 years ago
user_invite_request_spec.rb Add "why do you want to join" field to invite requests (#10524) 6 years ago
user_spec.rb Add ability to skip sign-in token authentication for specific users (#16427) 4 years ago
webauthn_credentials_spec.rb Fix validates :sign_count of WebauthnCredential (#14806) 4 years ago