Cog-Creators / Cog-Creators/Red-DiscordBot

[Config] Prevent registering defaults for inaccessible identifiers

Open
#6,290 1 comment 0 reactions 1 assignee Claimed by @Kreusada View on GitHub
Category: Core - API - Config Status: In Progress Type: Enhancement
Dominant language
Python
Stars
5.7k
Forks
2.5k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

### What component of Red (cog, command, API) would you like to see improvements on?

Config

### Describe the enhancement you're suggesting.

When registering defaults, we already check that the key is not a [Python identifier](https://github.com/Cog-Creators/Red-DiscordBot/blob/dbd71db6a8392e6fe9b9a8a33501c2595e4f7bac/redbot/core/config.py#L783-L784), however we do not ever check whether the key is an existing attribute of `Group` or `Value` that will cause the `__getattr__` method to never be called. Examples include:
- `default`
- `defaults`
- `identifier_data`
- `is_value`

And more!

A similar check should be added to ensure the key is actually going to be accessible, in order to [prevent confusion](https://discord.com/channels/133049272517001216/160386989819035648/1204854606933393459).

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.