diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 391f5921d..faaf68684 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,13 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + php: ['7.2', '7.3', '7.4'] # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -45,21 +51,19 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' - tools: pecl, composer - extensions: mysql, mbstring, json, xml, opcache, readline, redis, gnupg, gd - + php-version: ${{ matrix.php }} + extensions: mysql, mbstring, json, xml, opcache, readline, redis, gd # Runs a set of commands using the runners shell - name: Install deps + env: + php_version: ${{ matrix.php }} run: | git submodule update --init --recursive - date sudo apt-get -y update - sudo apt-get -y install python3 python3-venv virtualenv python3-pip python3-dev python3-nose python3-redis python3-lxml python3-dateutil python3-msgpack libxml2-dev libzmq3-dev zlib1g-dev apache2 curl php7.4-dev php7.4-cli libapache2-mod-php libfuzzy-dev libonig4 - sudo pip3 install --upgrade pip setuptools requests pyzmq + sudo apt-get -y install python3 python3-venv virtualenv python3-pip python3-nose python3-redis python3-lxml apache2 curl libapache2-mod-php libfuzzy-dev + sudo pip3 install --upgrade pip setuptools requests pyzmq poetry sudo pip3 install --upgrade -r requirements.txt - sudo pip3 install poetry USER=`id -u -n` sudo chown $USER:www-data $HOME/.composer pushd app @@ -123,6 +127,7 @@ jobs: - name: Configure MISP run: | USER=`id -u -n` + sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.osuser" $USER' sudo -E su $USER -c 'app/Console/cake Admin runUpdates' sudo -E su $USER -c 'app/Console/cake userInit -q | sudo tee ./key.txt' sudo -E su $USER -c 'app/Console/cake Admin setSetting "Session.autoRegenerate" 0' @@ -164,8 +169,7 @@ jobs: run: | USER=`id -u -n` sudo chmod +x app/Console/worker/start.sh - sudo -E su $USER -c 'app/Console/worker/start.sh &' - sleep 10 + sudo -E su $USER -c 'app/Console/worker/start.sh' - name: Python setup run: | @@ -213,7 +217,6 @@ jobs: ./curl_tests_GH.sh $AUTH $HOST popd pushd PyMISP - git pull origin main --tags -f poetry install -E fileobjects -E openioc -E virustotal -E docs -E pdfexport poetry run python tests/testlive_comprehensive.py poetry run python tests/test_mispevent.py diff --git a/app/Controller/Component/ACLComponent.php b/app/Controller/Component/ACLComponent.php index 4c5f7004b..e24e773d3 100644 --- a/app/Controller/Component/ACLComponent.php +++ b/app/Controller/Component/ACLComponent.php @@ -443,7 +443,6 @@ class ACLComponent extends Component 'fetchServersForSG' => array('perm_sharing_group'), 'filterEventIndex' => array(), 'getApiInfo' => array('*'), - 'getGit' => array(), 'getInstanceUUID' => array('perm_sync'), 'getPyMISPVersion' => array('*'), 'getRemoteUser' => array(), diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index 06b4087f3..9fa615965 100644 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -1824,11 +1824,6 @@ class ServersController extends AppController $this->set('_serialize', 'response'); } - public function getGit() - { - $status = $this->Server->getCurrentGitStatus(); - } - public function checkout() { $result = $this->Server->checkoutMain(); @@ -1839,11 +1834,17 @@ class ServersController extends AppController if ($this->request->is('post')) { $status = $this->Server->getCurrentGitStatus(); $raw = array(); - $update = $this->Server->update($status, $raw); + if (empty($status['branch'])) { // do not try to update if you are not on branch + $msg = 'Update failed, you are not on branch'; + $raw[] = $msg; + $update = $msg; + } else { + $update = $this->Server->update($status, $raw); + } if ($this->_isRest()) { return $this->RestResponse->viewData(array('results' => $raw), $this->response->type()); } else { - return new CakeResponse(array('body'=> $update, 'type' => 'txt')); + return new CakeResponse(array('body' => $update, 'type' => 'txt')); } } else { $branch = $this->Server->getCurrentBranch(); diff --git a/app/Lib/Tools/PubSubTool.php b/app/Lib/Tools/PubSubTool.php index 4cd27a534..d6a53ab41 100644 --- a/app/Lib/Tools/PubSubTool.php +++ b/app/Lib/Tools/PubSubTool.php @@ -258,7 +258,7 @@ class PubSubTool // Because setting file contains secrets, it should be readable just by owner. But because in Travis test, // config file is created under one user and then changed under other user, file must be readable and writable // also by group. - chmod($settingsFile->pwd(), 0660); + @chmod($settingsFile->pwd(), 0660); // hide error if current user is not file owner if (!$settingsFile->write(json_encode($settings))) { throw new Exception("Could not write zmq config file '$settingFilePath'."); } diff --git a/app/View/Servers/ajax/update.ctp b/app/View/Servers/ajax/update.ctp index 524c3a4ea..ecedb9c60 100644 --- a/app/View/Servers/ajax/update.ctp +++ b/app/View/Servers/ajax/update.ctp @@ -4,7 +4,7 @@ ?> Update MISP
-

branch? If you have made local changes to MISP the merge will fail.');?>

+