mattermost/server/channels/api4
Alejandro García Montoro c6b59cc9a7
MM-68663: Admin console support and Test Connection generalization for Azure Blob Storage (#36583)
* Generalize the file storage Test Connection endpoint

Replaces the S3-only /api/v4/file/s3_test handler with a backend-agnostic
POST /api/v4/file/test that validates mandatory fields per driver and
runs a write/read/delete probe against the configured backend. The
legacy /file/s3_test route stays as a thin wrapper so existing clients
keep working.

The driver switch validates S3 and Azure mandatory fields explicitly,
treats Local as a no-op (no required credentials), and rejects unknown
or empty driver names with a 400 and a specific error code so admins
get a useful message instead of a generic backend failure.

Reuses config.Desanitize (renamed from the package-private desanitize)
so the FakeSetting placeholder swap for secrets is shared with the
PUT /api/v4/config save path. Adding a new driver-secret in the future
only requires touching config.Desanitize once. Desanitize is also made
nil-safe on every pointer dereference so callers can hand it a partial
config without first running SetDefaults().

Mattermost-redux and the webapp client gain a corresponding
TestFileStoreConnection method that the admin console action layer
calls instead of the deprecated S3-specific method.

------
AI assisted commit

* Wire Azure Blob Storage into the file storage admin console

Adds the Azure Blob Storage option to the File Storage panel in the
System Console. Selecting it enables Azure-specific fields for the
storage account name, container, optional path prefix, shared key,
optional endpoint override, secure-connections toggle, and request
timeout. The fields are hidden and disabled when the driver is set to
Local or S3, matching the existing pattern.

Help text and placeholders are added in the webapp i18n catalog so
admins see the same field labels documented in the admin guide.

The same set of fields is repeated for the Files Export panel when
DedicatedExportStore is enabled, keeping the export backend
configurable independently of the primary file store.

------
AI assisted commit

* Document /api/v4/file/test in the OpenAPI spec

Adds the new backend-agnostic file storage Test Connection endpoint to
the public OpenAPI surface. The request body is optional: callers that
omit it test the running server configuration, callers that include a
full AdminConfig test the supplied configuration without persisting
anything. The deprecated /api/v4/file/s3_test endpoint is left
unchanged in the spec for the existing S3-only flow.

------
AI assisted commit

* Add UI-only Cypress coverage for the Azure file storage panel

Adds a Cypress spec that drives the System Console File Storage panel,
switches the driver to Azure Blob Storage, fills in the Azure fields,
and asserts the expected fields appear (and S3 fields are hidden). The
spec is UI-only and does not depend on an Azure backend or Azurite, so
it can run in CI without external infrastructure.

Updates the existing environment_spec.js so it tolerates the new Azure
option in the driver dropdown.

------
AI assisted commit

* Nil-guard file storage mandatory-field checks

CheckMandatoryS3Fields and CheckMandatoryAzureFields built a
FileBackendSettings via NewFileBackendSettingsFromConfig before
validating, but that constructor dereferences pointers
unconditionally and would panic if a caller skipped the api
handler's reflective nil check. Validate the required pointers
directly against FileSettings instead, dropping the throwaway
constructor call so the methods are safe to call from any path.

------
AI assisted commit

* Check permission before validating file settings

The /file/test handler ran checkHasNilFields before
SessionHasPermissionTo, so an unauthorized caller posting a partial
config got a 400, leaking config shape, rather than a 403. Swap the two
blocks so the permission decision happens first.

------
AI assisted commit

* Preserve FakeSetting when desanitize has no actual

The Azure access key, export Azure access key, and S3 secret access key
branches in Desanitize reassigned target to actual without checking
actual for nil. When the running config had no value, the FakeSetting
placeholder in target was replaced with nil, dropping the field from the
round-trip. Guard the assignment so the placeholder stays in place when
actual is unset.

------
AI assisted commit

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-05-25 11:36:02 +00:00
..
access_control.go [MM-68693] Resource level permission policies and new simulation (#36472) 2026-05-21 14:40:05 +02:00
access_control_local.go [MM-67126] Deprecate UpdateAccessControlPolicyActiveStatus API in favor of new one (#34940) 2026-01-27 15:49:08 +01:00
access_control_test.go [MM-68693] Resource level permission policies and new simulation (#36472) 2026-05-21 14:40:05 +02:00
agents.go Autotranslations MVP (#34696) 2026-01-26 17:05:34 -05:00
ai_bridge_test_helper.go Ability to E2E AI Bridge features + Initial Recaps E2E (#35541) 2026-03-30 16:20:47 +00:00
ai_bridge_test_helper_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
api.go Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
apitestlib.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
apitestlib_test.go Lower default test console log level from stdlog to debug (#36455) 2026-05-06 16:35:40 -03:00
audit_logging.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
board.go Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
board_test.go Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
bot.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
bot_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
bot_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
brand.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
brand_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
channel.go MM-68763: Discoverable Private Channels — Server feature complete (visibility, ABAC, queue API) (#36580) 2026-05-21 17:10:51 +02:00
channel_bookmark.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
channel_bookmark_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
channel_category.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
channel_category_test.go Generate instead of hard-coding test passwords, enforce new minimum for FIPS, shard CI, fix FIPS builds (#35905) 2026-04-08 16:49:43 -03:00
channel_common_teams_test.go MM-66424: Improve team filtering in common teams API (#34454) 2025-12-15 15:06:48 -04:00
channel_join_request.go MM-68763: Discoverable Private Channels — Server feature complete (visibility, ABAC, queue API) (#36580) 2026-05-21 17:10:51 +02:00
channel_join_request_test.go MM-68763: Discoverable Private Channels — Server feature complete (visibility, ABAC, queue API) (#36580) 2026-05-21 17:10:51 +02:00
channel_local.go [MM-64900] Migrate to use request.CTX instead of context.Context (#33541) 2025-09-18 16:14:24 +02:00
channel_test.go [MM-68693] Resource level permission policies and new simulation (#36472) 2026-05-21 14:40:05 +02:00
cloud.go [MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786) 2026-02-02 13:41:14 +00:00
cloud_test.go [MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786) 2026-02-02 13:41:14 +00:00
cluster.go [MM-29049] Fix remaining errcheck errors in app, api4 and web package (#31307) 2025-06-06 07:44:43 +02:00
cluster_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
command.go Include connection ID in plugin context (#36074) 2026-05-11 10:09:47 +02:00
command_help_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
command_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
command_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
commands_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
compliance.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
config.go keeps plugin config on reenablement (#35545) 2026-03-12 19:36:05 +01:00
config_local.go keeps plugin config on reenablement (#35545) 2026-03-12 19:36:05 +01:00
config_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
content_flagging.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
content_flagging_report.go Data spillage report generation UI (#36340) 2026-05-18 20:24:50 +05:30
content_flagging_report_test.go Data spillage report generation UI (#36340) 2026-05-18 20:24:50 +05:30
content_flagging_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
cors_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
custom_profile_attributes.go [MM-68777] Add admin property field permission level (#36558) 2026-05-22 11:01:41 -04:00
custom_profile_attributes_local.go Adds value endpoints to local mode (#33950) 2025-09-26 10:57:13 +02:00
custom_profile_attributes_test.go Migrate CPA to the v2 Property System (#36180) 2026-05-14 12:46:07 -04:00
data_retention.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
data_retention_test.go Edit attachment permission (#36227) 2026-05-05 08:31:19 +05:30
doc.go Add comprehensive documentation for server/channels layers (#33449) 2025-07-22 11:53:42 +02:00
drafts.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
drafts_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
elasticsearch.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
elasticsearch_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
emoji.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
emoji_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
export.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
export_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
export_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
file.go Data spillage report generation (#36339) 2026-05-08 09:27:13 -04:00
file_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
group.go MM-68547: Tighten authorization on group syncable link and patch endpoints (#36316) 2026-05-05 09:01:56 -04:00
group_local.go Fixed errcheck issues in server/channels/api4/group_local.go (#28417) 2024-10-08 10:47:01 +02:00
group_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
handlers.go MM-66886 Add rate limiting to login endpoint (#34943) 2026-02-13 10:16:24 -08:00
handlers_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
helpers.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
hosted_customer.go [MM-67030] Remove newsletter signup and replace with terms/privacy agreement (#34801) 2026-01-23 18:24:27 +00:00
image.go Fully deprecate /api/v4/image endpoint when image proxy is disabled (#27595) 2024-08-05 12:33:09 +02:00
image_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
import.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
import_local.go MMCTL: Add import delete cmd for removing the import files (#29764) 2025-06-10 12:06:38 +02:00
import_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
integration_action.go Add inline action buttons for bot-posted markdown (#36219) 2026-05-20 13:34:44 -06:00
integration_action_test.go Add inline action buttons for bot-posted markdown (#36219) 2026-05-20 13:34:44 -06:00
ip_filtering.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
ip_filtering_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
job.go E2E/Playwright: balance shard timing by enabling fullyParallel in CI (#36054) 2026-05-08 21:04:32 +00:00
job_local.go [MM-63556] mmctl: Add compliance export download cmd (#30576) 2025-06-24 16:27:54 -04:00
job_test.go E2E/Playwright: balance shard timing by enabling fullyParallel in CI (#36054) 2026-05-08 21:04:32 +00:00
ldap.go [MM-64320] Remove deprecated include_removed_members option in api/v4/ldap/sync (#31121) 2025-07-17 12:35:08 +02:00
ldap_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
ldap_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
license.go MM-63368: Remove MySQL (#33458) 2025-07-22 20:40:55 +05:30
license_local.go [MM-67114] Add mmctl license get command (#34878) 2026-02-10 08:26:59 +01:00
license_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
limits.go Add single-channel guest tracking and reporting (#35451) 2026-03-10 10:31:10 -04:00
limits_test.go Add single-channel guest tracking and reporting (#35451) 2026-03-10 10:31:10 -04:00
main_test.go MM-63368: Remove MySQL (#33458) 2025-07-22 20:40:55 +05:30
metrics.go MM-60283 Add standard response and API docs to /client_perf API (#28124) 2024-09-10 21:11:05 +00:00
metrics_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
notify_admin.go [MM-54024] Handle JSON nulls when unmarshalling in api4 (#24656) 2023-10-05 19:25:59 +05:30
notify_admin_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
oauth.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
oauth_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
outgoing_oauth_connection.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00:00
outgoing_oauth_connection_test.go MM-68150: Upgrade golangci-lint to v2.12.2 (#36554) 2026-05-14 17:29:37 -04:00
permission.go errcheck issues fixed (#28475) 2024-10-04 19:12:32 +02:00
permissions_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
plugin.go [MM-65822] Add directory conflict checks for plugin and import uploads (#34681) 2026-03-03 16:31:05 -04:00
plugin_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
plugin_test.go [MM-65822] Add directory conflict checks for plugin and import uploads (#34681) 2026-03-03 16:31:05 -04:00
post.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
post_create_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
post_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
post_test.go [MM-68693] Resource level permission policies and new simulation (#36472) 2026-05-21 14:40:05 +02:00
post_utils.go Edit attachment permission (#36227) 2026-05-05 08:31:19 +05:30
post_utils_test.go Edit attachment permission (#36227) 2026-05-05 08:31:19 +05:30
preference.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
preference_local.go MM-56819: Introduce --local mode in MMCTL to handle user preferences. (#26972) 2024-09-09 14:12:22 +02:00
preference_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
properties.go [MM-68777] Add admin property field permission level (#36558) 2026-05-22 11:01:41 -04:00
properties_test.go [MM-68777] Add admin property field permission level (#36558) 2026-05-22 11:01:41 -04:00
ratelimit_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
reaction.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
reaction_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
recap.go Add unread badge to Recaps sidebar link (#36246) 2026-05-06 15:14:18 +02:00
remote_cluster.go MM-68526: Harden remote cluster patch response (#36288) 2026-04-28 10:29:21 -04:00
remote_cluster_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
report.go Add single-channel guests filter and channel count column to System Console Users (#35517) 2026-03-12 12:50:53 -04:00
report_test.go Add single-channel guests filter and channel count column to System Console Users (#35517) 2026-03-12 12:50:53 -04:00
role.go [MM-68393] Tighten protected role patch authorization (#36197) 2026-05-01 17:20:04 +03:00
role_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
role_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
saml.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
saml_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
scheduled_post.go Add guards to avoid cards being created when the integrated boards feature flag is disabled (#35836) 2026-03-27 08:51:29 -07:00
scheduled_post_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
scheme.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
scheme_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
shared_channel.go MM-66162: harden GET /sharedchannels/{id}/remotes error path and add WS guard (#36696) 2026-05-22 09:59:15 -04:00
shared_channel_metadata_test.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
shared_channel_remotes_test.go MM-66162: harden GET /sharedchannels/{id}/remotes error path and add WS guard (#36696) 2026-05-22 09:59:15 -04:00
shared_channel_test.go Strip remote_id field from user patch API requests (#36008) 2026-04-10 09:40:08 -07:00
shared_channel_test_utils.go MM-68179: Run sendLoop workers on all HA nodes (#35909) 2026-04-07 18:49:54 +02:00
status.go Ensure users status is set to offline when deactivated (#30900) 2025-05-29 10:41:14 +02:00
status_test.go fix(tests): re-enable 10 flaky tests across 12 JIRA tickets (#36159) 2026-04-20 16:48:32 -04:00
system.go MM-68663: Admin console support and Test Connection generalization for Azure Blob Storage (#36583) 2026-05-25 11:36:02 +00:00
system_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
system_test.go MM-68663: Admin console support and Test Connection generalization for Azure Blob Storage (#36583) 2026-05-25 11:36:02 +00:00
team.go MM-68149: Upgrade to Go 1.26.2 (#36418) 2026-05-12 15:59:12 +00:00
team_guest_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
team_local.go [MM-66838] Update throttled library to v2.15.0 with Go modules support (#34657) 2026-03-19 11:36:19 +01:00
team_test.go Fix flaky TestPatchTeam GroupConstrained subtest (#36689) 2026-05-22 08:38:27 -04:00
terms_of_service.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
terms_of_service_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
upload.go [MM-65822] Add directory conflict checks for plugin and import uploads (#34681) 2026-03-03 16:31:05 -04:00
upload_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
upload_test.go [MM-65822] Add directory conflict checks for plugin and import uploads (#34681) 2026-03-03 16:31:05 -04:00
usage.go [MM-60932] Fix errcheck issues in server/channels/api4/usage.go (#28641) 2024-10-09 11:53:25 +02:00
usage_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
user.go MM-68419: Add expires_at to PAT data model and enforce expiry at token validation (#36243) 2026-05-22 10:30:30 +02:00
user_local.go [MM-68463] New endpoint to GET user by auth_data (#36352) 2026-05-15 15:26:03 -04:00
user_test.go MM-68702: Reject demoting bot accounts to guest (#36487) 2026-05-18 09:01:00 -07:00
user_viewmembers_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
view.go Merge the Integrated Boards MVP feature branch (#35796) 2026-03-27 10:36:35 +01:00
view_test.go Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
webhook.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
webhook_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
webhook_test.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00:00
websocket.go [MM-64244] Add websocket disconnect reason metric (#31032) 2025-05-30 08:15:20 -04:00
websocket_norace_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
websocket_test.go Generate instead of hard-coding test passwords, enforce new minimum for FIPS, shard CI, fix FIPS builds (#35905) 2026-04-08 16:49:43 -03:00