Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates: block nested template executors #1677

Merged

Conversation

SoggySaussages
Copy link
Contributor

@SoggySaussages SoggySaussages commented Jun 20, 2024

This PR blocks looping exec or execAdmin on commands which parse a template (such as moderation actions' Punish
DM or the opening message in a ticket).

Upon executing one of these commands, a new context flag marks it as executed from a command template. If within this
new template one of these commands is used again, its context gets a flag marking it as executed from a nested
command template. Any of the functions executed within a nested command template will fail.

This PR also blocks using execCC within any of these commands' templates. This will likely soon be mollified by the addition of an 'autoScheduleExecCC' function suggested by @jo3-l which will allow users to once again execute CCs
within these commands' templates in a manageable and rate limited fashion.

Signed-off-by SoggySaussages vmdmaharaj@gmail.com

@jo3-l
Copy link
Contributor

jo3-l commented Jun 20, 2024

@SoggySaussages, you may want to rebase this onto dev.

Add a flag for templates which are executed from the templates of
inbuilt commands.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Blocks nested exec/execAdmin calls by passing an
"executedByCommandTemplate" flag through moderation command execution.
When this flag reaches a new context created by a moderation command,
it turns into ExecutedFromNextedCommandTemplate. This flag blocks
moderation commands from running.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Blocks nested exec/execAdmin calls and createTicket calls by passing an
"executedByCommandTemplate" flag through moderation command execution.
When this flag reaches a new context created by a ticket, it turns into
ExecutedFromNextedCommandTemplate. This flag blocks moderation commands
and tickets from running.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
@SoggySaussages SoggySaussages force-pushed the block-nested-template-executors branch from 65f0207 to 2ab2d43 Compare June 20, 2024 21:46
@SoggySaussages
Copy link
Contributor Author

@SoggySaussages, you may want to rebase this onto dev.

Thx, donezo

@ashishjh-bst ashishjh-bst merged commit 39eb40a into botlabs-gg:dev Jun 21, 2024
1 check passed
@SoggySaussages SoggySaussages deleted the block-nested-template-executors branch June 26, 2024 07:57
ashishjh-bst pushed a commit to ashishjh-bst/yagpdb that referenced this pull request Jun 27, 2024
* templates: flag templates executed by inbuilt cmds

Add a flag for templates which are executed from the templates of
inbuilt commands.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* moderation: block nested exec(Admin) calls

Blocks nested exec/execAdmin calls by passing an
"executedByCommandTemplate" flag through moderation command execution.
When this flag reaches a new context created by a moderation command,
it turns into ExecutedFromNextedCommandTemplate. This flag blocks
moderation commands from running.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* tickets: block nested exec(Admin) calls

Blocks nested exec/execAdmin calls and createTicket calls by passing an
"executedByCommandTemplate" flag through moderation command execution.
When this flag reaches a new context created by a ticket, it turns into
ExecutedFromNextedCommandTemplate. This flag blocks moderation commands
and tickets from running.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* moderation: fix nesting detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* tickets: fix nesting detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* templates: block execCC from inbuilt cmd templates

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* moderation: further fix nest detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* tickets: further fix nest detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

---------

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
ashishjh-bst pushed a commit to ashishjh-bst/yagpdb that referenced this pull request Jun 27, 2024
* templates: flag templates executed by inbuilt cmds

Add a flag for templates which are executed from the templates of
inbuilt commands.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* moderation: block nested exec(Admin) calls

Blocks nested exec/execAdmin calls by passing an
"executedByCommandTemplate" flag through moderation command execution.
When this flag reaches a new context created by a moderation command,
it turns into ExecutedFromNextedCommandTemplate. This flag blocks
moderation commands from running.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* tickets: block nested exec(Admin) calls

Blocks nested exec/execAdmin calls and createTicket calls by passing an
"executedByCommandTemplate" flag through moderation command execution.
When this flag reaches a new context created by a ticket, it turns into
ExecutedFromNextedCommandTemplate. This flag blocks moderation commands
and tickets from running.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* moderation: fix nesting detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* tickets: fix nesting detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* templates: block execCC from inbuilt cmd templates

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* moderation: further fix nest detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* tickets: further fix nest detection

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

---------

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
ashishjh-bst added a commit to ashishjh-bst/yagpdb that referenced this pull request Jun 28, 2024
SoggySaussages added a commit to SoggySaussages/yagpdb-main that referenced this pull request Jul 10, 2024
ashishjh-bst pushed a commit that referenced this pull request Aug 28, 2024
* Reapply "templates: block nested template executors (#1677)"

This reverts commit 8b8ebbc.

* Reapply "customcommands: relax restriction on execCC from command templates (#1684)"

This reverts commit 3f743b0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants