Commit graph

10 commits

Author SHA1 Message Date
Petr Pchelko
d8b92b761c ShellboxClientFactory: add RPCClient getters
Bug: T263437
Change-Id: I0802afa1ebabbfaca2244c599293556ce32673ae
2021-11-05 16:41:22 +00:00
Amir Sarabadani
50888be5f4 Add support for multiple shellbox URLs through a mapping configuration
In order to avoid major disruptions, I introduced default value to
fallback to but in longer term we probably should deprecated it.

Bug: T285105
Change-Id: I81d9ece769c4942ef2ca390a40ff9d2c24c9ece4
2021-06-21 14:14:44 +02:00
Tim Starling
99392f3b16 Use Shellbox for Shell::command() etc.
Make Command extend Shellbox's UnboxedCommand. Only a few MediaWiki-
specific features remain in the subclass.

Also add BoxedCommand abstraction and Shellbox client.

The Result alias didn't actually work, I just had to change the return
type hint.

Bug: T260330
Change-Id: Iff7428e4c5fe3959a5cda8e113f223caa0976fc1
2021-02-05 21:51:58 +11:00
Kunal Mehta
d45e2fef6d SECURITY: Prevent invoking firejail's --output functionality
firejail has an RCE in its handling of --output when dealing with untrusted
arguments (CVE-2020-17367 and CVE-2020-17368). We can avoid this issue by
preventing shelling out to firejail if any parameter starts with '--output'.

Bug: T258763
Change-Id: Ic6a5644566a51a948de7b42daf57b29ced3daff4
2020-09-24 16:24:36 +01:00
Kunal Mehta
b3f54db14c shell: Fix autodetection of firejail in findFirejail()
Fixes a regression from 3f94708eff. ExecutableFinder returns false if
the executable isn't found, but CommandFactory was expecting a null response,
This caused autodetection to always think firejail was present.

Adjust CommandFactoryTest to ensure we're always passing a string to
FirejailCommand. We need to switch findFirejail to protected so it can
be mocked.

Bug: T257282
Change-Id: Ie73418ebef6dce2bd5ec18fa38e29219d5bb2fd6
2020-07-07 03:18:34 -07:00
RazeSoldier
f58616acce shell: Skip FirejailCommandTest::testBuildFinalCommand() on Windows
firejail is a Linux sandboxing system, unavailable on Windows.

Bug: T228568
Change-Id: I115e0e72ec31ebd7fd61e90250c10b414eea2489
2020-02-11 16:31:31 +00:00
Amir Sarabadani
06f645c453 Load GlobalFunctions.php to tests/phpunit/bootstrap.php
That mostly enables testing global functions

Bug: T87781
Change-Id: Ib42c56a67926ebcdba53f4c6c54a5bff98cb77a3
2019-07-14 01:28:07 +02:00
Amir Sarabadani
57261a926c Move unit tests, round III
Depends-On: I16691fc8ac063705ba0c2bc63b96c4534ca8660b
Bug: T87781
Change-Id: I5e1ab06e3decef6cc6090551d54dc4314ab9314a
2019-07-09 22:06:59 +02:00
Legoktm
4e35134f7a Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
2019-06-13 23:00:08 +00:00
Máté Szabó
0a2b996278 Separate MediaWiki unit and integration tests
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.

The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.

You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml

Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
2019-06-13 22:56:31 +02:00