1435 Коммитов

Автор SHA1 Сообщение Дата
Felipe Martin
638007314e [MM-69126] Fix custom emoji upload size and GIF frame limits (#36984) (#37088)
* [MM-69126] Fix custom emoji upload size and GIF frame limits

* Assert 413 status and error ID in oversized emoji test

* Raise max emoji GIF frames to 70

* Enforce emoji GIF frame limit on the direct-write path
2026-06-25 10:05:34 +00:00
Maria A Nunez
2ff29e375b [release-10.11] Tighten thread membership cleanup on team membership changes (#37081)
* Tighten thread membership cleanup on team membership changes (#36764)

* Tighten thread membership cleanup on team membership changes

Ensure ThreadMembership rows are cleaned up when a user is removed
from or leaves a team, add a defense-in-depth filter on the thread
retrieval path so memberships referencing channels the user is no
longer a member of are excluded, and add a one-time migration to
clean up stale records on existing deployments.

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

* Centralize per-channel membership removal and tighten tests

Extract the combined channel-member and thread-membership removal into
a shared helper used by both removeUserFromChannel and LeaveTeam, so
future code paths cannot revoke channel access without dropping the
dependent thread state. The channel-leave event is now logged after
the combined removal completes.

Also drop verbose test header comments and rename a test to a
behavior-focused name.

* Backfill channel members in thread storetest setups

The new ChannelMembers predicate on thread read queries filters out
ThreadMembership rows whose user has no ChannelMembers row for the
thread's channel. Several existing storetest setups bypassed the
normal write path and inserted threads/memberships without channel
members. Add the missing channel-member rows so the test data matches
the real-world invariant.

* Retrigger enterprise CI

Pick up enterprise merge e6953d4 (master into
MM-69008-thread-membership-team-leave) in the combined Enterprise
CI/tests lane, which pins the enterprise SHA at mattermost-side
dispatch time.

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Add MySQL migration for 000195_threadmemberships_cleanup_v2

Co-authored-by: Cursor <cursoragent@cursor.com>

* Apply pre-commit lint fixes

Co-authored-by: Cursor <cursoragent@cursor.com>

* Retrigger CI

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-06-22 13:52:05 -04:00
Julien Tant
acc19baca0 Bound document content extraction time and decouple it from uploads (MM-69098) (#36856) (#37043)
Automatic Merge
2026-06-15 08:35:26 +02:00
Maria A Nunez
f6d3a7827e [release-10.11] MM-69010: Validate incoming webhook user membership (#36917)
Automatic Merge
2026-06-05 09:59:53 +02:00
Maria A Nunez
beaa59db54 [release-10.11] Restrict group_constrained to channels that support group sync (#36916)
Automatic Merge
2026-06-05 09:29:59 +02:00
Maria A Nunez
56098dd6f0 Harden post action request verification (#36840) (#36910)
Automatic Merge
2026-06-05 08:59:59 +02:00
Maria A Nunez
5563e09593 MM-68983: Tighten OAuth token issuance and cleanup on user deactivation (#36743) (#36853)
Automatic Merge
2026-06-03 08:54:16 +02:00
Mattermost Build
d00e9d48d3 Automated cherry pick of #36640 (#36792)
Automatic Merge
2026-06-02 20:24:05 +02:00
Maria A Nunez
24b6762dfb MM-68845: Tighten authorization on /share-channel autocomplete (#36662) (#36808)
Automatic Merge
2026-05-29 16:24:08 +02:00
Harshil Sharma
36ac3a43b1 Edit attachment permission (#36227) (#36723)
Automatic Merge
2026-05-25 12:24:05 +02:00
Julien Tant
d9a55e394c MM-68702: Reject demoting bot accounts to guest (#36487) (#36634)
Automatic Merge
2026-05-20 07:53:39 +02:00
Maria A Nunez
7c09a18ae9 [release-10.11] Cherry pick of #36332 (#36639)
Automatic Merge
2026-05-20 07:23:39 +02:00
Mattermost Build
5b85331de9 Automated cherry pick of #36469 (#36540)
Automatic Merge
2026-05-14 10:23:40 +02:00
Maria A Nunez
202d125afa [release-10.11] MM-68547: Tighten authorization on group syncable link and patch endpoints (#36434)
Automatic Merge
2026-05-06 08:53:51 +02:00
Nick Misasi
977c791e5b MM-68382: Align team creation invite permission checks (#36188) (#36402)
Automatic Merge
2026-05-05 08:23:37 +02:00
Mattermost Build
8000e59335 Automated cherry pick of #36197 (#36382)
* [MM-68393] Tighten protected role patch authorization (#36197)

* [MM-68393] Tighten protected role patch authorization

Harden role patch authorization for protected system roles and cover the restricted paths with focused API tests.

Made-with: Cursor

* [MM-68393] Fix role patch test shadowing

Rename shadowing response variables in the protected role patch tests so govet passes in core and enterprise check-style jobs.

Made-with: Cursor

* [MM-68393] Block privileged role permissions

Made-with: Cursor
(cherry picked from commit 99b73d4c4acf5ff3546c2548a5aaa804c2aa1b04)

* Fix role patch tests for release-10.11 context and LoginSystemManager APIs

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Nick Misasi <nick.misasi@mattermost.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-04 11:04:37 -04:00
David Krauser
9408b98025 Manual cherry pick of #35497 (#36341)
Automatic Merge
2026-05-04 09:17:40 +02:00
Mattermost Build
aba9339a24 Automated cherry pick of #36064 (#36320)
Automatic Merge
2026-05-01 00:17:38 +02:00
Mattermost Build
6fd49f56b5 MM-68526: Harden remote cluster patch response (#36288) (#36313)
Automatic Merge
2026-04-28 20:47:45 +02:00
Mattermost Build
61d68d2d6e MM-68439 Centralize filename handling for FileInfo (#36223) (#36255)
Automatic Merge
2026-04-24 09:17:57 +02:00
Harshil Sharma
5854257739 Manual CP of 35755 for v10.11 (#36135)
Automatic Merge
2026-04-17 21:42:09 +02:00
Alejandro García Montoro
29dd6d0cfd MM-68369: add missing TearDown in TestWebConnRejectBinaryFrameUnauthenticated (#36172)
The test at channels/app/platform/web_conn_test.go was added by #35988
without a defer th.TearDown() call. Setup(t) creates a PlatformService
that opens its own SqlStore pool and runs morph migrations against the
shared temp database. Without TearDown, that pool stays alive until
TestMain exits, so the morph-held idle connections are still attached
to the database when MainHelper.Close runs DROP DATABASE. Postgres
refuses the drop with "is being accessed by other users" and the whole
package panics in teardown.

On master and release-11.4 and later, setupTestHelper registers the
shutdown via tb.Cleanup automatically, so the same test does not leak
there. release-10.11 still uses the manual TearDown pattern, which is
why the fix is scoped to this branch.
2026-04-17 17:27:42 +00:00
Jesse Hallam
73d5f507a4 Cherry-pick Go 1.25.8 upgrade for release-10.11 (#36125)
* ci: shard server Postgres tests into 4 parallel runners (#35739)

* ci: add test sharding plumbing to server CI

Add infrastructure for upcoming test sharding without changing behavior:

- Add shard-index and shard-total inputs to server-test-template.yml
  (defaults preserve existing single-runner behavior)
- Add timing cache restore step (activates only when shard-total > 1)
- Add merge-postgres-test-results job to server-ci.yml that:
  - Merges JUnit XML reports from shard artifacts
  - Saves timing data cache for future shard balancing
  - Handles both single-artifact and multi-shard scenarios
- Add .gitignore entries for timing cache and shard work files

Co-authored-by: Claude <claude@anthropic.com>

* ci: shard server Postgres tests into 4 parallel runners

Extract sharding logic into standalone, tested scripts and enable
4-shard parallel test execution for server Postgres CI:

Scripts:
- server/scripts/shard-split.js: Node.js bin-packing solver that
  assigns test packages to shards using timing data from previous runs.
  Two-tier strategy: light packages (<2min) whole, heavy packages
  (api4, app) split at individual test level.
- server/scripts/run-shard-tests.sh: Multi-run wrapper that calls
  gotestsum directly for each package group with -run regex filters.
- server/scripts/shard-split.test.js: 8 test cases covering round-robin
  fallback, timing-based balancing, heavy package splitting, JUnit XML
  fallback, and enterprise package separation.

Workflow changes:
- server-test-template.yml: Add shard splitting step that discovers test
  packages and runs the solver. Modified Run Tests step to use wrapper
  script when sharding is active.
- server-ci.yml: Add 4-shard matrix to test-postgres-normal. Update
  merge job artifact patterns for shard-specific names.

Performance: 7.2 min with timing cache vs 62.5 min baseline = 88%
wall-time improvement. First run without cache uses JUnit XML fallback
or round-robin, then populates the cache for subsequent runs.

Co-authored-by: Claude <claude@anthropic.com>

* fix: raise heavy package threshold to 5 min to preserve test isolation

sqlstore integrity tests scan the entire database and fail when other
packages' test data is present. At 182s, sqlstore was just over the
120s threshold and getting split at test level. Raising to 300s keeps
only api4 (~38 min) and app (~15 min) as heavy — where the real
sharding gains are — while sqlstore, elasticsearch, etc. stay whole
and maintain their test isolation guarantees.

Co-authored-by: Claude <claude@anthropic.com>

* ci: only save test timing cache on default branch

PR branches always restore from master's timing cache via restore-keys
prefix matching. Timing data is stable day-to-day so this eliminates
cache misses on first PR runs and reduces cache storage.

Co-authored-by: Claude <claude@anthropic.com>

* ci: skip FIPS tests on PRs (enterprise CI handles compile check)

Per review feedback: the enterprise CI already runs a FIPS compile
check on every PR. Running the full FIPS test suite on PRs is redundant
since it uses the identical test suite as non-FIPS — the only
FIPS-specific failure mode is a build failure from non-approved crypto
imports, which the enterprise compile check catches.

Full FIPS tests continue to run on every push to master.

Co-authored-by: Claude <claude@anthropic.com>

* fix: address review feedback on run-shard-tests.sh

- Remove set -e so all test runs execute even if earlier ones fail;
  track failures and exit with error at the end (wiggin77)
- Remove unused top-level COVERAGE_FLAG variable (wiggin77)
- Fix RUN_IDX increment position so report, json, and coverage files
  share the same index (wiggin77)
- Update workflow comment: heavy threshold is 5 min, not 2 min (wiggin77)

Co-authored-by: Claude <claude@anthropic.com>

* style: use node: prefix for built-in fs module in shard-split.js

Co-authored-by: Claude <claude@anthropic.com>

* fix: avoid interpolating file paths into generated shell script

Read shard package lists from files at runtime instead of interpolating
them into the generated script via printf. This prevents theoretical
shell metacharacter injection from directory names, as flagged by
DryRun Security.

Co-authored-by: Claude <claude@anthropic.com>

* fix(ci): rename merged artifact to match server-ci-report glob

The merged artifact was named postgres-server-test-logs-merged which
does not match the *-test-logs pattern in server-ci-report.yml,
causing Postgres test results to be missing from PR/commit reports.

Also pins junit-report-merger to exact version 7.0.0 for supply chain
safety.

Co-authored-by: Claude <claude@anthropic.com>

* fix(ci): pass RACE_MODE env into Docker container

RACE_MODE was set on the host runner but never included in the docker
run --env list. The light-package path worked because the heredoc
expanded on the host, but run-shard-tests.sh reads RACE_MODE at
runtime inside the container where it was unset. This caused heavy
packages (api4, app) to silently lose -race detection.

Co-authored-by: Claude <claude@anthropic.com>

* fix(ci): discover new tests in heavy packages not in timing cache

Tests not present in the timing cache (newly added or renamed) would
not appear in any shard -run regex, causing them to silently skip.
After building items from the cache, run go test -list to discover
current test names and assign any cache-missing tests to shards via
the normal bin-packing algorithm with a small default duration.

Co-authored-by: Claude <claude@anthropic.com>

* fix(ci): add missing line continuation backslash in docker run

The previous --env FIPS_ENABLED line was missing a trailing backslash
after adding --env RACE_MODE, causing docker run to see a truncated
command and fail with "requires at least 1 argument".

Co-authored-by: Claude <claude@anthropic.com>

* fix(ci): add setup-go step for shard test discovery

go test -list in shard-split.js runs on the host runner via execSync,
but Go is only available inside the Docker container. Without this
step, every invocation fails silently and new-test discovery is a
no-op. Adding actions/setup-go before the shard split step ensures
the Go toolchain is available on the host.

Co-authored-by: Claude <claude@anthropic.com>

---------

Co-authored-by: Claude <claude@anthropic.com>

* updated go to version 1.25.8 (#35817)

* updated go to version 1.25.8

* updated gotestsum version to work with go 1.25.8

go 1.25 does not work with indirect tools 0.11 dependency pulled by
gotestsum.

* Use sync.WaitGroup.Go to simplify goroutine creation

Replace the wg.Add(1) + go func() { defer wg.Done() }() pattern with
wg.Go(), which was introduced in Go 1.25.

* pushes fips image on workflow dispatch to allow fips test to run on go version update

* fix new requirements for FIPS compliance imposed on updating to go 1.25.8

* updates openssl symbol check for library shipped with FIPS new versions

go-openssl v2 shipped with FIPS versions starting from 1.25 uses mkcgo to generate
bindings causing symbol names to be different.

* removes temp workflow-dispatch condition

* keep versions out of agents md file

* upgrade golangci-lint (#35845)

* test: clean up channel store data after TestChannelStore (#36066)

TestChannelStore sub-tests create channels, members, and team members
using fake TeamIds and UserIds (model.NewId() for non-existent rows).
These records are left in the database and cause integrity tests
(TestCheck*) running in the same binary to fail their full-table scans.

Register a t.Cleanup on TestChannelStore that purges the affected
tables entirely. A blanket purge is safe: the schema enforces no FK
constraints, and every test suite creates its own data independently.

* Fix command injection in server-test-template workflow (#36080)

Replace the unquoted heredoc (which embedded GITHUB_HEAD_REF into a
generated script) with a cp of the existing run-shard-tests.sh, which
already handles the light-only case. Pass BUILD_NUMBER and TEST_TARGET
as explicit docker env vars instead of interpolating them into script
content.

* fix(ci): restore testname format in sharded gotestsum runs (#36078)

run-shard-tests.sh called gotestsum directly without --format, so it
fell back to gotestsum's default (pkgname) instead of the testname
format set by the Makefile. Pass --format "${GOTESTSUM_FORMAT:-testname}"
to match the Makefile default.

Co-authored-by: Mattermost Build <build@mattermost.com>

* fix(lint): fix pre-existing golangci-lint v2.11.4 issues

Fix misspelling in comment and redundant nil check flagged by the
upgraded linter.

* ci: use golang image for test runner on release-10.11

mattermost-build-server images are not built for release branches.
Use the official golang image which is always available for any Go version.

* ci: use mattermost/mattermost-build-server for release-10.11

The mattermostdevelopment/ images are only built for master.
The production mattermost/ images are built for release branches.

* ci: use mattermost/mattermost-build-server in mmctl test template

The mattermostdevelopment/ images are only built for master.
The production mattermost/ images are built for release branches.

---------

Co-authored-by: Pavel Zeman <pavel.zeman@mattermost.com>
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Carlos Garcia <carlos.garcia@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-16 09:14:15 -03:00
Caleb Roseland
384635216f Update msgpack fork dependency (#35988) (#36043)
(cherry picked from commit 17939826efa20a97f087b3d390ec5136df350bae)

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-16 04:02:45 +00:00
Mattermost Build
610a28e9fa Automated cherry pick of #35562 (#36095)
* adds team member data sanitizing (#35562)

* adds team member data sanitizing

* assert using require

* adds data sanitizing to team members for user endpoint

* team admin data visibility now tests with different user

(cherry picked from commit 2be57a7ec0c67004b77c76386f20a630920196e3)

* removes wrong argument in test helper calls

* fix: add explicit permission grant in team members test (#36007)

* fix: add explicit permission grant in team members test

TestGetTeamMembersForUserRoleDataSanitization was relying on a permission
side-effect leaked from concurrent tests. Under fullyparallel, another test
temporarily adds PermissionReadOtherUsersTeams to system_user role, which
the team admin subtest accidentally benefits from. Under sequential execution
(binary parameters mode), no concurrent test leaks this permission, so the
team admin correctly gets 403.

Fix by explicitly granting ReadOtherUsersTeams in the subtest setup, matching
the pattern used in adjacent subtests.

Release Note
NONE

Co-authored-by: Claude <claude@anthropic.com>

* fix: remove explanatory comment per review feedback

---------

Co-authored-by: Claude <claude@anthropic.com>

* removes extra arg from test helper call

---------

Co-authored-by: Carlos Garcia <carlos.garcia@mattermost.com>
Co-authored-by: Pavel Zeman <pavel.zeman@mattermost.com>
Co-authored-by: Claude <claude@anthropic.com>
2026-04-16 08:58:14 +08:00
Andre Vasconcelos
667dffe31d Improved processing of attachments (#35854) (#36103)
# Conflicts:
#	server/channels/app/slack.go

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-15 22:32:34 +08:00
Harshil Sharma
7526844c50 Fixed URL validation for integration actions (#35857) (#36108)
* Fixed URL validation for integratioon actions

* SImplified check to avoid subpath incompatibility

* minor tweak

* refactored for better tests

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-15 22:32:14 +08:00
Carlos Garcia
b21ef30202 Mm 67896 manual cherry pick onto release 10.11 (#35989)
* improves time limit checks

* consistently check for presence of patch fields

* fix variable shadowing in test

* allow idempotent pinning operations with time limit expired

* new utility function for post limit time check

* fix style issue

* Add missing E2E CI files and delivery-platform migration for release-10.11

- Add calculate-playwright-results and calculate-cypress-results GitHub Actions
  (referenced by e2e-tests-playwright-template.yml and e2e-tests-cypress-template.yml
  but never backported to release-10.11)
- Add e2e-tests/playwright/merge.config.mjs (required by merge-reports step)
- Add run-specs Makefile target and server.run_specs.sh (required by run-failed-tests job)
- Fix merge-shard-results step: pin @playwright/test version and add fallback
  for when no blob reports exist (json reporter output used directly)
- Remove pull_request trigger from e2e-tests-ci.yml (delivery-platform migration)
- Remove dead e2e-fulltests-ci.yml and e2e-tests-ci-template.yml

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

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 18:38:57 +08:00
Christopher Poile
c654f0502f [MM-67143] cherry pick of #34922 (#35800)
Automatic Merge
2026-03-27 07:30:55 +01:00
Mattermost Build
450dba8cad Automated cherry pick of #35558 (#35716)
Automatic Merge
2026-03-20 21:30:55 +01:00
Guillermo Vayá
532f2882d1 [MM-67377] cherry-pick Fix (#35336) (#35657)
Automatic Merge
2026-03-20 12:30:54 +01:00
Ben Cooke
8ef7f78d8d fix conflicts (#35699)
Automatic Merge
2026-03-20 09:00:55 +01:00
Mattermost Build
24a90356e6 Automated cherry pick of #35490 (#35650)
Automatic Merge
2026-03-18 14:30:54 +01:00
Mattermost Build
305be32134 encode special characters on some error pages (#35492) (#35652)
Automatic Merge
2026-03-17 12:01:02 +01:00
Mattermost Build
bc1a2b34b1 keeps plugin config on reenablement (#35545) (#35581)
* keeps plugin config on reenablement

* fixes local config patch on plugin reenablement

(cherry picked from commit c9a4092ac0a20351e3c2e0ac0cb593cc28b5bc0e)

Co-authored-by: Carlos Garcia <carlos.garcia@mattermost.com>
2026-03-16 08:01:26 +02:00
Mattermost Build
a8d44e5918 Use standard session handler for updateUserAuth endpoint (#35488) (#35505)
Automatic Merge
2026-03-06 10:25:23 +01:00
Pablo Vélez
e1a78d1e91 Mm 66813 sso callback metadata (#34955) (#35383)
Automatic Merge
2026-02-20 09:09:32 +02:00
Ibrahim Serdar Acikgoz
e68120775b Cherry pick of a06d506 (#35172) into release-10.11 (#35332)
Automatic Merge
2026-02-17 19:09:27 +02:00
catalintomai
25d7832030 MM-67099 - Membership Sync fix (#35230) (#35329)
Automatic Merge
2026-02-17 18:09:27 +02:00
Mattermost Build
39ba0a3cd7 MM-66886 Add rate limiting to login endpoint (#34943) (#35314)
Automatic Merge
2026-02-16 12:39:39 +02:00
Mattermost Build
eb8c99fe9c Add fileSize limit to extractors (#35200) (#35280)
Automatic Merge
2026-02-13 14:09:32 +02:00
Andre Vasconcelos
053dcf62b6 MM-67372: Improve link preview metadata handling and filtering (#35178) (#35222)
Automatic Merge
2026-02-13 13:09:26 +02:00
Doug Lauder
a8db85c026 Cherry-pick MM-66789 (Include log viewer (system console) in log root path validation) (#35253)
Automatic Merge
2026-02-13 12:09:37 +02:00
Alejandro García Montoro
fddd4a70bc Avoid simple config when doing FTS in Postgres (#35063) (#35179)
This commit reverts PR #30214, which addressed bug MM-60790 but caused a
performance regression tracked by MM-66782.

This revert has two implications:

1. The performance issue is solved.
2. The original bug is re-introduced.

Re-introducing the original bug seems not to be ideal, but I argue that
the original PR did not actually fix the bug:

- Before that PR, looking for a quoted string would return additional
  results: the UX was slightly confusing, because when the user looked
  for the word "stateful", the results would contain matches like
  "states" (see MM-60790).
- After that PR, looking for a quoted string can timeout, so that the
  list of results becomes empty. The UX here may be less confusing,
  since the user simply doesn't find what they're looking for, and they
  may assume that string is not present in any post, but it's completely
  wrong: the result list is empty because the SQL query timed out and
  thus the endpoint returned 0 results.

The solution to the original issue should be addressed via
Elasticsearch, which should provide a more refined and precise search
results.

For more information on the investigation on this issue and the
motivation behind the revert, see
https://mattermost.atlassian.net/wiki/x/IYAk_w

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-02-04 13:00:44 +01:00
Doug Lauder
463f7a0511 Cherry-pick MM-66789: Restrict log downloads to a root path for support packets (#35164)
Automatic Merge
2026-02-02 21:23:28 +02:00
Ibrahim Serdar Acikgoz
d2594e5046 Patch MM-67126 issue (#35142)
Automatic Merge
2026-02-02 12:53:32 +02:00
Mattermost Build
83006ff8ca MM-67279: Fix private channel enumeration via /mute slash command (#35099) (#35149)
Automatic Merge
2026-01-30 18:23:33 +02:00
Christopher Poile
452bad21e9 manual cherry-pick: [MM-67202] Validate auth method in account switch (#34981) (#35143)
* fix account authorization type switch

* improve test clarity

* refactor tests for clarity
2026-01-30 16:36:57 +02:00
Mattermost Build
66fdb3f453 MM-67274: Fix panic in getBrowserVersion with empty User-Agent version (#35098) (#35133)
Automatic Merge
2026-01-30 12:53:37 +02:00
Christopher Poile
f894103741 manual cherrypick: [MM-67074] Integration Action memory use fix (#34896) (#35089)
Automatic Merge
2026-01-28 18:53:28 +02:00