Skip to content

Commit 45d9c37

Browse files
committed
Security patch v2.7.2
1 parent d44d2b0 commit 45d9c37

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# v2.7.2
8+
9+
### Added
10+
- `config options` command to see a list of valid config variables that you can modify.
11+
12+
### Security
13+
Thread channels will now default to being private (@everyone's read message perms set to false) if the thread creation category could not be resolved. This will save you from some trouble if for whatever reason your configuration gets messed up 🌚
14+
715
# v2.7.1
816

917
### Changed

cogs/utility.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,17 @@ async def prefix(self, ctx, *, prefix=None):
367367
@commands.group()
368368
@owner_only()
369369
async def config(self, ctx):
370-
"""Change configuration for the bot.
371-
372-
You shouldn't have to use these commands as other commands such
373-
as `prefix` and `activity` should change config vars for you.
374-
"""
370+
"""Change config vars for the bot."""
375371
if ctx.invoked_subcommand is None:
376372
cmd = self.bot.get_command('help')
377373
await ctx.invoke(cmd, command='config')
374+
375+
@config.command()
376+
async def options(self, ctx):
377+
"""Return a list of valid config keys you can change."""
378+
valid = ', '.join(f'`{k}`' for k in self.bot.config.allowed_to_change_in_command)
379+
em = discord.Embed(title='Valid Keys', description=valid, color=discord.Color.green())
380+
await ctx.send(embed=em)
378381

379382
@config.command(name='set')
380383
async def _set(self, ctx, key: str.lower, *, value):

core/thread.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,21 @@ async def create(self, recipient, *, creator=None, category=None):
411411

412412
self.cache[recipient.id] = thread = Thread(self, recipient)
413413

414+
overwrites = {
415+
self.bot.modmail_guild.default_role: discord.PermissionOverwrite(read_messages=False)
416+
}
417+
# in case it creates a channel outside of category
418+
419+
category = category or self.bot.main_category
420+
421+
if category is not None:
422+
overwrites = None
423+
414424
channel = await self.bot.modmail_guild.create_text_channel(
415425
name=self._format_channel_name(recipient),
416-
category=category or self.bot.main_category
426+
category=category,
427+
overwrites=overwrites,
428+
reason='Creating a thread channel'
417429
)
418430

419431
thread.channel = channel

0 commit comments

Comments
 (0)