Commit Graph

51512 Commits

Author SHA1 Message Date
Daniel Waterworth
23a4b58ba1
SECURITY: Run custom field validations with save_custom_fields 2024-01-08 09:53:28 -07:00
Joffrey JAFFEUX
22c3cac131
SECURITY: ensures mentioned_users is limited
Prior to this fix the number of users rendered by mentioned_users could equal the number of members in a channel which would be slow but could in more extreme case crash the page and/or server.
2024-01-08 09:53:25 -07:00
Daniel Waterworth
497d5b4ca0 DEV: Concerns can use class_methods (#24875) 2024-01-05 14:16:08 -06:00
Daniel Waterworth
92882d1cc3 FIX: Validate each value in an array custom field separately (#24659) 2024-01-05 14:16:08 -06:00
Daniel Waterworth
7fbbefe363 FIX: Allow setting an array custom field to a singleton value (#24636)
Also, validation happens per item in an array field.
2024-01-05 14:16:08 -06:00
Daniel Waterworth
7f3edcbdc6 DEV: Allow setting max_length for field types using the plugin API (#24635) 2024-01-05 14:16:08 -06:00
Daniel Waterworth
473b7d9a4f DEV: Allow setting different custom field length limits by key (#24505) 2024-01-05 14:16:08 -06:00
Daniel Waterworth
34fe4dfe7c DEV: Refactor save_custom_fields methods (#24495)
Operate a key at a time, to make it clearer what's going on.

This also fixes a bug where array integer fields would get re-written
even when there wasn't a change.
2024-01-05 14:16:08 -06:00
Daniel Waterworth
0404abfe8d DEV: Deprecate array custom fields (#24492)
Array custom fields use separate rows for each value, but whenever we
update an array, we have always destroy the existing rows and create new
ones. Therefore, there's no benefit over using the json type.
2024-01-05 14:16:08 -06:00
Daniel Waterworth
8fd86fbdf7 FIX: Preserve custom field array order (#24491) 2024-01-05 14:16:08 -06:00
Daniel Waterworth
1f69e806a0 DEV: Don't define methods in an included block (#24433) 2024-01-05 14:16:08 -06:00
Daniel Waterworth
0d80290079 DEV: Remove custom field regexes (#24390)
As far as I can tell, this isn't used
2024-01-05 14:16:08 -06:00
Discourse Translator Bot
1a7d8b3842
Update translations (#25089) 2024-01-02 15:26:03 +01:00
Discourse Translator Bot
e33f289356
Update translations (#25042) 2023-12-28 11:33:56 +01:00
Discourse Translator Bot
69c095daf9
Update translations (#24969) 2023-12-19 22:45:32 +01:00
Discourse Translator Bot
d7f7f79b63
Update translations (#24849) 2023-12-12 14:23:56 +01:00
Discourse Translator Bot
223626d7a6
Update translations (#24717) 2023-12-05 14:39:13 +01:00
Discourse Translator Bot
e32cd38268
Update translations (#24600) 2023-11-29 10:41:36 +01:00
Discourse Translator Bot
34eb4a021c
Update translations (#24367) 2023-11-14 14:30:17 +01:00
Krzysztof Kotlarek
4f64a829e5 Bump version to v3.1.3 2023-11-09 14:36:23 +11:00
Ted Johansson
e910dd0914 SECURITY: Prevent Onebox cache overflow by limiting downloads and URL lengths 2023-11-09 13:47:28 +11:00
Penar Musaraj
89a2e60706 SECURITY: Limit height of pre/svg elements
Ensures posts cannot have SVG or PRE elements that are too tall.
2023-11-09 13:47:26 +11:00
Martin Brennan
2c45b949ea SECURITY: Filter unread bookmark reminders the user cannot see
There is an edge case where the following occurs:

1. The user sets a bookmark reminder on a post/topic
2. The post/topic is changed to a PM before or after the reminder
   fires, and the notification remains unread by the user
3. The user opens their bookmark reminder notification list
   and they can still see the notification even though they cannot
   access the topic anymore

There is a very low chance for information leaking here, since
the only thing that could be exposed is the topic title if it
changes to something sensitive.

This commit filters the bookmark unread notifications by using
the bookmarkable can_see? methods and also prevents sending
reminder notifications for bookmarks the user can no longer see.
2023-11-09 13:47:24 +11:00
Roman Rizzi
628b293ff5 SECURITY: Onebox templates' HTML injections (stable).
The use of triple-curlies on Mustache templates opens the possibility for HTML injections.
2023-11-09 13:47:23 +11:00
Krzysztof Kotlarek
24cca10da7 SECURITY: SSRF vulnerability in TopicEmbed
Block redirects when making the final request in TopicEmbed to prevent Server Side Request Forgery (SSRF)
2023-11-09 13:47:21 +11:00
Régis Hanol
2ec2510517 SECURITY: escape display names
Ensure we escape the display names before passing it to the regexp used to update
quotes whenever a user change their display name.
2023-11-09 13:47:20 +11:00
Discourse Translator Bot
332f562703
Update translations (#24269) 2023-11-07 21:31:58 +01:00
Discourse Translator Bot
f6ddfcb46f
Update translations (#24079) 2023-10-24 15:53:39 +02:00
Discourse Translator Bot
ef3f415439
Update translations (#23956) 2023-10-17 11:10:09 -04:00
Penar Musaraj
808ed03993
Bump version to v3.1.2 2023-10-16 11:23:14 -04:00
Alan Guo Xiang Tan
f2e52ed33c
SECURITY: Add a default limit as to when logs should be truncated
Why this change?

This ensures that malicious requests cannot end up causing the logs to
quickly fill up. The default chosen is sufficient for most legitimate
requests to the Discourse application.

When truncation happens, parsing of logs in supported format like
lograge may break down.
2023-10-16 10:51:31 -04:00
Kelvin Tan
628b320087
SECURITY: Prevent unauthorized access to grouped poll results
This adds access controls for the `/polls/grouped_poll_results`
endpoint, such that only users with appropriate permissions can read
the grouped results of a given poll.
2023-10-16 10:51:29 -04:00
Alan Guo Xiang Tan
0b84353162
SECURITY: Prevent arbitrary topic custom fields from being set
Why this change?

The `PostsController#create` action allows arbitrary topic custom fields
to be set by any user that can create a topic. Without any restrictions,
this opens us up to potential security issues where plugins may be using
topic custom fields in security sensitive areas.

What does this change do?

1. This change introduces the `register_editable_topic_custom_field` plugin
API which allows plugins to register topic custom fields that are
editable either by staff users only or all users. The registered
editable topic custom fields are stored in `DiscoursePluginRegistry` and
is called by a new method `Topic#editable_custom_fields` which is then
used in the `PostsController#create` controller action. When an unpermitted custom fields is present in the `meta_data` params,
a 400 response code is returned.

2. Removes all reference to `meta_data` on a topic as it is confusing
   since we actually mean topic custom fields instead.
2023-10-16 10:51:28 -04:00
David Taylor
157a321322
SECURITY: Correctly escape 'text' email preview (stable) 2023-10-16 10:51:26 -04:00
Bianca Nenciu
c9888163d7
SECURITY: Hide user profiles from public
User profiles, including the summary, should be private to anonymous
users if hide_user_profiles_from_public is enabled.
2023-10-16 10:51:25 -04:00
Jan Cernik
265b3dbb4c
SECURITY: Add permissions to MessageBus in chat (stable)
Add spec

compact
2023-10-16 10:51:23 -04:00
Alan Guo Xiang Tan
5d7d607b5f DEV: Add hidden cross_origin_opener_policy_header site setting (#23346)
Why this change?

As part of our ongoing efforts to security harden the Discourse
application, we are adding the `cross_origin_opener_policy_header` site setting
which allows the `Cross-Origin-Opener-Policy` response header to be set on requests
that preloads the Discourse application. In more technical terms, only
GET requests that are not json or xhr will have the response header set.

The `cross_origin_opener_policy_header` site setting is hidden for now
for testing purposes and will either be released as a public site
setting or be remove if we decide to be opinionated and ship a default
for the `Cross-Origin-Opener-Policy` response header.
2023-10-11 14:51:28 -07:00
Discourse Translator Bot
ec9911a48c
Update translations (#23874) 2023-10-11 11:18:08 +02:00
Discourse Translator Bot
4648e5855c
Update translations (#23758) 2023-10-04 09:54:27 +02:00
Discourse Translator Bot
0612f0d5b6
Update translations (#23628) 2023-09-27 11:03:06 +02:00
Roman Rizzi
61b51f9eb6
Bump version to v3.1.1 2023-09-12 18:50:58 -03:00
Bianca Nenciu
5dbe3b7b55
SECURITY: Add limits for themes and theme assets
This commit adds limits to themes and theme components on the:

- file size of about.json and .discourse-compatibility
- file size of theme assets
- number of files in a theme
2023-09-12 15:35:50 -03:00
Gerhard Schlager
2232e15020
SECURITY: Limit number of drafts per user and length of draft_key
The hidden site setting max_drafts_per_user defaults to 10_000 drafts per user.
The longest key should be "topic_<MAX_BIG_INT>" which is 25 characters.
2023-09-12 15:35:47 -03:00
Daniel Waterworth
fed34a330b
SECURITY: Reduce maximum size of SVG sprite cache to prevent DoS
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2023-09-12 15:35:45 -03:00
Daniel Waterworth
ce4c47e76e
PERF: Cache each theme field value once (#23192)
Previously, theme fields from components would be cached for each of
their parent themes.
2023-09-12 15:35:45 -03:00
OsamaSayegh
48316d75cd
SECURITY: Limit name field length of TOTP authenticators and security keys 2023-09-12 15:35:42 -03:00
Discourse Translator Bot
d3c29c02b9
Update translations (#23539) 2023-09-12 15:27:53 +02:00
David Taylor
457b10e68a DEV: Make navigateToTopic more robust for themes/plugins (#22992)
This function was previously expecting multiple services to be injected on any class that uses it. This kind of hidden requirement leads to some very difficult-to-debug situations, so this commit updates the function to lookup all its required services inline.
2023-09-06 08:01:46 -07:00
Jeff Wong
28b632aceb Add plugin outlet for after-panel-body in user menu
Similar to panel-body-bottom but shows up outside the div, and
shows even during EmptyStateComponent is shown.
2023-09-05 18:21:58 -07:00
Jeff Wong
ebbd0a3bc3 FIX: tests 2023-09-05 18:21:21 -07:00