Skip to content

Commit 223f4a2

Browse files
author
Diego Nadares
committed
Merge branch 'white/staging' into white/master
2 parents 56be1e4 + 893e2ea commit 223f4a2

43 files changed

Lines changed: 1681 additions & 1173 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ result
9292

9393
# Pytest config for local testing
9494
pytest.ini
95+
96+
# venv
97+
venv

CHANGELOG/5.16.0/community.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* [FIX] Fixed scope of a workspace being deleted on patch. #7945
2+
* [ADD] Implemented 'range' operator for date fields in filters. #7990
3+
* [ADD] Added severity range filtering for agent execution, scheduling and import. #7928
4+
* [FIX] Fixed issue with workspace scope not being correctly populated in the filter endpoint. #7987
5+
* [ADD] Add CVSS4 support for vuln template. #8000
6+
* [ADD] Added `last_detected` field to the Vulnerability model to track the most recent detection timestamp. #7936
7+
* [FIX] Fix randomly failing test in credentials. #8010
8+
* [FIX] Fixed Agents endpoint not supporting filters. #7798
9+
* [MOD] removed obsolete vulners endpoint. #7864

CHANGELOG/5.16.0/date.md

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

RELEASE.md

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

4+
5.16.0 [Aug 27th, 2025]:
5+
---
6+
* [ADD] Implemented `range` operator for date fields in filters. #7990
7+
* [ADD] Added severity range filtering for agent execution, scheduling and import. #7928
8+
* [ADD] Added CVSS4 support for vuln template. #8000
9+
* [ADD] Added `last_detected` field to the Vulnerability model to track the most recent detection timestamp. #7936
10+
* [MOD] Removed obsolete `vulners` endpoint. #7864
11+
* [FIX] Fixed randomly failing test in credentials. #8010
12+
* [FIX] Fixed `Agents` endpoint not supporting filters. #7798
13+
* [FIX] Fixed issue with workspace scope not being correctly populated in the filter endpoint. #7987
14+
* [FIX] Fixed scope of a workspace being deleted on patch. #7945
15+
416
5.15.3 [Jul 30th, 2025]:
517
---
618
* [FIX] Fixed roles permissions. #8004

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.15.3'
7+
__version__ = '5.16.0'
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""add jira scope
2+
3+
Revision ID: 000918b77c25
4+
Revises: 2ee8b7eb119f
5+
Create Date: 2025-03-27 13:08:56.838630+00:00
6+
7+
"""
8+
from alembic import op
9+
from faraday.server.models import UserToken
10+
11+
# revision identifiers, used by Alembic.
12+
revision = '000918b77c25'
13+
down_revision = '2ee8b7eb119f'
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
with op.get_context().autocommit_block():
20+
op.execute("ALTER TYPE token_scopes ADD VALUE IF NOT EXISTS 'jira'")
21+
22+
23+
def downgrade():
24+
op.execute("DELETE FROM user_token WHERE scope = 'jira'")
25+
26+
scopes = [scope for scope in UserToken.SCOPES if scope != UserToken.JIRA_SCOPE]
27+
28+
scopes_str = ', '.join(f"'{scope}'" for scope in scopes)
29+
30+
op.execute(f"CREATE TYPE token_scopes_tmp AS ENUM({scopes_str})")
31+
32+
# Step 2: Alter the table to use the new enum type
33+
op.execute("""
34+
ALTER TABLE user_token
35+
ALTER COLUMN scope
36+
SET DATA TYPE token_scopes_tmp
37+
USING scope::text::token_scopes_tmp
38+
""")
39+
40+
op.execute("DROP TYPE token_scopes")
41+
42+
op.execute("ALTER TYPE token_scopes_tmp RENAME TO token_scopes")
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""workspace summary report
2+
3+
Revision ID: 2063ac75ffb1
4+
Revises: 8884e7d3681e
5+
Create Date: 2025-05-22 19:58:33.565693+00:00
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
from faraday.server.fields import JSONType
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '2063ac75ffb1'
14+
down_revision = '8884e7d3681e'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
op.create_table('workspace_summary_report',
21+
sa.Column('create_date', sa.DateTime(), nullable=True),
22+
sa.Column('update_date', sa.DateTime(), nullable=True),
23+
sa.Column('id', sa.Integer(), nullable=False),
24+
sa.Column('user_id', sa.Integer(), nullable=False),
25+
sa.Column('workspace_id', sa.Integer(), nullable=False),
26+
sa.Column('recipients', JSONType(), nullable=False),
27+
sa.Column(
28+
'summary_period_type',
29+
sa.Enum('daily', 'weekly', 'monthly', 'yearly', name='summary_period_types'),
30+
default='weekly',
31+
nullable=False,
32+
),
33+
sa.Column('creator_id', sa.Integer(), nullable=True),
34+
sa.Column('update_user_id', sa.Integer(), nullable=True),
35+
sa.ForeignKeyConstraint(['creator_id'], ['faraday_user.id'], ondelete='SET NULL'),
36+
sa.ForeignKeyConstraint(['update_user_id'], ['faraday_user.id'], ondelete='SET NULL'),
37+
sa.ForeignKeyConstraint(['user_id'], ['faraday_user.id'], ondelete='CASCADE'),
38+
sa.ForeignKeyConstraint(['workspace_id'], ['workspace.id'], ondelete='CASCADE'),
39+
sa.PrimaryKeyConstraint('id'),
40+
sa.UniqueConstraint('creator_id', 'workspace_id', name='uix_workspace_summary_report_creator_workspace')
41+
)
42+
op.create_index(op.f('ix_workspace_summary_report_workspace_id'), 'workspace_summary_report', ['workspace_id'], unique=False)
43+
op.create_index(op.f('ix_workspace_summary_report_user_id'), 'workspace_summary_report', ['user_id'], unique=False)
44+
45+
46+
def downgrade():
47+
op.drop_index(op.f('ix_workspace_summary_report_user_id'), table_name='workspace_summary_report')
48+
op.drop_index(op.f('ix_workspace_summary_report_workspace_id'), table_name='workspace_summary_report')
49+
op.drop_table('workspace_summary_report')
50+
op.execute("DROP TYPE summary_period_types")
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
"""ws_sum_reports permissions
2+
3+
Revision ID: 2ee8b7eb119f
4+
Revises: 2063ac75ffb1
5+
Create Date: 2025-05-30 16:22:47.068338+00:00
6+
7+
"""
8+
from alembic import op
9+
10+
from faraday.server.models import PermissionsUnitAction, Role
11+
from faraday.server.utils.permissions import GROUP_WS_SUM_REPORTS, UNIT_WS_SUM_REPORTS
12+
13+
CREATE = PermissionsUnitAction.CREATE_ACTION
14+
READ = PermissionsUnitAction.READ_ACTION
15+
UPDATE = PermissionsUnitAction.UPDATE_ACTION
16+
DELETE = PermissionsUnitAction.DELETE_ACTION
17+
ACTIONS = [CREATE, READ, UPDATE, DELETE]
18+
19+
20+
# revision identifiers, used by Alembic.
21+
revision = '2ee8b7eb119f'
22+
down_revision = '2063ac75ffb1'
23+
branch_labels = None
24+
depends_on = None
25+
26+
27+
def upgrade():
28+
op.execute(
29+
"SELECT setval('permissions_group_id_seq', (SELECT MAX(id) FROM permissions_group));"
30+
)
31+
32+
op.execute(
33+
"SELECT setval('permissions_unit_id_seq', (SELECT MAX(id) FROM permissions_unit));"
34+
)
35+
36+
op.execute(
37+
"SELECT setval('permissions_unit_action_id_seq', (SELECT MAX(id) FROM permissions_unit_action));"
38+
)
39+
40+
op.execute(f"INSERT INTO permissions_group (name) VALUES ('{GROUP_WS_SUM_REPORTS}');") # nosec B608
41+
42+
result = op.get_bind().execute(
43+
f"SELECT id FROM permissions_group WHERE name = '{GROUP_WS_SUM_REPORTS}';" # nosec B608
44+
)
45+
group_id = result.scalar()
46+
47+
op.execute(
48+
f"INSERT INTO permissions_unit (name, permissions_group_id) VALUES ('{UNIT_WS_SUM_REPORTS}', {group_id});" # nosec B608
49+
)
50+
51+
result = op.get_bind().execute(
52+
f"SELECT id FROM permissions_unit WHERE name = '{UNIT_WS_SUM_REPORTS}';" # nosec B608
53+
)
54+
unit_id = result.scalar()
55+
56+
op.execute(
57+
f"INSERT INTO permissions_unit_action (action_type, permissions_unit_id) VALUES "
58+
f"('{CREATE}', {unit_id}), ('{READ}', {unit_id}), ('{UPDATE}', {unit_id}), ('{DELETE}', {unit_id});" # nosec B608
59+
)
60+
61+
permisison_unit_action_ids = []
62+
for action in ACTIONS:
63+
result = op.get_bind().execute(
64+
f"SELECT id FROM permissions_unit_action WHERE action_type = '{action}' AND permissions_unit_id = {unit_id};" # nosec B608
65+
)
66+
permisison_unit_action_ids.append(result.scalar())
67+
68+
roles = Role.query.all()
69+
for action_id in permisison_unit_action_ids:
70+
for role in roles:
71+
op.execute(
72+
f"INSERT INTO role_permission (unit_action_id, role_id, allowed) VALUES ({action_id}, {role.id}, true);" # nosec B608
73+
)
74+
75+
76+
def downgrade():
77+
result = op.get_bind().execute(
78+
f"SELECT id FROM permissions_unit WHERE name = '{UNIT_WS_SUM_REPORTS}';" # nosec B608
79+
)
80+
unit_id = result.scalar()
81+
82+
permisison_unit_action_ids = []
83+
for action in ACTIONS:
84+
result = op.get_bind().execute(
85+
f"SELECT id FROM permissions_unit_action WHERE action_type = '{action}' AND permissions_unit_id = {unit_id};" # nosec B608
86+
)
87+
permisison_unit_action_ids.append(result.scalar())
88+
89+
for action_id in permisison_unit_action_ids:
90+
op.execute(
91+
f"DELETE FROM role_permission WHERE unit_action_id = {action_id};" # nosec B608
92+
)
93+
94+
op.execute(
95+
f"DELETE FROM permissions_unit_action WHERE permissions_unit_id = (SELECT id FROM permissions_unit WHERE name = '{UNIT_WS_SUM_REPORTS}');" # nosec B608
96+
)
97+
98+
op.execute(
99+
f"DELETE FROM permissions_unit WHERE id = {unit_id};" # nosec B608
100+
)
101+
102+
op.execute(
103+
f"DELETE FROM permissions_group WHERE name = '{GROUP_WS_SUM_REPORTS}';" # nosec B608
104+
)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""add severity range
2+
3+
Revision ID: 5f1d2027ec67
4+
Revises: e4c1903496cb
5+
Create Date: 2025-05-13 15:45:25.683218+00:00
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '5f1d2027ec67'
14+
down_revision = 'e4c1903496cb'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# Create enum type for severity levels
21+
conn = op.get_bind()
22+
conn.execute("CREATE TYPE scheduler_severities AS ENUM ('UNCLASSIFIED', 'INFO', 'LOW', 'MED', 'HIGH', 'CRITICAL')")
23+
op.add_column('agent_schedule', sa.Column('min_severity', sa.Enum('UNCLASSIFIED', 'INFO', 'LOW', 'MED', 'HIGH', 'CRITICAL', name='scheduler_severities', create_type=False), nullable=True))
24+
op.add_column('agent_schedule', sa.Column('max_severity', sa.Enum('UNCLASSIFIED', 'INFO', 'LOW', 'MED', 'HIGH', 'CRITICAL', name='scheduler_severities', create_type=False), nullable=True))
25+
26+
27+
def downgrade():
28+
op.drop_column('agent_schedule', 'max_severity')
29+
op.drop_column('agent_schedule', 'min_severity')
30+
conn = op.get_bind()
31+
conn.execute("DROP TYPE scheduler_severities")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""vulnerability last_detected
2+
3+
Revision ID: 8884e7d3681e
4+
Revises: 5f1d2027ec67
5+
Create Date: 2025-05-09 15:57:14.610228+00:00
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
11+
# revision identifiers, used by Alembic.
12+
revision = '8884e7d3681e'
13+
down_revision = '5f1d2027ec67'
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
op.add_column('vulnerability', sa.Column('last_detected', sa.DateTime(), nullable=True))
20+
21+
22+
def downgrade():
23+
op.drop_column('vulnerability', 'last_detected')

0 commit comments

Comments
 (0)