Commit Graph

3204 Commits

Author SHA1 Message Date
Jesse Hallam
0788cdcadf MM-11420: plugins: compute bundle hash on load (#9172)
* plugins: compute bundle hash on load

Use this hash to bust client caches whenever the plugin bundle changes.

* eliminate redundant pluginHandler

* switch to 64-bit FNV-1a

* Fix test
2018-07-31 16:29:52 -04:00
Christopher Speller
82dfe9e61d Adding support for code split plugins. (#9184) 2018-07-31 07:44:44 -07:00
Chris Duarte
3fcecd521a Support for Embeded chat (#9129)
* Add ucLive support

crazy testing

lovely logs

more cookie work arounds

Added Access-Control-Expose-Headers to user login

Add complete_saml_body template and revert loginWithSaml endpoint

Set Access-Control-Allow-Credentials to true in user login

Login via email instead of username

Clean up code

Add comment to give some context

Move faml logic into saml function

Communicate via chrome sendMessage api

Remove unused code

Add config to support multiple extensions

Clean up embedded complete_saml template

Fix indentation for templates

Added license header to extension.go

Add EnableExperimentalExtensions flag

Extension validated for email auth

Clean up api auth code

Remove complete_saml_body.html

* Add extension support in saml

* Clean up code

* Clean up extension validation
2018-07-18 14:56:38 -07:00
cpanato
adc56ae78d Merge remote-tracking branch 'upstream/release-5.1' into release-5.1-daily-merge-20180712 2018-07-12 19:50:16 +02:00
Jesse Hallam
7c08ff9986 MM-11241: fix context site url header (#9079)
* fix context's SiteURLHeader to use the subpath

This fixes various commands such as /open and /groupmsg, as well as
OAuth related redirects.

* MM-11246: also leverage GetSiteHeader() in completeSaml
2018-07-11 10:13:37 +02:00
JoramWilander
b78b216a3c Merge branch 'master' into plugins-2 2018-07-07 12:04:18 -04:00
Christopher Speller
4c1ddcff10 MM-10703 Adding blank request context to plugin hooks for future use. (#9043)
* Adding blank request context to plugin hooks for future use.

* Rename RequestContext to Context

* Adding context to ServeHTTP and ExecuteCommand

* Fixing import cycle in test.
2018-07-06 09:07:09 -04:00
George Goldberg
0896b5c64e MM-11106: Allow systeadmin webook to post to read only town square. (#9051) 2018-07-06 10:07:36 +02:00
Jesús Espino
85aa3d664c MM-11034: Reply properly to incomming webhooks on errors (#9010) 2018-06-26 17:04:06 -04:00
Joram Wilander
1c194e5fbd Fix plugins serving after subpath changes (#8982) 2018-06-22 22:09:31 -04:00
Jesse Hallam
dd35ad43ca MM-10370: serve subpath (#8968)
* factor out GetSubpathFromConfig

* mv web/subpath.go to utils/subpath.go

* serve up web, api and ws on /subpath if configured

* pass config to utils.RenderWeb(App)?Error

This allows the methods to extract the configured subpath and redirect
to the appropriate `/subpath/error` handler.

* ensure GetSubpathFromConfig returns trailing slashes deterministically

* fix error 404 handling

* redirect /subpath to /subpath/

This is necessary for the static handler to match, otherwise none of the
registered routes find anything. This also makes it no longer necessary
to add trailing slashes in the root router.
2018-06-21 11:31:51 -07:00
cpanato
8883f48788 Merge remote-tracking branch 'upstream/release-5.0' into release-5.0-merge-to-master-20180614-1 2018-06-14 18:46:19 +02:00
Jesse Hallam
f106417103 MM-10367: rewrite subpath assets on startup (#8944)
Examine ServiceSettings.SiteURL on startup and rewrite assets
accordingly if not in a development environment.

Also export `mattermost config subpath` command to manually do same.

This accompanies a webapp PR to use the updated `root.html` to define
the necessary webpack asset path for dynamically loading assets.
2018-06-14 08:26:22 -07:00
Jesús Espino
695c5d6bf8 MM-10863: Handle non-API errors with redirect to webapp (#8943)
* MM-10863: Handle non-API errors with redirect to webapp

* Properly shutdown the app in the new test
2018-06-14 09:00:40 +02:00
Christopher Speller
2c75247c97 MM-10348 Adding experimental hardened mode. (#8881)
* Adding experimental hardened mode.

* Sanitizing all 500 errors.
2018-06-04 09:48:26 -07:00
Christopher Speller
ebdceb8e52 Adding mlog to context. (#8882) 2018-06-01 13:07:56 -07:00
Jesús Espino
e88fe4bb1d MM-8853: Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS permissions (#8860)
* MM-8853: Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS permissions

* MM-8853: Removing unnecesary emoji enterprise feature

* Create emojis migration

* Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS always to system admins

* Simplifing permissions checks

* Revert "Simplifing permissions checks"

This reverts commit e2cafc1905.
2018-05-29 15:58:12 +01:00
Martin Kraft
f40666f9e8 Merge branch 'master' into advanced-permissions-phase-2 2018-05-22 14:15:54 -04:00
George Goldberg
8fb070fecf MM-10352: Add locking incoming webhooks to a single channel. (#8835) 2018-05-22 11:06:14 -07:00
Martin Kraft
4c683aff76 Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-22 12:54:00 -04:00
Elias Nahum
1af1bce619 Change order of web endpoints (#8817) 2018-05-21 10:15:23 -04:00
Joram Wilander
c6cbce6100 Add config setting for API team deletion (#8800) 2018-05-18 09:13:23 -04:00
Martin Kraft
6f31d90e2f Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-17 07:53:16 -04:00
Martin Kraft
f1a830ce9a Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-16 14:45:46 -04:00
Joram Wilander
1f6c271b3b MM-8708 Remove api package (#8784)
* Remove api package

* Remove api dependency from cmd package

* Remove EnableAPIv3 setting

* Update web tests

* Add more websocket tests

* Move some ws and oauth tests to api4 package

* Move command tests into api4 package

* Test fixes

* Fix msg command test

* Add some app file tests
2018-05-16 13:43:22 -04:00
Derrick Anderson
228bc4bd1d Merge remote-tracking branch 'origin/release-4.10' into merge410rc5 2018-05-15 11:19:27 -04:00
Martin Kraft
f82cc7896d Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-15 07:45:28 -04:00
Joram Wilander
6a9aa855d1 Move SAML endpoints out of api package (#8780) 2018-05-14 11:27:30 -04:00
Joram Wilander
47250c6629 Refactor context out of API packages (#8755)
* Refactor context out of API packages

* Update function names per feedback

* Move webhook handlers to web and fix web tests

* Move more webhook tests out of api package

* Fix static handler
2018-05-14 10:24:58 -04:00
Christopher Speller
686c2fbab7 Structured logging (#8673)
* Implementing structured logging

* Changes to en.json to allow refactor to run.

* Fixing global logger

* Structured logger initalization.

* Add caller.

* Do some log redirection.

* Auto refactor

* Cleaning up l4g reference and removing dependancy.

* Removing junk.

* Copyright headers.

* Fixing tests

* Revert "Changes to en.json to allow refactor to run."

This reverts commit fd8249e99b.

* Fixing some auto refactor strangeness and typo.

* Making keys more human readable.
2018-04-27 12:49:45 -07:00
Harrison Healey
57ee6f505e Added additional unit tests for IE11 and compatibility mode (#8573) 2018-04-09 11:14:36 +01:00
Martin Kraft
5fa1b35819 Merge branch 'master' into advanced-permissions-phase-1 2018-03-23 09:08:49 -04:00
Jesse Hallam
9d701c7044 Fix various segfaults when running go test manually (#8448)
* failing to find i18n shouldn't segfault

The server was trying to handle the fact that it couldn't find the i18n
directory, by emitting a translated log message...

* fix utils.FindDir

The attempts to find the directory in the parent or grandparent directory
don't work if the current working directory was inside `enterprise`, with
`enterprise` itself being a symlink as per the usual developer setup.

Recurse to the root of the filesystem, cleaning the path along the way
to work around this limitation (and allow tests to be run from an
arbitrarily deep nesting level.)

Fix corresponding usages to employ filepath.Join.

* failing to find html templates shouldn't segfault

* fail fast if the test user cannot be created

* rework utils.FindDir to retain backwards compatibility
2018-03-21 18:27:14 +00:00
George Goldberg
fadcdd271a Merge branch 'master' into advanced-permissions-phase-1 2018-03-13 13:36:23 +00:00
Harrison Healey
4e26594fcb Removed mssola/user_agent library (#8417)
* Removed mssola/user_agent library

* Changed user agent tests to use t.Run
2018-03-12 10:21:20 -04:00
Alex Moon
309594cedf [PLT-7574] Update and Simplify Compatibility Check and Replace UA Dependency (#7427)
* Add fix to not run browser check on Mobile Browsers or the App

* remove non safari and IE checks

* Replace useragent checking dependency and update UA tests

* change some wording

* change dependancy again to one with compatible licence

* Fix typos and clarify wording

* fix typo and comvert tests to use array
2018-03-06 21:22:07 +00:00
George Goldberg
901acc9703 Merge branch 'master' into advanced-permissions-phase-1 2018-03-02 15:55:03 +00:00
Joram Wilander
5fb4b1bc93 MM-8593 Default APIv3 to disabled for new installs (#8353)
* Default APIv3 to disabled for new installs

* Add EnableAPIv3 setting to client config

* Enable APIv3 for needed tests
2018-02-23 07:55:02 -08:00
George Goldberg
f8289eb286 Merge branch 'master' into advanced-permissions-phase-1 2018-02-19 11:19:39 +00:00
Carlos Tadeu Panato Junior
8c3a7b75de [PLT-539] Update incoming webhooks to accept multipart/form-data content (#7873) 2018-02-16 08:29:12 -08:00
George Goldberg
5c101253c5 Merge branch 'master' into advanced-permissions-phase-1 2018-02-13 13:46:01 +00:00
Chris
eff65aa05c ABC-132: sign error page parameters (#8197)
* sign error page parameters

* add comments
2018-02-07 12:05:46 -05:00
Jesús Espino
a04b02081a Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1 2018-02-07 18:05:23 +01:00
Pierre de La Morinerie
809a16458f Abort on critical error during server startup (#8204)
Only a handful of critical errors are present in the codebase.
They all occur during server startup (in `app.StartServer()`).

Currently, when one of these critical error occurs, it is simpled
mentionned in the logs – then the error is discarded, and the app
attempts to continue the execution (and probably fails pretty quickly in
a weird way).

Rather than continuing operations in an unknow state, these errors should
trigger a clean exit.

This commit rewrites critical startup errors to be correctly
propagated, logged, and then terminate the command execution.
Additionnaly, it makes the server return a proper error code to the
shell.
2018-02-07 02:11:15 -06:00
George Goldberg
e1cd646135 XYZ-37: Advanced Permissions Phase 1 Backend. (#8159)
* XYZ-13: Update Permission and Role structs to new design.

* XYZ-10: Role store.

* XYZ-9/XYZ-44: Roles API endpoints and WebSocket message.

* XYZ-8: Switch server permissions checks to store backed roles.

* XYZ-58: Proper validation of roles where required.

* XYZ-11/XYZ-55: Migration to store backed roles from policy config.

* XYZ-37: Update unit tests to work with database roles.

* XYZ-56: Remove the "guest" role.

* Changes to SetDefaultRolesFromConfig.

* Short-circuit the store if nothing has changed.

* Address first round of review comments.

* Address second round of review comments.
2018-02-06 15:34:08 +00:00
Chris
1d9efd0e39 Remove global config watcher (#8080)
* remove global config watcher

* keep config watcher disabled for tests

* compile fix

* fix resource leak
2018-01-11 13:23:41 -08:00
Harrison Healey
36777057f2 PLT-8289 Added ability to change location of client plugins (#7942) 2017-12-05 12:25:49 -06:00
Chris
816a30397d Role refactor (#7867)
* role refactor

* add missing file

* fix web test
2017-11-21 11:08:32 -08:00
Chris
5cf45d2155 refactor template code (#7860) 2017-11-20 12:57:45 -05:00
Joram Wilander
06ec648cf3 PLT-7978 Add websocket event for user role update (#7745)
* Add websocket event for user role update

* Fix tests

* More test fixes
2017-10-31 16:00:21 +00:00