Skip to content

Commit d220e44

Browse files
author
Diego Nadares
committed
Merge branch 'refs/heads/white/staging' into white/master
2 parents e97cc76 + bc0f972 commit d220e44

File tree

21 files changed

+301
-1385
lines changed

21 files changed

+301
-1385
lines changed

CHANGELOG/5.12.0/community.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* [ADD] Added update in bulk mode for workspaces. #7830
2+
* [ADD] Added endpoint to count agent schedulers. #7905
3+
* [FIX] Fixed session timeout setting not working on numbers less than 1. #7874

CHANGELOG/5.12.0/date.md

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

CHANGELOG/RELEASE.md

Lines changed: 0 additions & 1368 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,4 @@ check out the documentation [here](https://api.faradaysec.com/).
194194
* Issue tracker and feedback: [Github issue tracker](https://github.com/infobyte/faraday/issues)
195195
* Frequently Asked Questions: [FaradaySEC FAQ](https://docs.faradaysec.com/FAQ/)
196196
* Twitter: [@faradaysec](https://twitter.com/faradaysec)
197-
* Try one of our [Demos](https://demo101.faradaysec.com/#/login)
197+
* Try one of our [Demos](https://cloud.faradaysec.com/cloud/trial/request)

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.12.0 [Mar 13th, 2025]:
5+
---
6+
* [ADD] Added update in bulk mode for workspaces. #7830
7+
* [ADD] Added endpoint to count agent schedulers. #7905
8+
* [FIX] Fixed session timeout setting not working on numbers less than 1. #7874
9+
410
5.11.0 [Jan 30th, 2025]:
511
---
612
* [ADD] Attachment descriptions can now be updated. #7868

faraday/__init__.py

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

7-
__version__ = '5.11.0'
7+
__version__ = '5.12.0'
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""on delete cascade reports workspaces table
2+
3+
Revision ID: 293724cb146d
4+
Revises: 618a59151523
5+
Create Date: 2025-01-06 18:59:52.064483+00:00
6+
7+
"""
8+
from alembic import op
9+
10+
11+
# revision identifiers, used by Alembic.
12+
revision = '293724cb146d'
13+
down_revision = '618a59151523'
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
# ### commands auto generated by Alembic - please adjust! ###
20+
op.drop_constraint('executive_report_workspace_table_workspace_id_fkey', 'executive_report_workspace_table', type_='foreignkey')
21+
op.drop_constraint('executive_report_workspace_table_executive_report_id_fkey', 'executive_report_workspace_table', type_='foreignkey')
22+
op.create_foreign_key('executive_report_workspace_table_workspace_id_fkey', 'executive_report_workspace_table', 'workspace', ['workspace_id'], ['id'], ondelete='CASCADE')
23+
op.create_foreign_key('executive_report_workspace_table_executive_report_id_fkey', 'executive_report_workspace_table', 'executive_report', ['executive_report_id'], ['id'], ondelete='CASCADE')
24+
# ### end Alembic commands ###
25+
26+
27+
def downgrade():
28+
# ### commands auto generated by Alembic - please adjust! ###
29+
op.drop_constraint('executive_report_workspace_table_workspace_id_fkey', 'executive_report_workspace_table', type_='foreignkey')
30+
op.drop_constraint('executive_report_workspace_table_executive_report_id_fkey', 'executive_report_workspace_table', type_='foreignkey')
31+
op.create_foreign_key('executive_report_workspace_table_executive_report_id_fkey', 'executive_report_workspace_table', 'executive_report', ['executive_report_id'], ['id'])
32+
op.create_foreign_key('executive_report_workspace_table_workspace_id_fkey', 'executive_report_workspace_table', 'workspace', ['workspace_id'], ['id'])
33+
# ### end Alembic commands ###

faraday/openapi/faraday_swagger.json

Lines changed: 43 additions & 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.11.0 API",
4+
"title": "Faraday 5.12.0 API",
55
"version": "v3"
66
},
77
"security": [
@@ -3916,6 +3916,19 @@
39163916
}
39173917
}
39183918
},
3919+
"/_api/v3/ws/bulk_update": {
3920+
"patch": {
3921+
"tags": [
3922+
"Workspace"
3923+
],
3924+
"summary": "Update a group of Workspace records by ids.",
3925+
"responses": {
3926+
"204": {
3927+
"description": "Ok"
3928+
}
3929+
}
3930+
}
3931+
},
39193932
"/_api/v3/ws/{workspace_id}/change_readonly/": {
39203933
"put": {
39213934
"tags": [
@@ -5462,6 +5475,32 @@
54625475
}
54635476
]
54645477
},
5478+
"/_api/v3/agents_schedule/count_schedulers": {
5479+
"get": {
5480+
"tags": [
5481+
"Scheduler"
5482+
],
5483+
"summary": "Counts schedulers by type",
5484+
"responses": {
5485+
"200": {
5486+
"description": "Counts of schedulers by type",
5487+
"content": {
5488+
"application/json": {
5489+
"schema": {
5490+
"type": "object",
5491+
"properties": {
5492+
"agent_schedulers": {
5493+
"type": "integer",
5494+
"description": "Count of Agent Schedulers"
5495+
}
5496+
}
5497+
}
5498+
}
5499+
}
5500+
}
5501+
}
5502+
}
5503+
},
54655504
"/_api/v3/agents_schedule/{object_id}": {
54665505
"delete": {
54675506
"tags": [
@@ -9008,6 +9047,9 @@
90089047
{
90099048
"name": "Pipeline"
90109049
},
9050+
{
9051+
"name": "Scheduler"
9052+
},
90119053
{
90129054
"name": "SearchFilter"
90139055
},

faraday/server/api/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from marshmallow_sqlalchemy import ModelConverter
3333
from marshmallow_sqlalchemy.schema import SQLAlchemyAutoSchemaMeta, SQLAlchemyAutoSchemaOpts
3434
from sqlalchemy import and_, asc, desc, func, update as sqlalchemy_update
35+
from sqlalchemy.engine import ResultProxy
3536
from sqlalchemy.exc import IntegrityError
3637
from sqlalchemy.inspection import inspect
3738
from sqlalchemy.orm import joinedload, undefer, with_expression
@@ -360,6 +361,13 @@ def _get_objects(self, object_ids, eagerload=False, **kwargs):
360361
query = self._get_base_query(**kwargs)
361362
try:
362363
obj = query.filter(self._get_lookup_field().in_(object_ids)).all()
364+
except AttributeError:
365+
# Handle the case where `query` is a ResultProxy, this comes from Workspace query_object_with_count
366+
if isinstance(query, ResultProxy):
367+
res = db.session.query(self.model_class).filter(self.model_class.name.in_(object_ids)).all()
368+
return res
369+
# If it's another AttributeError, re-raise
370+
raise
363371
except NoResultFound:
364372
return []
365373
return obj

faraday/server/api/modules/agents_schedule.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,42 @@ def run_schedule(self, schedule_id):
276276
'commands_id': [command.id for command in commands],
277277
})
278278

279+
@route('/count_schedulers', methods=['GET'])
280+
def count_schedulers(self):
281+
"""
282+
---
283+
get:
284+
tags: ["Scheduler"]
285+
summary: Counts schedulers by type
286+
responses:
287+
200:
288+
description: Counts of schedulers by type
289+
content:
290+
application/json:
291+
schema:
292+
type: object
293+
properties:
294+
agent_schedulers:
295+
type: integer
296+
description: Count of Agent Schedulers
297+
"""
298+
# ONLY FOR COMMUNITY
299+
counts = db.session.query(
300+
AgentsSchedule.type,
301+
db.func.count(AgentsSchedule.id).label('count')
302+
).group_by(AgentsSchedule.type).all()
303+
304+
result = {
305+
'agent_schedulers': 0,
306+
}
307+
308+
for scheduler_type, count in counts:
309+
if scheduler_type == 'cloud_agent':
310+
continue
311+
if scheduler_type == 'agent':
312+
result['agent_schedulers'] = count
313+
314+
return flask.jsonify(result)
315+
279316

280317
AgentsScheduleView.register(agents_schedule_api)

0 commit comments

Comments
 (0)