[V3 Permissions] Rule precedence bug. #2313

Closed
opened 2018-11-26 19:42:40 +01:00 by mikeshardmind · 7 comments
mikeshardmind commented 2018-11-26 19:42:40 +01:00 (Migrated from github.com)

Applying a default to a Cog as well as to a command within a Cog (Default deny cog, allow command) does not allow the command.

With current intended precedence, this should allow the command.

Initially reported by <@203619925179236352> (Céli28), confirmed by me and <@218773382617890828> (TrustyJAID)

Applying a default to a Cog as well as to a command within a Cog (Default deny cog, allow command) does not allow the command. With current intended precedence, this should allow the command. Initially reported by <@203619925179236352> (Céli28), confirmed by me and <@218773382617890828> (TrustyJAID)
mikeshardmind commented 2018-11-27 16:16:27 +01:00 (Migrated from github.com)

This appears to just be default rules not playing well. Defaults (for cogs) are not be overridden by other rules which apply in the current context, and additionally, defaults can lock owners out of commands. This might indicate an exception being raised and suppressed silently breaking the expected behavior here based on the intended flow, but I won't have a chance to take a closer look into this until later.

This appears to just be default rules not playing well. Defaults (for cogs) are not be overridden by other rules which apply in the current context, and additionally, defaults can lock owners out of commands. This might indicate an exception being raised and suppressed silently breaking the expected behavior here based on the intended flow, but I won't have a chance to take a closer look into this until later.
celi28 commented 2018-11-29 17:54:41 +01:00 (Migrated from github.com)

Looks related to #2249

Looks related to #2249
Tobotimus commented 2018-11-30 00:15:36 +01:00 (Migrated from github.com)

Thanks for reporting, will look into this and #2249 when I get the chance.

Thanks for reporting, will look into this and #2249 when I get the chance.
mikeshardmind commented 2018-12-02 22:46:19 +01:00 (Migrated from github.com)

I'm not sure it's related to 2249. 2249 being a UX issue that could possibly be caused by this leads me to think that solving this first and seeing if 2249 disappears with it is the best course of action for prioritizing fixes, then fixing that as a separate fix if this is not the case.

I'm not sure it's related to 2249. 2249 being a UX issue that could possibly be caused by this leads me to think that solving this first and seeing if 2249 disappears with it is the best course of action for prioritizing fixes, then fixing that as a separate fix if this is not the case.
mikeshardmind commented 2018-12-16 02:30:36 +01:00 (Migrated from github.com)

After a bunch of testing... Neither I, Toby, or Kowlin have been able to reproduce this anymore on V3/release/3.0.0. I'm closing this, but if anyone can still reproduce it on an up to date bot, please still comment.

After a bunch of testing... Neither I, Toby, or Kowlin have been able to reproduce this anymore on V3/release/3.0.0. I'm closing this, but if anyone can still reproduce it on an up to date bot, please still comment.
mikeshardmind commented 2019-02-05 22:31:25 +01:00 (Migrated from github.com)

Whoo boy, we have a reproduce now.

Thanks? Soulrfit <@142006827155062784>

yaml content collapsed in here.

Guild acl:

COG:
  Admin:
    default: false
    334061410915057664: true
    411874257522393098: true
  Alias:
    default: false
    334061410915057664: true
    411874257522393098: true
  Audio:
    default: false
    334061410915057664: true
    411874257522393098: true
  Cleanup:
    default: false
    334061410915057664: true
    411874257522393098: true
  Core:
    default: false
    334061410915057664: true
    411874257522393098: true
  ErrorLogs:
    default: false
    334061410915057664: true
    411874257522393098: true
  General:
    default: false
    334061410915057664: true
    411874257522393098: true
  Mod:
    default: false
    334061410915057664: true
    411874257522393098: true
  ModLog:
    default: false
    334061410915057664: true
    411874257522393098: true
  NoEpic:
    default: false
    334061410915057664: true
    411874257522393098: true
  Reports:
    464137944815501312: true
  RoleManagement:
    default: false
    334061410915057664: true
    411874257522393098: true
  Spoopy:
    411874257522393098: true
  Streams:
    default: false
    334061410915057664: true
    411874257522393098: true
  SysInfo:
    default: false
    334061410915057664: true
    411874257522393098: true
