Commit graph

35 commits

Author SHA1 Message Date
Nick Misasi
453ab3dc74 feat(12-01): start gRPC PluginAPI server for Python plugins
- Add startAPIServer function to start gRPC server on random port
- Add APIServerRegistrar type to break import cycle with apiserver package
- Modify WithCommandFromManifest to accept apiImpl and registrar
- Update configurePythonCommand to start API server and set MATTERMOST_PLUGIN_API_TARGET env var
- Add apiServerCleanup field to supervisor struct for cleanup on shutdown
- Add SetAPIServerRegistrar method to Environment for dependency injection
- Wire up API server registrar in app/plugin.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 09:46:34 -05:00
Ben Schumacher
d78d59babe
Standardize request.CTX parameter naming to rctx (#33499)
* Standardize request.CTX parameter naming to rctx

- Migrate 886 request.CTX parameters across 147 files to use consistent 'rctx' naming
- Updated function signatures from 'c', 'ctx', and 'cancelContext' to 'rctx'
- Updated function bodies to reference the new parameter names
- Preserved underscore parameters unchanged as they are unused
- Fixed method receiver context issue in store.go

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use request.CTX interface in batch worker

* Manual fixes

* Fix parameter naming

* Add linter check

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-10 15:11:32 +02:00
Julien Tant
ec4a6235d4
MM-64518: Update Playbooks license requirements from Enterprise to Professional+ and unprepackage playbooks v1 (#31323)
* Remove TestPlaybooksLicenseChecking test function

Co-Authored-By: Claude <noreply@anthropic.com>

* fix test

* Remove playbooks v1 from prepackaged plugins

- Remove mattermost-plugin-playbooks-v1.41.1 from Makefile
- Remove license-based logic for choosing between playbooks v1/v2
- Remove obsolete test TestGetPrepackagedPlaybooksPluginIn
- Clean up transitionally prepackaged plugins logic
- Only ship playbooks v2.3.0 as regular prepackaged plugin

* Fix formatting with gofmt

* Fix linting issues

- Fix formatting in plugin_test.go
- Remove unnecessary blank line in plugin.go
- Use slices.Contains instead of manual loop

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-08-27 13:07:31 -07:00
Jesse Hallam
5c3a67b110
MM-62746: drop manual plugin deployment support (#30019)
We no longer support system administrators  manually unpacking plugins into the server's working directory for plugins. Instead, the server will be free to remove folders and files from this directory at will as it synchronizes installed plugins from the prepackaged cache and filestore.

Fixes: https://mattermost.atlassian.net/browse/MM-62746

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-07-16 01:46:41 +00:00
Jesse Hallam
60a747f975
Always require signatures for prepackaged plugins (#31785)
* Always require signatures for prepackaged plugins

We have always required signatures for packages installed via the marketplace -- whether remotely satisfied, or sourced from the prepackaged plugin cache.

However, prepackaged plugins discovered and automatically installed on
startup did not require a valid signature. Since we already ship
signatures for all Mattermost-authored prepackaged plugins, it's easy to
simply start requiring this.

Distributions of Mattermost that bundle their own prepackaged plugins
will have to include their own signatures. This in turn requires
distributing and configuring Mattermost with a custom public key via
`PluginSettings.SignaturePublicKeyFiles`.

Note that this enhanced security is neutered with a deployment that uses
a file-based `config.json`, as any exploit that allows appending to the
prepackaged plugins cache probably also allows modifying `config.json`
to register a new public key. A [database-based
config](https://docs.mattermost.com/configure/configuration-in-your-database.html)
is recommended.

Finally, we already support an optional setting
`PluginSettings.RequirePluginSignature` to always require a plugin
signature, although this effectively disables plugin uploads and
requires extra effort to deploy the corresponding signature. In
environments where only prepackaged plugins are used, this setting is
ideal.

Fixes: https://mattermost.atlassian.net/browse/MM-64627

* setup dev key, expect no plugins if sig fails

* Fix shadow variable errors in test helpers

Pre-declare signaturePublicKey variable in loops to avoid shadowing
the outer err variable used in error handling.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Replace PrepackagedPlugin.Signature with SignaturePath for memory efficiency

- Changed PrepackagedPlugin struct to use SignaturePath string instead of Signature []byte
- Updated buildPrepackagedPlugin to use file descriptor instead of reading signature into memory
- Modified plugin installation and persistence to read from signature file paths
- Updated all tests to check SignaturePath instead of Signature field
- Removed unused bytes import from plugin.go

This change reduces memory usage by storing file paths instead of signature data
in memory while maintaining the same security verification functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-24 15:11:02 -03:00
Harshil Sharma
a9f09cadc2
Premium SKU (#30396)
* Added premium SKU

* removed duplicate enterprise license check functions

* Added license check on API layer

* lint fix

* lint fix

* refactured signature:

* test: Add comprehensive tests for license tier check functions

* fixed test

* text update

* optimised license checks

* fixedf test

* Updated license valid function

* webapp license checks

* handling prekium SKU in webappp:

* added plugin api method and general refactoring

* Updated tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-04-03 13:07:54 +05:30
Alejandro García Montoro
350714f390
Bump Go to v1.23.7 (#30455)
* Update Go version to v1.23.7

* Bump golangci-lint to a version supporting Go 1.23

* Fix golangci-lint warnings

Several rules from gosimple, revive and staticcheck linters were
failing:
- Redefinition of built-in identifiers (max, min, new, recover...)
- Use of printf-like functions with simple strings
- Check for nil slices, when len already takes it into account

* Trigger Build

* Trigger Build

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-03-17 14:22:07 +01:00
Agniva De Sarker
ac10bb12a5
Revert "Bump Go version to 1.23.6 (#30242)" (#30359)
This reverts commit acbbd4c58d.
2025-02-27 14:58:51 +05:30
Alejandro García Montoro
acbbd4c58d
Bump Go version to 1.23.6 (#30242)
* Bump Go version to 1.23.6

* Update CodeQL Github action as well

* Use server's Go version for CodeQL action

Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>

* Empty commit to trigger CI

* Bump golangci-lint to a version supporting Go 1.23

* Fix golangci-lint warnings

Several rules from gosimple, revive and staticcheck linters were
failing:
- Redefinition of built-in identifiers (max, min, new, recover...)
- Use of printf-like functions with simple strings
- Check for nil slices, when len already takes it into account

---------

Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-02-26 16:43:04 +01:00
Doug Lauder
09ff43acc6
Remove channel export plugin from transitional plugins list. Channel export plugin is now prepackaged. (#30193)
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-02-24 11:39:34 -05:00
Ben Schumacher
053d0b5f0a
[MM-61140] Allow plugins to add Support Packet data without UI elements (#28833)
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2024-11-13 11:20:39 +01:00
Scott Bishel
0048723ccd
MM-60679 - Validate playbook plugin version, based on license (#28366)
Automatic Merge
2024-10-02 20:14:32 +02:00
Ben Schumacher
70fe2abea6
[MM-57194] Allow plugins to mark setting fields as secret (#27986)
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2024-09-12 19:23:57 +02:00
Julien Tant
5f19d8513b
[MM-60026] Add playbooks <v2 in the transitionaslly packaged list (#27903) 2024-08-14 10:22:18 -07:00
Julien Tant
06d8c857ea
[MM-60025][MM-59522] Add playbooks v2 to prepackaged plugins (#27862)
* add playbooks v2 to prepackaged plugins

* Update Makefile
2024-08-07 14:17:10 -07:00
Claudio Costa
453eabb54a
Fully deprecate CallsEnabled feature flag (#27826)
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-08-01 07:41:46 +00:00
Julien Tant
5547504c1d
[MM-58378] Prevent prepackaged playbook v2 from upgrading on servers without enterprise license (#27335)
* add check for playbooks v2

* add new license helper

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-07-26 11:03:44 +02:00
Ben Schumacher
30d450c4d8
Cleanup usage of global logger (#26835) 2024-04-24 11:52:33 +02:00
Ben Schumacher
de3e5aab25
[MM-53156] Remove Multi-Product architecture (#25669) 2024-02-15 13:01:44 +01:00
Ben Schumacher
c7461751f2
Use request.CTX instead of *request.Context (#24877)
* Use request.CTX instead of *request.Context

* Fix tests
2023-10-30 16:33:37 +01:00
Caleb Roseland
9a3b503169
MM-54505: re-enable remote marketplace functionality (#24561) 2023-09-15 12:17:53 -05:00
Felipe Martin
9f7521d003
Move request package into public/shared folder (#24420)
* move request package to public/shared

* updated app-layers

* update app layer

* remove original package location
2023-09-05 09:47:30 +02:00
Caleb Roseland
818225dffe
MM-52981, MM-53559: Streamlined in-product marketplace (#24311) 2023-08-25 14:39:25 -05:00
Ben Schumacher
f231124f2d
Update to github.com/blang/semver/v4 (#24203) 2023-08-21 11:29:12 +02:00
Jesse Hallam
ad142c958e
MM-53355: install transitionally prepackaged plugins to filestore (#24225)
* move plugin signature verification to caller

The semantics for when plugin signature validation is required are unique to the caller, so move this logic there instead of masking it, thus simplifying some of the downstream code.

* support transitionally prepacked plugins

Transitionally prepackaged plugins are prepackaged plugins slated for unpackaging in some future release. Like prepackaged plugins, they automatically install or upgrade if the server is configured to enable that plugin, but unlike prepackaged plugins they don't add to the marketplace to allow for offline installs. In fact, if unlisted from the marketplace and not already enabled via `config.json`, a transitionally prepackaged plugin is essentially hidden.

To ensure a smooth transition in the future release when this plugin is no longer prepackaged at all, transitionally prepackaged plugins are persisted to the filestore as if they had been installed by the enduser. On the next restart, even while the plugin is still transitionally prepackaged, the version in the filestore will take priority. It remains possible for a transitionally prepackaged plugin to upgrade (and once again persist) if we ship a newer version before dropping it altogether.

Some complexity arises in a multi-server cluster, primarily because we don't want to deal with multiple servers writing the same object to the filestore. This is probably fine for S3, but has undefined semantics for regular filesystems, especially with some customers backing their files on any number of different fileshare technologies. To simplify the complexity, only the cluster leader persists transitionally prepackaged plugins.

Unfortunately, this too is complicated, since on upgrade to the first version with the transitionally prepackaged plugin, there is no guarantee that server will be the leader. In fact, as all nodes restart, there is no guarantee that any newly started server will start as the leader. So the persistence has to happen in a job-like fashion. The migration system might work, except we want the ability to run this repeatedly as we add to (or update) these transitionally prepackaged plugins. We also want to minimize the overhead required from the server to juggle any of this.

As a consequence, the persistence of transitionally prepackaged plugins occurs on every cluster leader change. Each server will try at most once to persist its collection of transitionally prepackaged plugins, and newly started servers will see the plugins in the filestore and skip this step altogether.

The current set of transitionally prepackaged plugins include the following, but this is expected to change:
* focalboard

* complete list of transitionally prepackaged plugins

* update plugin_install.go docs

* updated test plugins

* unit test transitionally prepackged plugins

* try restoring original working directory

* Apply suggestions from code review

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* clarify processPrepackagedPlugins comment

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
2023-08-17 12:46:57 -03:00
Jesse Hallam
7818d5a348
plugins: further logging tweaks, fixes (#24229)
Fix a logging issue for prepackaged plugins error handling trying to reference a `nil` pointer.

Relates-to: https://mattermost.atlassian.net/browse/MM-53355
2023-08-09 11:54:41 -03:00
Jesse Hallam
8372267739
MM-53355: tidy up plugins (#24194)
* remove feature flag managed plugins

* remove unneeded plugin blocklist

* remove unnecessary wrappers

* documentation and logging improvements

* avoid use of global logger
* leverage wrapped loggers (e.g. consistently log `plugin_id`)
* promote some logs from `Debug` to `Info` for better visibility.
* extract installPluginToFilestore
* rename some variables for consistency / clarity

* make generated
2023-08-08 18:29:57 -03:00
Jesse Hallam
d9edb84523
Revert s3 path prefix normalization for plugins (#24184)
This reverts 0af0a4eff4. During the [implementation](https://github.com/mattermost/mattermost/pull/15910) we [discussed](https://github.com/mattermost/mattermost/pull/15910#issuecomment-705925227) fixing the underlying issue. When we did [fix](https://github.com/mattermost/mattermost/pull/15949) the underlying issue, we didn't revert these changes.

Revert it now to simplify the code.
2023-08-04 11:24:53 -03:00
Jesse Hallam
8abc8ed65c
MM-53358: Revert Threads Everywhere (#23882)
Remove changes related to the unshipped threads everywhere feature, including commits b8da473da7 and 9f9e19e05d.

Since a version of Playbooks shipped calling this experimental API, keep a `nil` implementation to avoid breaking compatibility. We remove the hooks altogether, but keep the numbering again to avoid breaking compatbility.

Fixes: https://mattermost.atlassian.net/browse/MM-53358
2023-06-30 15:31:25 -03:00
Agniva De Sarker
efaa6264cc
MM-53032: Fix module path after repo rename (#23689)
It was a good decision in hindsight to keep the public module as 0.x
because this would have been a breaking change again.

https://mattermost.atlassian.net/browse/MM-53032
```release-note
Changed the Go module path from github.com/mattermost/mattermost-server/server/v8 to github.com/mattermost/mattermost/server/v8.

For the public facing module, it's path is also changed from github.com/mattermost/mattermost-server/server/public to github.com/mattermost/mattermost/server/public
```
2023-06-11 10:54:35 +05:30
Jesse Hallam
bb02b35048
Expose public/ API as submodule (#23345)
* model -> public/model

* plugin -> public/plugin

* public/model/utils -> public/utils

* platform/shared/mlog -> public/shared/mlog

* platform/shared/i18n -> public/shared/i18n

* platform/shared/markdown -> public/shared/markdown

* platform/services/timezones -> public/shared/timezones

* channels/einterfaces -> einterfaces

* expose public/ submodule

* go mod tidy

* .github: cache-dependency-path, setup-go-work

* modules-tidy for public/ too

* remove old gomodtidy
2023-05-10 13:07:02 -03:00
Harrison Healey
d001994ef9
MM-52282 Remove ExperimentalSettings.PatchPluginsReactDOM (#23172)
* MM-52282 Remove ExperimentalSettings.PatchPluginsReactDOM

* Fix missing file from last commit

* Fix test usage of plugin.NewEnvironment
2023-05-03 15:04:10 -04:00
Agniva De Sarker
b200a07881
v8.0 module release (#22975)
https://mattermost.atlassian.net/browse/MM-52079

```release-note
We upgrade the module version to 8.0. The new module path is github.com/mattermost-server/server/v8.
```


Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2023-04-18 11:05:28 +05:30
Agniva De Sarker
470e4c9d66
MM-51786: Sentry crash while installing a blocked plugin (#22804)
We would return "nil, nil" if a plugin was on the blocklist.
This would cause a nil dereference panic while trying to add
struct fields from manifest to the audit logs.

To avoid it, we return an error explicitly and ignore the
error ids to unnecessarily have it log an error.

https://mattermost.atlassian.net/browse/MM-51786

```release-note
NONE
```
2023-04-14 13:32:05 +05:30
Doug Lauder
c943ed6859
Mono repo -> Master (#22553)
Combines the following repositories into one:

https://github.com/mattermost/mattermost-server
https://github.com/mattermost/mattermost-webapp
https://github.com/mattermost/focalboard
https://github.com/mattermost/mattermost-plugin-playbooks
2023-03-22 17:22:27 -04:00