Skip to content

Commit 024690f

Browse files
author
Diego Nadares
committed
Merge branch 'white/staging' into white/master
2 parents b2677a0 + dd15816 commit 024690f

File tree

13 files changed

+68
-53
lines changed

13 files changed

+68
-53
lines changed

.gitlab/ci/build-ci/.build-gitlab-ci.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ generate_deb_dev:
2727
- gem install --no-document dotenv -v 2.7
2828
- gem install --no-document public_suffix -v 4.0.7
2929
- gem install --no-document fpm-1.11.0.gem
30+
- gem install --no-document rexml
3031
- cd ../../
3132
- POSTFIX=$(echo "$CI_COMMIT_BRANCH" | awk '{split($1,a,"_");split($1,b,"/"); if (a[3]!="y2k") if (b[2]=="dev"||b[2]=="master") print ""; else print "~"a[3]; else exit 1;}')
3233
- sh faraday-linux-installers-builder/build.sh $(eval $IMAGE_TAG)~$((`date '+%s%N'`/1000))$POSTFIX server deb white
@@ -77,6 +78,7 @@ generate_deb_staging:
7778
- gem install --no-document dotenv -v 2.7
7879
- gem install --no-document public_suffix -v 4.0.7
7980
- gem install --no-document fpm-1.11.0.gem
81+
- gem install --no-document rexml
8082
- cd ../../
8183
- POSTFIX=$(echo "$CI_COMMIT_BRANCH" | awk '{split($1,a,"_");split($1,b,"/"); if (a[3]!="y2k") if (b[2]=="dev"||b[2]=="master") print ""; else print "~"a[3]; else exit 1;}')
8284
- sh faraday-linux-installers-builder/build.sh $(eval $IMAGE_TAG)~$((`date '+%s%N'`/1000))$POSTFIX server deb white
@@ -124,6 +126,7 @@ generate_deb_master:
124126
- gem install --no-document dotenv -v 2.7
125127
- gem install --no-document public_suffix -v 4.0.7
126128
- gem install --no-document fpm-1.11.0.gem
129+
- gem install --no-document rexml
127130
- cd ../../
128131
- POSTFIX=$(echo "$CI_COMMIT_BRANCH" | awk '{split($1,a,"_");split($1,b,"/"); if (a[3]!="y2k") if (b[2]=="dev"||b[2]=="master") print ""; else print "~"a[3]; else exit 1;}')
129132
- sh faraday-linux-installers-builder/build.sh $(eval $IMAGE_TAG)~$((`date '+%s%N'`/1000))$POSTFIX server deb white
@@ -157,9 +160,9 @@ generate_rpm_dev:
157160
- cd /; tar xf py3.tar; cd -
158161
- yum -y install curl zsh mailcap libffi-devel openssl-devel openldap-devel libjpeg-devel postgresql-devel
159162
- yum groups -y install "Development Tools"
160-
- yum -y install rh-python36 rh-ruby26 rh-ruby26-ruby-devel
161-
- source /opt/rh/rh-ruby26/enable
162-
- export X_SCLS="`scl enable rh-ruby26 'echo $X_SCLS'`"
163+
- yum -y install rh-python36 rh-ruby30 rh-ruby30-ruby-devel
164+
- source /opt/rh/rh-ruby30/enable
165+
- export X_SCLS="`scl enable rh-ruby30 'echo $X_SCLS'`"
163166
- source /opt/rh/rh-python36/enable
164167
- pip install virtualenv
165168
- pip install virtualenv-tools3
@@ -181,6 +184,7 @@ generate_rpm_dev:
181184
- gem install --no-document dotenv -v 2.7
182185
- gem install --no-document public_suffix -v 4.0.7
183186
- gem install --no-document fpm-1.11.0.gem
187+
- gem install --no-document rexml
184188
- cd ../../
185189
- sh faraday-linux-installers-builder/build.sh $(eval $IMAGE_TAG) server rpm white
186190
- mv faraday-server_amd64.rpm ../../faraday-server_amd64.rpm
@@ -215,9 +219,9 @@ generate_rpm_staging:
215219
- cd /; tar xf py3.tar; cd -
216220
- yum -y install curl zsh mailcap libffi-devel openssl-devel openldap-devel libjpeg-devel postgresql-devel
217221
- yum groups -y install "Development Tools"
218-
- yum -y install rh-python36 rh-ruby26 rh-ruby26-ruby-devel
219-
- source /opt/rh/rh-ruby26/enable
220-
- export X_SCLS="`scl enable rh-ruby26 'echo $X_SCLS'`"
222+
- yum -y install rh-python36 rh-ruby30 rh-ruby30-ruby-devel
223+
- source /opt/rh/rh-ruby30/enable
224+
- export X_SCLS="`scl enable rh-ruby30 'echo $X_SCLS'`"
221225
- source /opt/rh/rh-python36/enable
222226
- pip install virtualenv
223227
- pip install virtualenv-tools3
@@ -239,6 +243,7 @@ generate_rpm_staging:
239243
- gem install --no-document dotenv -v 2.7
240244
- gem install --no-document public_suffix -v 4.0.7
241245
- gem install --no-document fpm-1.11.0.gem
246+
- gem install --no-document rexml
242247
- cd ../../
243248
- sh faraday-linux-installers-builder/build.sh $(eval $IMAGE_TAG) server rpm white
244249
- mv faraday-server_amd64.rpm ../../faraday-server_amd64.rpm
@@ -270,9 +275,9 @@ generate_rpm_master:
270275
- cd /; tar xf py3.tar; cd -
271276
- yum -y install curl zsh mailcap libffi-devel openssl-devel openldap-devel libjpeg-devel postgresql-devel
272277
- yum groups -y install "Development Tools"
273-
- yum -y install rh-python36 rh-ruby26 rh-ruby26-ruby-devel
274-
- source /opt/rh/rh-ruby26/enable
275-
- export X_SCLS="`scl enable rh-ruby26 'echo $X_SCLS'`"
278+
- yum -y install rh-python36 rh-ruby30 rh-ruby30-ruby-devel
279+
- source /opt/rh/rh-ruby30/enable
280+
- export X_SCLS="`scl enable rh-ruby30 'echo $X_SCLS'`"
276281
- source /opt/rh/rh-python36/enable
277282
- pip install virtualenv
278283
- pip install virtualenv-tools3
@@ -294,6 +299,7 @@ generate_rpm_master:
294299
- gem install --no-document dotenv -v 2.7
295300
- gem install --no-document public_suffix -v 4.0.7
296301
- gem install --no-document fpm-1.11.0.gem
302+
- gem install --no-document rexml
297303
- cd ../../
298304
- sh faraday-linux-installers-builder/build.sh $(eval $IMAGE_TAG) server rpm white
299305
- mv faraday-server_amd64.rpm ../../faraday-server_amd64.rpm

