Skip to content

MM-67398 Added checks for instance and webhooks commands#635

Open
avasconcelos114 wants to merge 3 commits intomasterfrom
MM-67398
Open

MM-67398 Added checks for instance and webhooks commands#635
avasconcelos114 wants to merge 3 commits intomasterfrom
MM-67398

Conversation

@avasconcelos114
Copy link
Contributor

Summary

This PR adds extra checks when processing slash commands

Ticket Link

Closes https://mattermost.atlassian.net/browse/MM-67398

@avasconcelos114 avasconcelos114 self-assigned this Feb 2, 2026
@avasconcelos114 avasconcelos114 added the 2: Dev Review Requires review by a core committer label Feb 2, 2026
@avasconcelos114 avasconcelos114 requested a review from a team as a code owner February 2, 2026 18:15
@avasconcelos114 avasconcelos114 added the 3: QA Review Requires review by a QA tester label Feb 2, 2026
Copy link

@nevyangelova nevyangelova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @avasconcelos114 a couple of comments


if !isSysAdmin {
p.postCommandResponse(args, "Only System Admins are allowed to manage instances.", true)
return &model.CommandResponse{}, nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Use return p.getCommandResponse(args, ...) here to match the pattern in handleWebhookHandler


_, _ = p.handleInstallInstance(args, []string{})

assert.Contains(t, capturedMessage, "Only System Admins are allowed to set up the plugin.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this calls handleInstallInstance directly but the new permission check is in handleInstance. Is the existing check in handleInstallInstance now redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, this PR moved the sysadmin check higher up the chain which renders the additional checks that exist solely in handleInstallInstance unnecessary, I'll remove that and update tests to reflect this

@avasconcelos114 avasconcelos114 added the 3: Security Review Review requested from Security Team label Feb 5, 2026
@avasconcelos114 avasconcelos114 removed the 3: QA Review Requires review by a QA tester label Feb 5, 2026
Copy link
Member

@marianunez marianunez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @avasconcelos114!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer 3: Security Review Review requested from Security Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants