mattermost/api/v4/source
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.yaml [MM-68693] Resource level permission policies and new simulation (#36472) 2026-05-21 14:40:05 +02:00
actions.yaml Add Dynamic Select for Interactive Dialog (#33586) 2025-08-28 07:47:28 -06:00
agents.yaml Autotranslations MVP (#34696) 2026-01-26 17:05:34 -05:00
audit_logging.yaml Feature/audit certificate upload (#30223) 2025-04-16 09:34:18 -04:00
boards.yaml Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
bookmarks.yaml Channel Bookmarks (#25449) 2024-03-12 08:36:05 -06:00
bots.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
brand.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
channels.yaml Upgrade Go to 1.26.3 and update deps in tool modules (#36658) 2026-05-20 17:25:49 -04:00
cloud.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
cluster.yaml Update /api/v4/cluster/status docs (#28189) 2024-09-16 17:51:51 +02:00
commands.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
compliance.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
content_flagging.yaml Data spillage report generation (#36339) 2026-05-08 09:27:13 -04:00
custom_profile_attributes.yaml CPA Display Name Support (#36247) 2026-05-04 10:33:05 -04:00
dataretention.yaml [MM-57966]Centralize the 200 maximum page size cap for the per_page parameter and remove individual mentions from API endpoint documentation (#26859) 2024-04-25 21:18:25 +05:30
definitions.yaml [MM-68693] Resource level permission policies and new simulation (#36472) 2026-05-21 14:40:05 +02:00
elasticsearch.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
emoji.yaml Add documentation for get emojis by names API (#24983) 2023-10-17 15:09:26 -04:00
exports.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
files.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
groups.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
imports.yaml MMCTL: Add import delete cmd for removing the import files (#29764) 2025-06-10 12:06:38 +02:00
introduction.yaml Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
ip_filters.yaml [CLD-6324] Cloud IP Filtering (#24726) 2023-11-14 09:12:04 -05:00
jobs.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
ldap.yaml Consistent use of uppercase LDAP tag (#31292) 2026-03-05 19:16:33 +00:00
limits.yaml Added post limit warning (#26793) 2024-04-18 11:50:30 +05:30
logs.yaml MM-57013 Added download button for downloading logs from server logs page in system console (#26389) 2024-06-24 14:05:23 -04:00
metrics.yaml Add 'metrics' tag to /api/v4/client_perf endpoint (#29612) 2025-01-14 09:24:31 +00:00
oauth.yaml OAuth public client improvements (#34435) 2025-11-11 16:57:49 -05:00
outgoing_oauth_connections.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
permissions.yaml Remove deprecated function (#27605) 2024-07-17 16:02:39 -06:00
plugins.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
posts.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
preferences.yaml MM 55199 Limit User Preferences (#25579) 2024-02-01 15:33:24 -07:00
properties.yaml [MM-68777] Add admin property field permission level (#36558) 2026-05-22 11:01:41 -04:00
reactions.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
recaps.yaml Add unread badge to Recaps sidebar link (#36246) 2026-05-06 15:14:18 +02:00
remoteclusters.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
reports.yaml Add cursor-based Posts Reporting API for compliance and auditing (#34252) 2025-11-17 09:02:19 -07:00
roles.yaml Clarify patch role permissions (#30128) 2025-02-21 17:08:58 +02:00
saml.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
scheduled_post.yaml Feature scheduled messages (#28932) 2024-11-04 11:39:35 +05:30
schemes.yaml Update schemes.yaml (#29502) 2024-12-12 12:19:09 +01:00
service_terms.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
sharedchannels.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
status.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
system.yaml MM-68663: Admin console support and Test Connection generalization for Azure Blob Storage (#36583) 2026-05-25 11:36:02 +00:00
teams.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
uploads.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
usage.yaml Update API docs (#36302) 2026-05-11 12:29:25 +02:00
users.yaml [MM-68463] New endpoint to GET user by auth_data (#36352) 2026-05-15 15:26:03 -04:00
views.yaml Adds experimental label to the views endpoints (#36398) 2026-05-06 10:15:49 +02:00
webhooks.yaml Add channel_locked to webhook creation and update docs (#34398) 2025-11-10 13:40:26 -05:00