Skip to content

Commit 41c899a

Browse files
author
dkraus
committed
Merge branch 'white/staging' into white/master
2 parents 47af747 + 95442f1 commit 41c899a

File tree

22 files changed

+466
-31
lines changed

22 files changed

+466
-31
lines changed

.gitlab/ci/testing/.pretesting-gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ flake8:
9898
stage: pre_testing
9999
script:
100100
- pip install flake8
101-
- flake8 .
101+
- flake8 . --exclude=.git
102102
rules:
103103
- !reference [ .ignore-on-tag, rules ]
104104
- when: on_success

CHANGELOG/5.7.0/community.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* [ADD] Added bulk update feature for custom attributes. #7716
2+
* [FIX] Fix hostnames not working on pipelines conditions. #7807
3+
* [FIX] Allow services to be searchable. #7514
4+
* [FIX] Fixed crash on unsupported image format upload. #7710
5+
* [FIX] Fixed service based jobs not working for assets #7778

CHANGELOG/5.7.0/date.md

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

RELEASE.md

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

4+
5.7.0 [Sep 20th, 2024]:
5+
---
6+
* [ADD] Added bulk update feature for custom attributes. #7716
7+
* [FIX] Allow services to be searchable. #7514
8+
* [FIX] Fixed crash on unsupported image format upload. #7710
9+
* [FIX] Fixed service based jobs not working for assets #7778
10+
* [FIX] Fixed hostnames not working on pipelines conditions. #7807
11+
412
5.6.1 [Aug 28th, 2024]:
513
---
614
* [FIX] Resolved an issue with filtering by Custom Attributes. #7800

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.6.1'
7+
__version__ = '5.7.0'
88
__license_version__ = __version__

faraday/openapi/faraday_swagger.json

Lines changed: 43 additions & 2 deletions
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.6.0 API",
4+
"title": "Faraday 5.7.0 API",
55
"version": "v3"
66
},
77
"security": [
@@ -2417,6 +2417,47 @@
24172417
}
24182418
}
24192419
},
2420+
"/_api/v3/ws/{workspace_name}/services/filter": {
2421+
"get": {
2422+
"tags": [
2423+
"Filter",
2424+
"Service"
2425+
],
2426+
"description": "Filters, sorts and groups workspaced objects using a json with parameters. These parameters must be part of the model.",
2427+
"parameters": [
2428+
{
2429+
"in": "query",
2430+
"name": "q",
2431+
"description": "recursive json with filters that supports operators. The json could also contain sort and group."
2432+
}
2433+
],
2434+
"responses": {
2435+
"200": {
2436+
"description": "returns filtered, sorted and grouped results",
2437+
"content": {
2438+
"application/json": {
2439+
"schema": {
2440+
"$ref": "#/components/schemas/FlaskRestless"
2441+
}
2442+
}
2443+
}
2444+
},
2445+
"400": {
2446+
"description": "invalid q was sent to the server"
2447+
}
2448+
}
2449+
},
2450+
"parameters": [
2451+
{
2452+
"name": "workspace_name",
2453+
"in": "path",
2454+
"schema": {
2455+
"type": "string"
2456+
},
2457+
"required": true
2458+
}
2459+
]
2460+
},
24202461
"/_api/v3/services": {
24212462
"delete": {
24222463
"tags": [
@@ -8802,4 +8843,4 @@
88028843
"name": "settings"
88038844
}
88048845
]
8805-
}
8846+
}

faraday/server/api/modules/services.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
FilterSetMeta,
2727
FilterAlchemyMixin,
2828
BulkDeleteWorkspacedMixin,
29-
BulkUpdateWorkspacedMixin
29+
BulkUpdateWorkspacedMixin,
30+
FilterWorkspacedMixin,
3031
)
3132
from faraday.server.schemas import (
3233
MetadataSchema,
@@ -134,7 +135,12 @@ class Meta(FilterSetMeta):
134135
operators = (operators.Equal,)
135136

136137

137-
class ServiceView(PaginatedMixin, FilterAlchemyMixin, ReadWriteWorkspacedView, BulkDeleteWorkspacedMixin, BulkUpdateWorkspacedMixin):
138+
class ServiceView(PaginatedMixin,
139+
FilterAlchemyMixin,
140+
ReadWriteWorkspacedView,
141+
BulkDeleteWorkspacedMixin,
142+
BulkUpdateWorkspacedMixin,
143+
FilterWorkspacedMixin):
138144

139145
route_base = 'services'
140146
model_class = Service

faraday/server/api/modules/vulns.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
FaradayCustomField,
8484
PrimaryKeyRelatedField,
8585
)
86-
from faraday.server.utils.vulns import parse_cve_references_and_policyviolations, update_one_host_severity_stat
86+
from faraday.server.utils.vulns import parse_cve_references_and_policyviolations, update_one_host_severity_stat, bulk_update_custom_attributes
8787
from faraday.server.debouncer import debounce_workspace_update
8888

8989
vulns_api = Blueprint('vulns_api', __name__)
@@ -819,6 +819,9 @@ def _perform_bulk_update(self, ids, data, workspace_name=None, **kwargs):
819819
kwargs['returning'] = returning_rows
820820
if workspace_name:
821821
debounce_workspace_update(workspace_name)
822+
823+
if (len(data) > 0 and len(ids) > 0) and 'custom_fields' in data.keys():
824+
return bulk_update_custom_attributes(ids, data)
822825
return super()._perform_bulk_update(ids, data, workspace_name, **kwargs)
823826

824827
def put(self, object_id, workspace_name=None, **kwargs):

faraday/server/api/modules/vulns_context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
)
6060
from faraday.server.utils.export import export_vulns_to_csv
6161
from faraday.server.utils.filters import FlaskRestlessSchema
62+
from faraday.server.utils.vulns import bulk_update_custom_attributes
6263
from faraday.server.api.modules.vulns import (
6364
EvidenceSchema,
6465
VulnerabilitySchema,
@@ -144,6 +145,8 @@ def _perform_bulk_update(self, ids, data, **kwargs):
144145
Vulnerability.service_id,
145146
]
146147
kwargs['returning'] = returning_rows
148+
if (len(data) > 0 and len(ids) > 0) and "custom_fields" in data.keys():
149+
return bulk_update_custom_attributes(ids, data)
147150
return super()._perform_bulk_update(ids, data, **kwargs)
148151

149152
def _get_eagerloaded_query(self, *args, **kwargs):

faraday/server/api/modules/workflow.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@
194194
]
195195
}
196196

197+
service_datatypes = {
198+
"service/name": "string",
199+
"service/port": "int",
200+
"service/status": "string",
201+
"service/version": "string",
202+
}
203+
197204
order_regex = re.compile(r"^$|^\d+(-\d+)*$")
198205

199206
WORKFLOW_LIMIT = 2

0 commit comments

Comments
 (0)