COMMAND:
  cleanup:
    default: false
    411874257522393098: true
    334061410915057664: true
    415935589368594432: false
    441001661532602378: false
    362235556937334795: false
  customcom:
    default: false
    411874257522393098: true
    334061410915057664: true
  customcom list:
    362235742648532992: false
    362236197860409344: false
    362236325425971201: false
    440978693125439489: true
    520130928169975838: false
  genname:
    374987880592048128: false
  help:
    default: false
    334061410915057664: true
    411874257522393098: true
    440978693125439489: true
  info:
    default: true
  massrole search:
    411874257522393098: true
  now:
    440978693125439489: true
  pause:
    440978693125439489: true
  play:
    440978693125439489: true
  prev:
    440978693125439489: true
  search:
    440978693125439489: true
  skip:
    440978693125439489: true
  spoopy:
    411874257522393098: true
  spoopy check:
    441001661532602378: true
    441002581704310784: true
  stop:
    440978693125439489: true
  uinfo:
    334061410915057664: false
  voiceban:
    411874257522393098: true

There is no global acl set.

Whoo boy, we have a reproduce now. Thanks? Soulrfit <@142006827155062784> <details><summary>yaml content collapsed in here.</summary><p> Guild acl: ```yaml COG: Admin: default: false 334061410915057664: true 411874257522393098: true Alias: default: false 334061410915057664: true 411874257522393098: true Audio: default: false 334061410915057664: true 411874257522393098: true Cleanup: default: false 334061410915057664: true 411874257522393098: true Core: default: false 334061410915057664: true 411874257522393098: true ErrorLogs: default: false 334061410915057664: true 411874257522393098: true General: default: false 334061410915057664: true 411874257522393098: true Mod: default: false 334061410915057664: true 411874257522393098: true ModLog: default: false 334061410915057664: true 411874257522393098: true NoEpic: default: false 334061410915057664: true 411874257522393098: true Reports: 464137944815501312: true RoleManagement: default: false 334061410915057664: true 411874257522393098: true Spoopy: 411874257522393098: true Streams: default: false 334061410915057664: true 411874257522393098: true SysInfo: default: false 334061410915057664: true 411874257522393098: true COMMAND: cleanup: default: false 411874257522393098: true 334061410915057664: true 415935589368594432: false 441001661532602378: false 362235556937334795: false customcom: default: false 411874257522393098: true 334061410915057664: true customcom list: 362235742648532992: false 362236197860409344: false 362236325425971201: false 440978693125439489: true 520130928169975838: false genname: 374987880592048128: false help: default: false 334061410915057664: true 411874257522393098: true 440978693125439489: true info: default: true massrole search: 411874257522393098: true now: 440978693125439489: true pause: 440978693125439489: true play: 440978693125439489: true prev: 440978693125439489: true search: 440978693125439489: true skip: 440978693125439489: true spoopy: 411874257522393098: true spoopy check: 441001661532602378: true 441002581704310784: true stop: 440978693125439489: true uinfo: 334061410915057664: false voiceban: 411874257522393098: true ``` There is no global acl set. </p></details>
Tobotimus commented 2019-02-06 01:23:15 +01:00 (Migrated from github.com)

Ah I misunderstood what the bug was when I last investigated this issue. I thought the bug was that default cog rules were taking precedence over actual model-based rules for commands. I now realise it's for default deny cog, default allow command.

This will also be the case for default deny supercommand, default allow subcommand.

I can see why this is occurring - the reason subcommand rules are able to take precedence over cog/supercommand rules is because when a rule is set, the parent's rules are modified too. This is not the case for default rules, and in fact they essentially follow the same process that was used before the permissions rewrite. However, I don't think it will be hard to incorporate them into the new technique.

Ah I misunderstood what the bug was when I last investigated this issue. I thought the bug was that default cog rules were taking precedence over actual model-based rules for commands. I now realise it's for default deny cog, default allow command. This will also be the case for default deny supercommand, default allow subcommand. I can see why this is occurring - the reason subcommand rules are able to take precedence over cog/supercommand rules is because when a rule is set, the parent's rules are modified too. This is not the case for default rules, and in fact they essentially follow the same process that was used before the permissions rewrite. However, I don't think it will be hard to incorporate them into the new technique.
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#2313
No description provided.