[p]permissions acl setguild is broken for Postgres driver #3796
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#3796
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Command bugs
Command name
[p]permissions acl setguildWhat cog is this command from?
Permissions
What were you expecting to happen?
I expected ACL to be set properly
What actually happened?
The whole ACL for the guild got borked:

defaultand176070082584248320are keys that are result of using[p]permissions acl setguild8represents how it should look - the rule was added with a[p]permissions addguildrule deny 8 57287406247743488command right after setting ACLFor the reference, this is how YAML file given to
[p]permissions acl setguildlooks:How can we reproduce this issue?
Use
[p]permissions acl setguildon a bot using Postgres driver.I looked into this a little bit after a question I got about it. I can replicate the issue, and it appears to be related to use of set raw on a config base group, but I admittedly did not look into this in large detail and am only relaying the minimal amount of looking into this I've already done since I haven't looked further and am unlikely to do so.
Given what I remember about the internals of the drivers, I'd check for proper filling of the identifier info container class in this interaction as a next step should someone else look into this more.
Yeah @mikeshardmind is right, and the issue is actually rather simple. In
config.Group.set_raw(), theIdentifierData.add_identifier()method is being used rather naively, since the primary key can be incomplete.I'd say just add another method:
IdentifierData.get_child(), which recognises whether or not an extra "key" will need to be a primary key or an identifier, then use this inGroup.set_raw()instead.It works by coincidence with the JSON driver because JSON doesn't really have a logical distinction between primary keys and identifiers.