CHANGELOG/5.2.0/community.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* [FIX] Fix hosts stats when bulk delete is applied to vulns. #7676
2+
* [FIX] The server was not updating the agents status on restart. #7677
3+
* [MOD] Remove websockets port from docker-compose. #7679

CHANGELOG/5.2.0/date.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Mar 12th, 2024

RELEASE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
New features in the latest update
22
=====================================
33

4+
5.2.0 [Mar 12th, 2024]:
5+
---
6+
* [FIX] Fix hosts stats when bulk delete is applied to vulns. #7676
7+
* [FIX] Fix agents status from database. We were not updating the agents status on faraday-server restarts. #7677
8+
* [MOD] Remove websockets port from docker-compose. #7679
9+
410
5.1.1 [Feb 9th, 2024]:
511
---
612
* [FIX] Improve of host view performance.

docker-compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ services:
3535
- redis
3636
ports:
3737
- "5985:5985"
38-
- "9000:9000"
3938
volumes:
4039
db:
4140
driver: local

faraday/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
See the file 'doc/LICENSE' for the license information
55
"""
66

7-
__version__ = '5.1.1'
7+
__version__ = '5.2.0'
88
__license_version__ = __version__

faraday/openapi/faraday_swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"info": {
33
"description": "The Faraday REST API enables you to interact with [our server](https://github.com/infobyte/faraday).\nUse this API to interact or integrate with Faraday server. This page documents the REST API, with HTTP response codes and example requests and responses.",
4-
"title": "Faraday 5.1.0 API",
4+
"title": "Faraday 5.2.0 API",
55
"version": "v3"
66
},
77
"security": {

faraday/server/api/modules/vulns.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,39 +1396,6 @@ def bulk_delete(self, workspace_name, **kwargs):
13961396
workspace_name=workspace_name, **kwargs), 200
13971397
bulk_delete.__doc__ = BulkDeleteWorkspacedMixin.bulk_delete.__doc__
13981398

1399-
def _perform_bulk_delete(self, values, **kwargs):
1400-
# Get host and service ids in order to update host stats
1401-
host_ids = db.session.query(
1402-
VulnerabilityGeneric.host_id,
1403-
VulnerabilityGeneric.service_id
1404-
)
1405-
1406-
by_severity = kwargs.get('by', None)
1407-
if by_severity == 'severity':
1408-
for severity in values:
1409-
if severity not in VulnerabilityABC.SEVERITIES:
1410-
flask.abort(http.client.BAD_REQUEST, "Severity type not valid")
1411-
1412-
host_ids = host_ids.filter(
1413-
VulnerabilityGeneric.severity.in_(values)
1414-
).all()
1415-
else:
1416-
host_ids = host_ids.filter(
1417-
VulnerabilityGeneric.id.in_(values)
1418-
).all()
1419-
1420-
response = super()._perform_bulk_delete(values, **kwargs)
1421-
deleted = response.json.get('deleted', 0)
1422-
if deleted > 0:
1423-
from faraday.server.tasks import update_host_stats # pylint:disable=import-outside-toplevel
1424-
host_id_list = [data[0] for data in host_ids if data[0]]
1425-
service_id_list = [data[1] for data in host_ids if data[1]]
1426-
if faraday_server.celery_enabled:
1427-
update_host_stats.delay(host_id_list, service_id_list)
1428-
else:
1429-
update_host_stats(host_id_list, service_id_list)
1430-
return response
1431-
14321399
def _bulk_update_query(self, ids, **kwargs):
14331400
# It IS better to as is but warn of ON CASCADE
14341401
query = self.model_class.query.filter(self.model_class.id.in_(ids))
@@ -1510,5 +1477,38 @@ def _post_bulk_update(self, ids, extracted_data, workspace_name, **kwargs):
15101477
else:
15111478
update_host_stats(host_id_list, service_id_list)
15121479

1480+
def _perform_bulk_delete(self, values, **kwargs):
1481+
# Get host and service ids in order to update host stats
1482+
host_ids = db.session.query(
1483+
VulnerabilityGeneric.host_id,
1484+
VulnerabilityGeneric.service_id
1485+
)
1486+
1487+
by_severity = kwargs.get('by', None)
1488+
if by_severity == 'severity':
1489+
for severity in values:
1490+
if severity not in VulnerabilityABC.SEVERITIES:
1491+
flask.abort(http.client.BAD_REQUEST, "Severity type not valid")
1492+
1493+
host_ids = host_ids.filter(
1494+
VulnerabilityGeneric.severity.in_(values)
1495+
).all()
1496+
else:
1497+
host_ids = host_ids.filter(
1498+
VulnerabilityGeneric.id.in_(values)
1499+
).all()
1500+
1501+
response = super()._perform_bulk_delete(values, **kwargs)
1502+
deleted = response.json.get('deleted', 0)
1503+
if deleted > 0:
1504+
from faraday.server.tasks import update_host_stats # pylint:disable=import-outside-toplevel
1505+
host_id_list = [data[0] for data in host_ids if data[0]]
1506+
service_id_list = [data[1] for data in host_ids if data[1]]
1507+
if faraday_server.celery_enabled:
1508+
update_host_stats.delay(host_id_list, service_id_list)
1509+
else:
1510+
update_host_stats(host_id_list, service_id_list)
1511+
return response
1512+
15131513

15141514
VulnerabilityView.register(vulns_api)

faraday/server/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def index(ex):
521521
app.view_functions['agent_api.AgentView:post'].is_public = True
522522

523523
# Remove agents that where registered
524-
if testing is False:
524+
if not testing:
525525
with app.app_context():
526526
remove_sid()
527527

pynixify/packages/faraday-agent-parameters-types/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
buildPythonPackage rec {
88
pname = "faraday-agent-parameters-types";
9-
version = "1.4.0";
9+
version = "1.5.1";
1010

1111
src = fetchPypi {
1212
inherit version;
1313
pname = "faraday_agent_parameters_types";
14-
sha256 = "1czn8p7f4g9h1rkkzn1hkh7gdvhfh51iw824chk7yfaanpvxxsd5";
14+
sha256 = "16wbvmc9sddwm71wmahfnx4la75qddz449b1kh2aw4clhz86q786";
1515
};
1616

1717
buildInputs = [ pytest-runner ];

0 commit comments

Comments
 (0)