From cda7f78e6f6247a74bf9e3949c96ea190045fc58 Mon Sep 17 00:00:00 2001 From: David Kraus Date: Mon, 31 Jul 2023 12:51:24 -0300 Subject: [PATCH 01/14] Fix flake8 in server/api/base.py --- faraday/server/api/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faraday/server/api/base.py b/faraday/server/api/base.py index 89bf9799c49..f14f8b059e5 100644 --- a/faraday/server/api/base.py +++ b/faraday/server/api/base.py @@ -1501,7 +1501,7 @@ def bulk_update(self, **kwargs): # Try to get ids if flask.request.json and 'ids' in flask.request.json: - ids = list(filter(lambda x: type(x) == self.lookup_field_type, flask.request.json['ids'])) + ids = list(filter(lambda x: type(x) is self.lookup_field_type, flask.request.json['ids'])) # Try filter if no ids elif flask.request.args.get('q', None) is not None: @@ -1728,7 +1728,7 @@ def bulk_delete(self, **kwargs): # TODO BULK_DELETE_SCHEMA # Try to get ids if flask.request.json and 'ids' in flask.request.json: - ids = list(filter(lambda x: type(x) == self.lookup_field_type, flask.request.json['ids'])) + ids = list(filter(lambda x: type(x) is self.lookup_field_type, flask.request.json['ids'])) # Try filter if no ids elif flask.request.args.get('q', None) is not None: From 282ceda880bf046474584fa6cbe05c7ea12dde84 Mon Sep 17 00:00:00 2001 From: David Kraus Date: Mon, 31 Jul 2023 12:52:33 -0300 Subject: [PATCH 02/14] Fix flake8 in server/api/modules/hosts.py --- faraday/server/api/modules/hosts.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/faraday/server/api/modules/hosts.py b/faraday/server/api/modules/hosts.py index 12af57076b5..e98c46ca975 100644 --- a/faraday/server/api/modules/hosts.py +++ b/faraday/server/api/modules/hosts.py @@ -151,11 +151,11 @@ class HostsView(PaginatedMixin, BulkUpdateWorkspacedMixin): route_base = 'hosts' model_class = Host - order_field = desc(Host.vulnerability_critical_generic_count),\ - desc(Host.vulnerability_high_generic_count),\ - desc(Host.vulnerability_medium_generic_count),\ - desc(Host.vulnerability_low_generic_count),\ - desc(Host.vulnerability_info_generic_count),\ + order_field = desc(Host.vulnerability_critical_generic_count), \ + desc(Host.vulnerability_high_generic_count), \ + desc(Host.vulnerability_medium_generic_count), \ + desc(Host.vulnerability_low_generic_count), \ + desc(Host.vulnerability_info_generic_count), \ desc(Host.vulnerability_unclassified_generic_count), Host.ip.asc() schema_class = HostSchema From 288282419c5f3399ecfaec1dd1387b3f32b6084a Mon Sep 17 00:00:00 2001 From: David Kraus Date: Mon, 31 Jul 2023 12:54:04 -0300 Subject: [PATCH 03/14] Fix flake8 in server/commands/manage_settings.py --- faraday/server/commands/manage_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faraday/server/commands/manage_settings.py b/faraday/server/commands/manage_settings.py index c3118f3de0f..16f2d1b6338 100644 --- a/faraday/server/commands/manage_settings.py +++ b/faraday/server/commands/manage_settings.py @@ -52,7 +52,7 @@ def manage(action, json_data, name): for key, value in settings.value.items(): if json_data is not None: json_value = json_data.get(key, None) - if type(json_value) != type(value) or json_value is None: + if type(json_value) is not type(value) or json_value is None: click.secho(f"Missing or Invalid value for {key} [{json_value}]", fg="red") sys.exit(1) else: From 4dc74cac5acf80de4fca69260f5aa0dc2f6bf0a1 Mon Sep 17 00:00:00 2001 From: David Kraus Date: Mon, 31 Jul 2023 12:55:19 -0300 Subject: [PATCH 04/14] Fix flake8 in server/schemas.py --- faraday/server/schemas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faraday/server/schemas.py b/faraday/server/schemas.py index 2e17b9294a0..b0123a64b69 100644 --- a/faraday/server/schemas.py +++ b/faraday/server/schemas.py @@ -60,8 +60,8 @@ def _serialize(self, value, attr, obj, **kwargs): for custom_field in custom_fields: serialized_value = value.get(custom_field.field_name) - if type(serialized_value) == list: - res[custom_field.field_name] = [element['value'] if type(element) == dict + if type(serialized_value) is list: + res[custom_field.field_name] = [element['value'] if type(element) is dict else element for element in serialized_value] else: res[custom_field.field_name] = serialized_value From 05ede174cacc81bbd057a310778eb76624e80d2c Mon Sep 17 00:00:00 2001 From: David Kraus Date: Mon, 31 Jul 2023 12:56:22 -0300 Subject: [PATCH 05/14] Fix flake8 in server/threads/reports_processor.py --- faraday/server/threads/reports_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faraday/server/threads/reports_processor.py b/faraday/server/threads/reports_processor.py index d89ee49a35b..68cca4e33a7 100644 --- a/faraday/server/threads/reports_processor.py +++ b/faraday/server/threads/reports_processor.py @@ -126,7 +126,7 @@ def run(self): tpl: Tuple[str, int, Path, int, int, bool, bool, list, list, list] = \ self.upload_reports_queue.get(False, timeout=0.1) - workspace_name, command_id, file_path, plugin_id, user_id, ignore_info_bool, dns_resolution, vuln_tag,\ + workspace_name, command_id, file_path, plugin_id, user_id, ignore_info_bool, dns_resolution, vuln_tag, \ host_tag, service_tag = tpl logger.info(f"Processing raw report {file_path}") From f471c8d4866ce9e65932fdd0645bcab8b92b4bb0 Mon Sep 17 00:00:00 2001 From: David Kraus Date: Mon, 31 Jul 2023 12:57:52 -0300 Subject: [PATCH 06/14] Fix flake8 in tests/test_api_comment.py --- tests/test_api_comment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_api_comment.py b/tests/test_api_comment.py index 84ad538a77c..0d2c25db25e 100644 --- a/tests/test_api_comment.py +++ b/tests/test_api_comment.py @@ -91,7 +91,7 @@ def test_create_unique_comment_for_plugins(self, session, test_client): res = test_client.post(url, data=raw_comment) assert res.status_code == 409 assert 'object' in res.json - assert type(res.json) == dict + assert type(res.json) is dict def test_create_unique_comment_for_plugins_after_and_before(self, session, test_client): """ @@ -111,7 +111,7 @@ def test_create_unique_comment_for_plugins_after_and_before(self, session, test_ res = test_client.post(url, data=raw_comment) assert res.status_code == 409 assert 'object' in res.json - assert type(res.json) == dict + assert type(res.json) is dict def test_default_order_field(self, session, test_client): workspace = factories.WorkspaceFactory.create() From 5c1e841a8c98ca0def03efed325272e2f96996fb Mon Sep 17 00:00:00 2001 From: Diego Nadares Date: Fri, 18 Aug 2023 15:17:12 -0300 Subject: [PATCH 07/14] Fix vault install in bandit job --- .gitlab/ci/testing/.pretesting-gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/testing/.pretesting-gitlab-ci.yml b/.gitlab/ci/testing/.pretesting-gitlab-ci.yml index ba465a5c550..6c5155241c8 100644 --- a/.gitlab/ci/testing/.pretesting-gitlab-ci.yml +++ b/.gitlab/ci/testing/.pretesting-gitlab-ci.yml @@ -54,10 +54,10 @@ bandit: - mkdir /results - "bandit -r ${CI_PROJECT_DIR}/faraday -o /results/output.xml -f xml --skip B101" after_script: - - curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - + - wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg - apt update - apt-get install software-properties-common -y - - apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com focal main" + - echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list - apt update - apt install vault -y - setcap cap_ipc_lock= /usr/bin/vault From 0f789b1123afd17b770cd733c05958bed49c7c67 Mon Sep 17 00:00:00 2001 From: Nahuel Alonso Date: Wed, 23 Aug 2023 17:50:42 -0300 Subject: [PATCH 08/14] Models and migration --- .../61ded0c8fbf6_notification_center.py | 135 ++++++++++++++++++ faraday/server/models.py | 115 +++++++++++++++ 2 files changed, 250 insertions(+) create mode 100644 faraday/migrations/versions/61ded0c8fbf6_notification_center.py diff --git a/faraday/migrations/versions/61ded0c8fbf6_notification_center.py b/faraday/migrations/versions/61ded0c8fbf6_notification_center.py new file mode 100644 index 00000000000..ee4f1b6f709 --- /dev/null +++ b/faraday/migrations/versions/61ded0c8fbf6_notification_center.py @@ -0,0 +1,135 @@ +"""notification center + +Revision ID: 61ded0c8fbf6 +Revises: f20aa8756612 +Create Date: 2023-01-11 19:24:20.511853+00:00 + +""" +from alembic import op +import sqlalchemy as sa + +import faraday + +# revision identifiers, used by Alembic. +revision = '61ded0c8fbf6' +down_revision = 'dd3181b9b3e9' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('base_notification', + sa.Column('create_date', sa.DateTime(), nullable=True), + sa.Column('update_date', sa.DateTime(), nullable=True), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('data', faraday.server.fields.JSONType(), nullable=False), + sa.Column('processed', sa.Boolean(), nullable=True), + sa.Column('creator_id', sa.Integer(), nullable=True), + sa.Column('update_user_id', sa.Integer(), nullable=True), + sa.Column('verbose', sa.Boolean(), nullable=False), + sa.ForeignKeyConstraint(['creator_id'], ['faraday_user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['update_user_id'], ['faraday_user.id'], ondelete='SET NULL'), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('user_notification', + sa.Column('create_date', sa.DateTime(), nullable=True), + sa.Column('update_date', sa.DateTime(), nullable=True), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('message', sa.Text(), nullable=False), + sa.Column('extra_data', faraday.server.fields.JSONType(), nullable=True), + sa.Column('type', sa.String(), nullable=False), + sa.Column('subtype', sa.String(), nullable=False), + sa.Column('read', sa.Boolean(), nullable=True), + sa.Column('user_id', sa.Integer(), nullable=False), + sa.Column('creator_id', sa.Integer(), nullable=True), + sa.Column('update_user_id', sa.Integer(), nullable=True), + sa.Column('triggered_by', faraday.server.fields.JSONType(), nullable=False), + sa.Column('links_to', faraday.server.fields.JSONType(), nullable=True), + sa.Column('event_date', sa.DateTime(), nullable=False), + sa.ForeignKeyConstraint(['creator_id'], ['faraday_user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['update_user_id'], ['faraday_user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['user_id'], ['faraday_user.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_user_notification_user_id'), 'user_notification', ['user_id'], unique=False) + op.create_table('user_notification_settings', + sa.Column('create_date', sa.DateTime(), nullable=True), + sa.Column('update_date', sa.DateTime(), nullable=True), + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('user_id', sa.Integer(), nullable=False), + sa.Column('paused', sa.Boolean(), nullable=False), + sa.Column('slack_id', sa.String(), nullable=True), + sa.Column('no_self_notify', sa.Boolean(), nullable=False), + sa.Column('agents_enabled', sa.Boolean(), nullable=False), + sa.Column('agents_app', sa.Boolean(), nullable=False), + sa.Column('agents_email', sa.Boolean(), nullable=False), + sa.Column('agents_slack', sa.Boolean(), nullable=False), + sa.Column('cli_enabled', sa.Boolean(), nullable=False), + sa.Column('cli_app', sa.Boolean(), nullable=False), + sa.Column('cli_email', sa.Boolean(), nullable=False), + sa.Column('cli_slack', sa.Boolean(), nullable=False), + sa.Column('comments_enabled', sa.Boolean(), nullable=False), + sa.Column('comments_app', sa.Boolean(), nullable=False), + sa.Column('comments_email', sa.Boolean(), nullable=False), + sa.Column('comments_slack', sa.Boolean(), nullable=False), + sa.Column('hosts_enabled', sa.Boolean(), nullable=False), + sa.Column('hosts_app', sa.Boolean(), nullable=False), + sa.Column('hosts_email', sa.Boolean(), nullable=False), + sa.Column('hosts_slack', sa.Boolean(), nullable=False), + sa.Column('users_enabled', sa.Boolean(), nullable=False), + sa.Column('users_app', sa.Boolean(), nullable=False), + sa.Column('users_email', sa.Boolean(), nullable=False), + sa.Column('users_slack', sa.Boolean(), nullable=False), + sa.Column('reports_enabled', sa.Boolean(), nullable=False), + sa.Column('reports_app', sa.Boolean(), nullable=False), + sa.Column('reports_email', sa.Boolean(), nullable=False), + sa.Column('reports_slack', sa.Boolean(), nullable=False), + sa.Column('vulnerabilities_enabled', sa.Boolean(), nullable=False), + sa.Column('vulnerabilities_app', sa.Boolean(), nullable=False), + sa.Column('vulnerabilities_email', sa.Boolean(), nullable=False), + sa.Column('vulnerabilities_slack', sa.Boolean(), nullable=False), + sa.Column('workspaces_enabled', sa.Boolean(), nullable=False), + sa.Column('workspaces_app', sa.Boolean(), nullable=False), + sa.Column('workspaces_email', sa.Boolean(), nullable=False), + sa.Column('workspaces_slack', sa.Boolean(), nullable=False), + sa.Column('pipelines_enabled', sa.Boolean(), nullable=False), + sa.Column('pipelines_app', sa.Boolean(), nullable=False), + sa.Column('pipelines_email', sa.Boolean(), nullable=False), + sa.Column('pipelines_slack', sa.Boolean(), nullable=False), + sa.Column('executive_reports_enabled', sa.Boolean(), nullable=False), + sa.Column('executive_reports_app', sa.Boolean(), nullable=False), + sa.Column('executive_reports_email', sa.Boolean(), nullable=False), + sa.Column('executive_reports_slack', sa.Boolean(), nullable=False), + sa.Column('planner_enabled', sa.Boolean(), nullable=False), + sa.Column('planner_app', sa.Boolean(), nullable=False), + sa.Column('planner_email', sa.Boolean(), nullable=False), + sa.Column('planner_slack', sa.Boolean(), nullable=False), + sa.Column('integrations_enabled', sa.Boolean(), nullable=False), + sa.Column('integrations_app', sa.Boolean(), nullable=False), + sa.Column('integrations_email', sa.Boolean(), nullable=False), + sa.Column('integrations_slack', sa.Boolean(), nullable=False), + sa.Column('other_enabled', sa.Boolean(), nullable=False), + sa.Column('other_app', sa.Boolean(), nullable=False), + sa.Column('other_email', sa.Boolean(), nullable=False), + sa.Column('other_slack', sa.Boolean(), nullable=False), + sa.Column('adv_high_crit_vuln', sa.Boolean(), nullable=False), + sa.Column('adv_risk_score_threshold', sa.Integer(), nullable=False), + sa.Column('adv_vuln_open_days', sa.Integer(), nullable=False), + sa.Column('creator_id', sa.Integer(), nullable=True), + sa.Column('update_user_id', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['creator_id'], ['faraday_user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['update_user_id'], ['faraday_user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['user_id'], ['faraday_user.id'], ), + sa.PrimaryKeyConstraint('id') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('user_notification_settings') + op.drop_index(op.f('ix_user_notification_user_id'), table_name='user_notification') + op.drop_table('user_notification') + op.drop_table('base_notification') + # ### end Alembic commands ### diff --git a/faraday/server/models.py b/faraday/server/models.py index 0740428277d..43442989ee5 100644 --- a/faraday/server/models.py +++ b/faraday/server/models.py @@ -3206,6 +3206,121 @@ class Analytics(Metadata): show_data_table = Column(Boolean, default=False) +class BaseNotification(Metadata): + __tablename__ = "base_notification" + + id = Column(Integer, primary_key=True) + data = Column(JSONType, nullable=False) + processed = Column(Boolean, default=False) + verbose = Column(Boolean, default=False) + + +class UserNotification(Metadata): + __tablename__ = "user_notification" + + id = Column(Integer, primary_key=True) + message = Column(Text, nullable=False) + extra_data = Column(JSONType, nullable=True) + type = Column(String, nullable=False) + subtype = Column(String, nullable=False) + read = Column(Boolean, default=False) + triggered_by = Column(JSONType) + user_id = Column(Integer, ForeignKey('faraday_user.id'), index=True, nullable=False) + user = relationship('User', + backref=backref('user_notifications', cascade="all, delete-orphan"), + foreign_keys=[user_id]) + links_to = Column(JSONType, nullable=True) + event_date = Column(DateTime, default=datetime.utcnow(), nullable=False) + + def mark_as_read(self): + self.read = True + + def __repr__(self): + return f"{self.message}" + + +class UserNotificationSettings(Metadata): + __tablename__ = 'user_notification_settings' + id = Column(Integer, primary_key=True) + user_id = Column(Integer, ForeignKey('faraday_user.id')) + user = relationship('User', + backref=backref('notification_settings', uselist=False, cascade="all, delete-orphan"), + foreign_keys=[user_id]) + + paused = Column(Boolean, default=False) + slack_id = Column(String, nullable=True, default=None) + no_self_notify = Column(Boolean, default=False) + + agents_enabled = Column(Boolean, default=True) + agents_app = Column(Boolean, default=True) + agents_email = Column(Boolean, default=False) + agents_slack = Column(Boolean, default=False) + + cli_enabled = Column(Boolean, default=True) + cli_app = Column(Boolean, default=True) + cli_email = Column(Boolean, default=False) + cli_slack = Column(Boolean, default=False) + + comments_enabled = Column(Boolean, default=True) + comments_app = Column(Boolean, default=True) + comments_email = Column(Boolean, default=False) + comments_slack = Column(Boolean, default=False) + + hosts_enabled = Column(Boolean, default=True) + hosts_app = Column(Boolean, default=True) + hosts_email = Column(Boolean, default=False) + hosts_slack = Column(Boolean, default=False) + + users_enabled = Column(Boolean, default=True) + users_app = Column(Boolean, default=True) + users_email = Column(Boolean, default=False) + users_slack = Column(Boolean, default=False) + + reports_enabled = Column(Boolean, default=True) + reports_app = Column(Boolean, default=True) + reports_email = Column(Boolean, default=False) + reports_slack = Column(Boolean, default=False) + + vulnerabilities_enabled = Column(Boolean, default=True) + vulnerabilities_app = Column(Boolean, default=True) + vulnerabilities_email = Column(Boolean, default=False) + vulnerabilities_slack = Column(Boolean, default=False) + + workspaces_enabled = Column(Boolean, default=True) + workspaces_app = Column(Boolean, default=True) + workspaces_email = Column(Boolean, default=False) + workspaces_slack = Column(Boolean, default=False) + + pipelines_enabled = Column(Boolean, default=True) + pipelines_app = Column(Boolean, default=True) + pipelines_email = Column(Boolean, default=False) + pipelines_slack = Column(Boolean, default=False) + + executive_reports_enabled = Column(Boolean, default=True) + executive_reports_app = Column(Boolean, default=True) + executive_reports_email = Column(Boolean, default=False) + executive_reports_slack = Column(Boolean, default=False) + + planner_enabled = Column(Boolean, default=True) + planner_app = Column(Boolean, default=True) + planner_email = Column(Boolean, default=False) + planner_slack = Column(Boolean, default=False) + + integrations_enabled = Column(Boolean, default=True) + integrations_app = Column(Boolean, default=True) + integrations_email = Column(Boolean, default=False) + integrations_slack = Column(Boolean, default=False) + + other_enabled = Column(Boolean, default=True) + other_app = Column(Boolean, default=True) + other_email = Column(Boolean, default=False) + other_slack = Column(Boolean, default=False) + + adv_high_crit_vuln = Column(Boolean, default=False) + adv_risk_score_threshold = Column(Integer, default=0) + adv_vuln_open_days = Column(Integer, default=0) + + # Indexes to speed up queries Index("idx_vulnerability_severity_hostid_serviceid", VulnerabilityGeneric.__table__.c.severity, From 0080ed3783fc5ae4c073593b24415307c64fbab8 Mon Sep 17 00:00:00 2001 From: Diego Nadares Date: Thu, 24 Aug 2023 14:17:22 -0300 Subject: [PATCH 09/14] Run pynixify and update swagger --- faraday/__init__.py | 2 +- faraday/openapi/faraday_swagger.json | 1310 ++++++++--------- .../default.nix | 4 +- pynixify/packages/faraday-plugins/default.nix | 4 +- pynixify/packages/faradaysec/default.nix | 2 +- requirements.txt | 2 +- 6 files changed, 662 insertions(+), 662 deletions(-) diff --git a/faraday/__init__.py b/faraday/__init__.py index 85c2b3e2296..05d1bb79587 100644 --- a/faraday/__init__.py +++ b/faraday/__init__.py @@ -4,5 +4,5 @@ See the file 'doc/LICENSE' for the license information """ -__version__ = '4.5.1' +__version__ = '4.6.0' __license_version__ = __version__ diff --git a/faraday/openapi/faraday_swagger.json b/faraday/openapi/faraday_swagger.json index 723a43468ef..674dd26e5b2 100644 --- a/faraday/openapi/faraday_swagger.json +++ b/faraday/openapi/faraday_swagger.json @@ -1,7 +1,7 @@ { "info": { "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.", - "title": "Faraday 4.5.0 API", + "title": "Faraday 4.6.0 API", "version": "v3" }, "security": { @@ -4176,42 +4176,20 @@ "Command": { "type": "object", "properties": { - "hostname": { - "type": "string", - "nullable": true, - "maxLength": 250 - }, - "ip": { - "type": "string", - "nullable": true, - "maxLength": 250 - }, - "tool": { - "type": "string", - "nullable": true, - "minLength": 1 - }, "command": { "type": "string", "nullable": true, "minLength": 1 }, - "_id": { - "type": "integer", - "readOnly": true - }, - "metadata": {}, - "params": { + "itime": {}, + "hostname": { "type": "string", - "nullable": true + "nullable": true, + "maxLength": 250 }, - "itime": {}, - "workspace": { + "creator": { "readOnly": true }, - "duration": { - "nullable": true - }, "import_source": { "enum": [ "report", @@ -4221,13 +4199,35 @@ "nullable": true, "maxLength": 6 }, - "creator": { + "ip": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "workspace": { + "readOnly": true + }, + "_id": { + "type": "integer", "readOnly": true }, + "duration": { + "nullable": true + }, "user": { "type": "string", "nullable": true, "maxLength": 250 + }, + "params": { + "type": "string", + "nullable": true + }, + "metadata": {}, + "tool": { + "type": "string", + "nullable": true, + "minLength": 1 } }, "required": [ @@ -4239,24 +4239,46 @@ "ActivityFeed": { "type": "object", "properties": { - "ip": { - "type": "string", - "nullable": true, - "maxLength": 250 + "sum_created_hosts": { + "readOnly": true, + "nullable": true }, - "_id": { + "sum_created_vulnerability_low": { "type": "integer", "readOnly": true }, + "workspace": { + "readOnly": true + }, "sum_created_vulnerability_high": { "type": "integer", "readOnly": true }, - "hostname": { + "params": { + "type": "string", + "nullable": true + }, + "sum_created_vulnerability_critical": { + "type": "integer", + "readOnly": true + }, + "sum_created_vulnerabilities": { + "readOnly": true, + "nullable": true + }, + "ip": { "type": "string", "nullable": true, "maxLength": 250 }, + "sum_created_vulnerability_info": { + "type": "integer", + "readOnly": true + }, + "sum_created_services": { + "readOnly": true, + "nullable": true + }, "tool": { "type": "string", "nullable": true, @@ -4267,19 +4289,16 @@ "nullable": true, "minLength": 1 }, - "sum_created_vulnerabilities": { - "readOnly": true, - "nullable": true - }, - "workspace": { - "readOnly": true - }, "itime": {}, - "sum_created_vulnerability_medium": { - "type": "integer", + "creator": { "readOnly": true }, - "sum_created_vulnerability_low": { + "user": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "sum_created_vulnerability_medium": { "type": "integer", "readOnly": true }, @@ -4287,6 +4306,11 @@ "type": "integer", "readOnly": true }, + "hostname": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, "import_source": { "enum": [ "report", @@ -4296,31 +4320,7 @@ "nullable": true, "maxLength": 6 }, - "user": { - "type": "string", - "nullable": true, - "maxLength": 250 - }, - "creator": { - "readOnly": true - }, - "sum_created_hosts": { - "readOnly": true, - "nullable": true - }, - "sum_created_vulnerability_critical": { - "type": "integer", - "readOnly": true - }, - "params": { - "type": "string", - "nullable": true - }, - "sum_created_services": { - "readOnly": true, - "nullable": true - }, - "sum_created_vulnerability_info": { + "_id": { "type": "integer", "readOnly": true } @@ -4335,54 +4335,54 @@ "type": "object", "properties": { "parent": {}, - "host_ip": { + "_rev": { "type": "string", "readOnly": true }, - "_rev": { + "name": { "type": "string", - "readOnly": true + "nullable": true }, - "couchdbid": { + "description": { "type": "string" }, - "service_name": { - "type": "string", + "password": { + "type": "string" + }, + "parent_type": {}, + "_id": { + "type": "integer", "readOnly": true }, "id": { "type": "integer" }, - "_id": { - "type": "integer", + "owned": { + "type": "boolean", "readOnly": true }, - "name": { - "type": "string", - "nullable": true + "couchdbid": { + "type": "string" }, - "metadata": {}, "owner": { "type": "string", "readOnly": true }, - "target": { - "type": "string", - "readOnly": true - }, "username": { "type": "string", "minLength": 1 }, - "description": { - "type": "string" + "service_name": { + "type": "string", + "readOnly": true }, - "parent_type": {}, - "password": { - "type": "string" + "metadata": {}, + "target": { + "type": "string", + "readOnly": true }, - "owned": { - "type": "boolean", + "host_ip": { + "type": "string", "readOnly": true } }, @@ -4395,74 +4395,74 @@ "Host": { "type": "object", "properties": { - "ip": { - "type": "string" - }, - "versions": { + "name": { + "type": "string", "readOnly": true }, - "_id": { - "type": "integer", + "hostnames": {}, + "type": { "readOnly": true }, - "vulns": { - "readOnly": true + "default_gateway": { + "type": "string", + "nullable": true + }, + "ip": { + "type": "string" }, "owned": { "type": "boolean" }, - "severity_counts": { + "credentials": { + "type": "integer", "readOnly": true }, "owner": { "readOnly": true }, - "services": { - "type": "integer", - "readOnly": true - }, - "command_id": { - "type": "integer", - "writeOnly": true - }, "os": { "type": "string" }, - "type": { - "readOnly": true - }, - "importance": { - "type": "integer" - }, - "hostnames": {}, - "metadata": {}, - "name": { - "type": "string", - "readOnly": true - }, - "default_gateway": { + "mac": { "type": "string", "nullable": true }, + "vulns": { + "readOnly": true + }, "description": { "type": "string" }, - "credentials": { - "type": "integer", + "metadata": {}, + "service_summaries": { "readOnly": true }, "_rev": { "type": "string", "readOnly": true }, + "importance": { + "type": "integer" + }, + "_id": { + "type": "integer", + "readOnly": true + }, "id": { "type": "integer" }, - "mac": { - "type": "string", - "nullable": true + "services": { + "type": "integer", + "readOnly": true }, - "service_summaries": { + "command_id": { + "type": "integer", + "writeOnly": true + }, + "versions": { + "readOnly": true + }, + "severity_counts": { "readOnly": true } }, @@ -4473,18 +4473,15 @@ "HostCount": { "type": "object", "properties": { - "total": { - "readOnly": true - }, - "critical": { + "info": { "type": "integer", "readOnly": true }, - "info": { + "low": { "type": "integer", "readOnly": true }, - "high": { + "host_id": { "type": "integer", "readOnly": true }, @@ -4492,11 +4489,14 @@ "type": "integer", "readOnly": true }, - "low": { + "total": { + "readOnly": true + }, + "critical": { "type": "integer", "readOnly": true }, - "host_id": { + "high": { "type": "integer", "readOnly": true }, @@ -4513,25 +4513,10 @@ "Service": { "type": "object", "properties": { - "version": { + "name": { "type": "string", "nullable": true }, - "_id": { - "type": "integer", - "readOnly": true - }, - "vulns": { - "type": "integer", - "readOnly": true - }, - "host_id": { - "type": "integer", - "readOnly": true - }, - "owned": { - "type": "boolean" - }, "status": { "type": "string", "default": "open", @@ -4541,12 +4526,28 @@ "filtered" ] }, + "type": { + "readOnly": true + }, + "port": { + "type": "integer", + "readOnly": true, + "minimum": 0 + }, + "ports": {}, + "owned": { + "type": "boolean" + }, + "credentials": { + "type": "integer", + "readOnly": true + }, "owner": { "readOnly": true }, - "command_id": { + "vulns": { "type": "integer", - "writeOnly": true + "readOnly": true }, "parent": { "type": "integer" @@ -4556,38 +4557,37 @@ "nullable": true, "minLength": 1 }, - "summary": { + "description": { "type": "string", - "readOnly": true + "nullable": true }, - "type": { + "summary": { + "type": "string", "readOnly": true }, "metadata": {}, - "name": { + "_rev": { "type": "string", - "nullable": true + "readOnly": true }, - "ports": {}, - "description": { + "version": { "type": "string", "nullable": true }, - "credentials": { + "host_id": { "type": "integer", "readOnly": true }, - "_rev": { - "type": "string", - "readOnly": true - }, - "port": { + "_id": { "type": "integer", - "readOnly": true, - "minimum": 0 + "readOnly": true }, "id": { "type": "integer" + }, + "command_id": { + "type": "integer", + "writeOnly": true } }, "required": [ @@ -4603,15 +4603,15 @@ "type": "string", "format": "date-time" }, + "notes": { + "type": "string", + "nullable": true + }, "product": { "type": "string", "nullable": true, "minLength": 1 }, - "lictype": { - "type": "string", - "nullable": true - }, "_id": { "type": "integer", "readOnly": true @@ -4619,7 +4619,7 @@ "id": { "type": "integer" }, - "notes": { + "lictype": { "type": "string", "nullable": true }, @@ -4632,21 +4632,37 @@ "product" ] }, - "Service1": { + "Reference": { "type": "object", "properties": { - "version": { - "type": "string", - "nullable": true + "type": { + "type": "string" }, + "name": { + "type": "string" + } + } + }, + "Service1": { + "type": "object", + "properties": { "_id": { "type": "integer", "readOnly": true }, + "protocol": { + "type": "string", + "nullable": true, + "minLength": 1 + }, "name": { "type": "string", "nullable": true }, + "version": { + "type": "string", + "nullable": true + }, "status": { "type": "string", "default": "open", @@ -4656,11 +4672,6 @@ "filtered" ] }, - "protocol": { - "type": "string", - "nullable": true, - "minLength": 1 - }, "summary": { "type": "string", "readOnly": true @@ -4672,64 +4683,27 @@ "protocol" ] }, - "Reference": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, "VulnerabilityWeb": { "type": "object", "properties": { - "pname": { - "type": "string" - }, - "confirmed": { - "type": "boolean" + "external_id": { + "type": "string", + "nullable": true }, - "query": { - "type": "string" + "name": { + "type": "string", + "nullable": true, + "minLength": 1 }, - "_attachments": {}, - "_id": { - "type": "integer", + "tags": { "readOnly": true }, - "cwe": { - "type": "array", - "items": { - "type": "string" - } - }, "response": { "type": "string" }, - "owned": { - "type": "boolean", + "hostnames": { "readOnly": true }, - "data": { - "type": "string", - "nullable": true - }, - "cvss2": {}, - "tool": { - "type": "string" - }, - "service": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/Service1" - } - ] - }, - "impact": {}, "status": { "enum": [ "open", @@ -4739,10 +4713,17 @@ "opened" ] }, - "owner": { - "readOnly": true + "refs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Reference" + } }, - "target": { + "status_code": { + "type": "integer", + "nullable": true + }, + "host_os": { "type": "string", "readOnly": true }, @@ -4753,98 +4734,103 @@ "type": "string" } }, - "tags": { - "readOnly": true - }, - "refs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Reference" - } - }, - "issuetracker": { - "readOnly": true - }, - "parent_type": {}, - "desc": { + "params": { "type": "string" }, - "website": { - "type": "string" + "target": { + "type": "string", + "readOnly": true }, "resolution": { "type": "string", "nullable": true }, - "command_id": { - "type": "integer", - "writeOnly": true - }, - "parent": {}, - "severity": { + "query": { "type": "string" }, "type": {}, "custom_fields": {}, - "hostnames": { - "readOnly": true - }, - "path": { + "_attachments": {}, + "cvss3": {}, + "request": { "type": "string" }, - "name": { - "type": "string", - "nullable": true, - "minLength": 1 - }, - "policyviolations": { - "type": "array", - "items": { - "type": "string" - } - }, - "method": { + "website": { "type": "string" }, - "metadata": {}, - "risk": { - "readOnly": true + "confirmed": { + "type": "boolean" }, - "host_os": { - "type": "string", + "owned": { + "type": "boolean", "readOnly": true }, - "description": { - "type": "string", + "issuetracker": { "readOnly": true }, - "cvss3": {}, - "_rev": { - "type": "string", + "owner": { "readOnly": true }, - "status_code": { - "type": "integer", + "data": { + "type": "string", "nullable": true }, - "cve": { + "path": { + "type": "string" + }, + "tool": { + "type": "string" + }, + "method": { + "type": "string" + }, + "parent": {}, + "description": { + "type": "string", + "readOnly": true + }, + "desc": { + "type": "string" + }, + "reference_instances": {}, + "pname": { + "type": "string" + }, + "service": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/Service1" + } + ] + }, + "metadata": {}, + "cwe": { "type": "array", "items": { "type": "string" } }, - "external_id": { + "cvss2": {}, + "cve": { + "type": "array", + "items": { + "type": "string" + } + }, + "_rev": { "type": "string", - "nullable": true + "readOnly": true + }, + "parent_type": {}, + "risk": { + "readOnly": true }, "date": { "type": "string", "format": "date-time", "readOnly": true }, - "params": { - "type": "string" - }, "easeofresolution": { "type": "string", "enum": [ @@ -4856,14 +4842,28 @@ ], "nullable": true }, - "request": { - "type": "string" + "_id": { + "type": "integer", + "readOnly": true + }, + "policyviolations": { + "type": "array", + "items": { + "type": "string" + } + }, + "command_id": { + "type": "integer", + "writeOnly": true }, - "reference_instances": {}, "obj_id": { "type": "string", "readOnly": true - } + }, + "severity": { + "type": "string" + }, + "impact": {} }, "required": [ "name", @@ -4876,10 +4876,10 @@ "Evidence": { "type": "object", "properties": { - "content_type": { + "data": { "readOnly": true }, - "data": { + "content_type": { "readOnly": true } } @@ -4887,27 +4887,15 @@ "VulnerabilityTemplate": { "type": "object", "properties": { - "_id": { - "type": "integer", - "readOnly": true - }, - "create_at": { + "external_id": { "type": "string", - "format": "date-time", - "readOnly": true + "nullable": true }, - "cwe": { + "name": { "type": "string", - "readOnly": true - }, - "data": { - "type": "string" - }, - "creator_id": { - "type": "integer", - "readOnly": true + "nullable": true, + "minLength": 1 }, - "impact": {}, "refs": { "type": "array", "readOnly": true, @@ -4915,29 +4903,22 @@ "type": "string" } }, - "exploitation": { - "type": "string" - }, - "desc": { - "type": "string", - "readOnly": true - }, + "references": {}, + "customfields": {}, "resolution": { "type": "string", "nullable": true }, - "policyviolations": { - "type": "array", - "items": { - "type": "string" - } + "exploitation": { + "type": "string" }, - "name": { - "type": "string", - "nullable": true, - "minLength": 1 + "data": { + "type": "string" + }, + "creator_id": { + "type": "integer", + "readOnly": true }, - "customfields": {}, "description": { "type": "string", "nullable": true @@ -4945,17 +4926,16 @@ "creator": { "readOnly": true }, - "_rev": { + "desc": { "type": "string", "readOnly": true }, - "references": {}, - "external_id": { + "cwe": { "type": "string", - "nullable": true + "readOnly": true }, - "id": { - "type": "integer", + "_rev": { + "type": "string", "readOnly": true }, "easeofresolution": { @@ -4968,7 +4948,27 @@ "infeasible" ], "nullable": true - } + }, + "_id": { + "type": "integer", + "readOnly": true + }, + "id": { + "type": "integer", + "readOnly": true + }, + "policyviolations": { + "type": "array", + "items": { + "type": "string" + } + }, + "create_at": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "impact": {} }, "required": [ "exploitation", @@ -4978,20 +4978,20 @@ "Histogram": { "type": "object", "properties": { - "critical": { - "type": "integer", + "date": { + "type": "string", "readOnly": true }, "confirmed": { "type": "integer", "readOnly": true }, - "medium": { + "critical": { "type": "integer", "readOnly": true }, - "date": { - "type": "string", + "medium": { + "type": "integer", "readOnly": true }, "high": { @@ -5003,24 +5003,35 @@ "Workspace": { "type": "object", "properties": { - "active": { - "type": "boolean" - }, - "histogram": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Histogram" - } + "customer": { + "type": "string", + "nullable": true, + "maxLength": 250 }, - "stats": {}, "last_run_agent_date": { "type": "string", "format": "date-time", "readOnly": true }, + "name": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "create_date": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "scope": {}, "importance": { "type": "integer" }, + "public": { + "type": "boolean" + }, "_id": { "type": "integer", "readOnly": true @@ -5028,36 +5039,25 @@ "id": { "type": "integer" }, - "name": { - "type": "string" - }, - "create_date": { - "type": "string", - "format": "date-time", - "readOnly": true + "stats": {}, + "duration": {}, + "active": { + "type": "boolean" }, "update_date": { "type": "string", "format": "date-time", "readOnly": true }, - "duration": {}, - "readonly": { - "type": "boolean" - }, - "description": { - "type": "string", - "nullable": true + "histogram": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Histogram" + } }, - "public": { + "readonly": { "type": "boolean" - }, - "customer": { - "type": "string", - "nullable": true, - "maxLength": 250 - }, - "scope": {} + } }, "required": [ "name" @@ -5066,11 +5066,11 @@ "Comment": { "type": "object", "properties": { - "id": { + "object_id": { "type": "integer" }, - "text": { - "type": "string" + "id": { + "type": "integer" }, "object_type": { "type": "string", @@ -5081,8 +5081,8 @@ "vulnerability" ] }, - "object_id": { - "type": "integer" + "text": { + "type": "string" } }, "required": [ @@ -5094,28 +5094,28 @@ "CustomFieldsSchema": { "type": "object", "properties": { + "field_order": { + "type": "integer" + }, "field_display_name": { "type": "string" }, "field_name": { "type": "string" }, - "id": { - "type": "integer", - "readOnly": true - }, "field_type": { "type": "string" }, - "field_order": { - "type": "integer" - }, - "table_name": { - "type": "string" + "id": { + "type": "integer", + "readOnly": true }, "field_metadata": { "type": "string", "nullable": true + }, + "table_name": { + "type": "string" } }, "required": [ @@ -5144,8 +5144,8 @@ "Executor": { "type": "object", "properties": { - "parameters_metadata": { - "type": "object", + "name": { + "type": "string", "readOnly": true }, "last_run": { @@ -5153,14 +5153,6 @@ "format": "date-time", "readOnly": true }, - "id": { - "type": "integer", - "readOnly": true - }, - "name": { - "type": "string", - "readOnly": true - }, "schedules": { "readOnly": true, "allOf": [ @@ -5169,50 +5161,61 @@ } ] }, + "id": { + "type": "integer", + "readOnly": true + }, "agent_id": { "type": "integer", "readOnly": true + }, + "parameters_metadata": { + "type": "object", + "readOnly": true } } }, "Agent": { "type": "object", "properties": { - "active": { - "type": "boolean", - "nullable": true - }, - "is_online": { - "type": "boolean", - "readOnly": true + "name": { + "type": "string", + "nullable": true, + "minLength": 1 }, "last_run": { "type": "string", "format": "date-time", "readOnly": true }, - "id": { - "type": "integer" + "creator": { + "readOnly": true }, - "name": { + "create_date": { "type": "string", - "nullable": true, - "minLength": 1 + "format": "date-time", + "readOnly": true }, "status": { "type": "string", "readOnly": true }, - "create_date": { - "type": "string", - "format": "date-time", - "readOnly": true + "id": { + "type": "integer" }, "update_date": { "type": "string", "format": "date-time", "readOnly": true }, + "is_online": { + "type": "boolean", + "readOnly": true + }, + "active": { + "type": "boolean", + "nullable": true + }, "executors": { "readOnly": true, "allOf": [ @@ -5220,9 +5223,6 @@ "$ref": "#/components/schemas/Executor" } ] - }, - "creator": { - "readOnly": true } }, "required": [ @@ -5232,14 +5232,14 @@ "AgentAuthToken": { "type": "object", "properties": { - "token": { - "type": "string" + "expires_in": { + "type": "number" }, "total_duration": { "type": "number" }, - "expires_in": { - "type": "number" + "token": { + "type": "string" } }, "required": [ @@ -5248,44 +5248,102 @@ "total_duration" ] }, - "Vulnerability": { + "BulkCommand": { "type": "object", "properties": { - "confirmed": { - "type": "boolean" + "command": { + "type": "string", + "nullable": true, + "minLength": 1 }, - "_attachments": {}, - "_id": { - "type": "integer", - "readOnly": true + "start_date": { + "type": "string", + "format": "date-time" }, - "cwe": { - "type": "array", - "items": { - "type": "string" - } + "hostname": { + "type": "string", + "nullable": true, + "maxLength": 250 }, - "owned": { - "type": "boolean", - "readOnly": true + "creator": {}, + "import_source": { + "enum": [ + "report", + "shell", + "agent" + ], + "nullable": true, + "maxLength": 6 }, - "data": { + "ip": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "duration": { + "type": "integer", + "x-unit": "microseconds" + }, + "user": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "params": { "type": "string", "nullable": true }, - "cvss2": {}, "tool": { - "type": "string" + "type": "string", + "nullable": true, + "minLength": 1 + } + }, + "required": [ + "command", + "start_date", + "tool" + ] + }, + "BulkCredential": { + "type": "object", + "properties": { + "description": { + "type": "string", + "nullable": true }, - "service": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/Service1" - } - ] + "name": { + "type": "string", + "nullable": true + }, + "username": { + "type": "string", + "nullable": true + }, + "password": { + "type": "string", + "nullable": true + } + } + }, + "Vulnerability": { + "type": "object", + "properties": { + "external_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true, + "minLength": 1 + }, + "tags": { + "readOnly": true + }, + "hostnames": { + "readOnly": true }, - "impact": {}, "status": { "enum": [ "open", @@ -5295,10 +5353,13 @@ "opened" ] }, - "owner": { - "readOnly": true + "refs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Reference" + } }, - "target": { + "host_os": { "type": "string", "readOnly": true }, @@ -5309,65 +5370,62 @@ "type": "string" } }, - "tags": { - "readOnly": true - }, - "refs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Reference" - } - }, - "issuetracker": { + "target": { + "type": "string", "readOnly": true }, - "desc": { - "type": "string" - }, "resolution": { "type": "string", "nullable": true }, - "command_id": { - "type": "integer", - "writeOnly": true - }, - "run_date": {}, - "severity": { - "type": "string" - }, "type": {}, + "run_date": {}, "custom_fields": {}, - "hostnames": { - "readOnly": true + "_attachments": {}, + "cvss3": {}, + "confirmed": { + "type": "boolean" }, - "policyviolations": { - "type": "array", - "items": { - "type": "string" - } + "owned": { + "type": "boolean", + "readOnly": true }, - "name": { - "type": "string", - "nullable": true, - "minLength": 1 + "issuetracker": { + "readOnly": true }, - "metadata": {}, - "risk": { + "owner": { "readOnly": true }, - "host_os": { + "data": { "type": "string", - "readOnly": true + "nullable": true + }, + "tool": { + "type": "string" }, "description": { "type": "string", "readOnly": true }, - "cvss3": {}, - "_rev": { - "type": "string", - "readOnly": true + "desc": { + "type": "string" + }, + "reference_instances": {}, + "service": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/Service1" + } + ] + }, + "metadata": {}, + "cvss2": {}, + "cwe": { + "type": "array", + "items": { + "type": "string" + } }, "cve": { "type": "array", @@ -5375,9 +5433,12 @@ "type": "string" } }, - "external_id": { + "_rev": { "type": "string", - "nullable": true + "readOnly": true + }, + "risk": { + "readOnly": true }, "date": { "type": "string", @@ -5395,11 +5456,28 @@ ], "nullable": true }, - "reference_instances": {}, + "_id": { + "type": "integer", + "readOnly": true + }, + "policyviolations": { + "type": "array", + "items": { + "type": "string" + } + }, + "command_id": { + "type": "integer", + "writeOnly": true + }, "obj_id": { "type": "string", "readOnly": true - } + }, + "severity": { + "type": "string" + }, + "impact": {} }, "required": [ "name", @@ -5407,106 +5485,85 @@ "type" ] }, - "BulkCredential": { + "BulkService": { "type": "object", "properties": { "name": { "type": "string", "nullable": true }, - "username": { - "type": "string", - "nullable": true - }, - "description": { - "type": "string", - "nullable": true - }, - "password": { - "type": "string", - "nullable": true - } - } - }, - "BulkService": { - "type": "object", - "properties": { - "version": { + "status": { "type": "string", - "nullable": true - }, - "_id": { - "type": "integer", - "readOnly": true - }, - "vulnerabilities": { - "default": [] + "default": "open", + "enum": [ + "open", + "closed", + "filtered" + ] }, - "vulns": { - "type": "integer", + "type": { "readOnly": true }, - "host_id": { + "port": { "type": "integer", - "readOnly": true + "minimum": 0 }, "owned": { "type": "boolean" }, - "status": { - "type": "string", - "default": "open", - "enum": [ - "open", - "closed", - "filtered" - ] + "credentials": { + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkCredential" + } }, "owner": { "readOnly": true }, - "command_id": { + "vulns": { "type": "integer", - "writeOnly": true + "readOnly": true }, "protocol": { "type": "string", "nullable": true, "minLength": 1 }, - "summary": { + "description": { "type": "string", - "readOnly": true + "nullable": true }, - "type": { + "summary": { + "type": "string", "readOnly": true }, "metadata": {}, - "name": { + "vulnerabilities": { + "default": [] + }, + "_rev": { "type": "string", - "nullable": true + "readOnly": true }, - "description": { + "version": { "type": "string", "nullable": true }, - "credentials": { - "default": [], - "type": "array", - "items": { - "$ref": "#/components/schemas/BulkCredential" - } - }, - "_rev": { - "type": "string", + "host_id": { + "type": "integer", "readOnly": true }, - "port": { + "_id": { "type": "integer", - "minimum": 0 + "readOnly": true }, "id": { "type": "integer" + }, + "command_id": { + "type": "integer", + "writeOnly": true } }, "required": [ @@ -5517,157 +5574,100 @@ "HostBulk": { "type": "object", "properties": { - "ip": { - "type": "string" - }, - "versions": { + "name": { + "type": "string", "readOnly": true }, - "_id": { - "type": "integer", + "hostnames": {}, + "type": { "readOnly": true }, - "vulnerabilities": { - "default": [], - "type": "array", - "items": { - "$ref": "#/components/schemas/Vulnerability" - } + "default_gateway": { + "type": "string", + "nullable": true }, - "vulns": { - "readOnly": true + "ip": { + "type": "string" }, "owned": { "type": "boolean" }, - "severity_counts": { - "readOnly": true - }, - "owner": { - "readOnly": true - }, - "services": { + "credentials": { "default": [], "type": "array", "items": { - "$ref": "#/components/schemas/BulkService" + "$ref": "#/components/schemas/BulkCredential" } }, - "command_id": { - "type": "integer", - "writeOnly": true + "owner": { + "readOnly": true }, "os": { "type": "string" }, - "type": { - "readOnly": true - }, - "importance": { - "type": "integer" - }, - "hostnames": {}, - "metadata": {}, - "name": { - "type": "string", - "readOnly": true - }, - "default_gateway": { + "mac": { "type": "string", "nullable": true }, + "vulns": { + "readOnly": true + }, "description": { "type": "string" }, - "credentials": { + "metadata": {}, + "service_summaries": { + "readOnly": true + }, + "vulnerabilities": { "default": [], "type": "array", "items": { - "$ref": "#/components/schemas/BulkCredential" + "$ref": "#/components/schemas/Vulnerability" } }, "_rev": { "type": "string", "readOnly": true }, - "id": { + "importance": { "type": "integer" }, - "mac": { - "type": "string", - "nullable": true - }, - "service_summaries": { + "_id": { + "type": "integer", "readOnly": true - } - }, - "required": [ - "description", - "ip" - ] - }, - "BulkCommand": { - "type": "object", - "properties": { - "hostname": { - "type": "string", - "nullable": true, - "maxLength": 250 - }, - "ip": { - "type": "string", - "nullable": true, - "maxLength": 250 - }, - "tool": { - "type": "string", - "nullable": true, - "minLength": 1 - }, - "start_date": { - "type": "string", - "format": "date-time" }, - "command": { - "type": "string", - "nullable": true, - "minLength": 1 + "id": { + "type": "integer" }, - "params": { - "type": "string", - "nullable": true + "services": { + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkService" + } }, - "duration": { + "command_id": { "type": "integer", - "x-unit": "microseconds" + "writeOnly": true }, - "import_source": { - "enum": [ - "report", - "shell", - "agent" - ], - "nullable": true, - "maxLength": 6 + "versions": { + "readOnly": true }, - "creator": {}, - "user": { - "type": "string", - "nullable": true, - "maxLength": 250 + "severity_counts": { + "readOnly": true } }, "required": [ - "command", - "start_date", - "tool" + "description", + "ip" ] }, "BulkCreate": { "type": "object", "properties": { - "execution_id": { - "type": "integer" + "command": { + "$ref": "#/components/schemas/BulkCommand" }, "hosts": { "type": "array", @@ -5675,8 +5675,8 @@ "$ref": "#/components/schemas/HostBulk" } }, - "command": { - "$ref": "#/components/schemas/BulkCommand" + "execution_id": { + "type": "integer" } }, "required": [ @@ -5691,11 +5691,11 @@ "type": "integer", "readOnly": true }, - "name": { + "user_query": { "type": "string", "nullable": true }, - "user_query": { + "name": { "type": "string", "nullable": true }, diff --git a/pynixify/packages/faraday-agent-parameters-types/default.nix b/pynixify/packages/faraday-agent-parameters-types/default.nix index 35b74881a52..0521c441c4a 100644 --- a/pynixify/packages/faraday-agent-parameters-types/default.nix +++ b/pynixify/packages/faraday-agent-parameters-types/default.nix @@ -6,12 +6,12 @@ buildPythonPackage rec { pname = "faraday-agent-parameters-types"; - version = "1.3.0"; + version = "1.3.1"; src = fetchPypi { inherit version; pname = "faraday_agent_parameters_types"; - sha256 = "1f6fvnf0lnv02a4fliaf92l6cq8nx7cybna4p74d4pgkqf1rcssx"; + sha256 = "0axhkzcdjx4q9nnlsfjhg3v2v40n2pi22j1z0rv9h3bymwyxjq69"; }; buildInputs = [ pytest-runner ]; diff --git a/pynixify/packages/faraday-plugins/default.nix b/pynixify/packages/faraday-plugins/default.nix index a4faad86d96..00d3581d407 100644 --- a/pynixify/packages/faraday-plugins/default.nix +++ b/pynixify/packages/faraday-plugins/default.nix @@ -8,11 +8,11 @@ buildPythonPackage rec { pname = "faraday-plugins"; - version = "1.12.1"; + version = "1.13.1"; src = fetchPypi { inherit pname version; - sha256 = "1x3sf5wdipvn0zagws04nxrl08xxwismqyv0bg0k6zyxvj3hxqmc"; + sha256 = "054sxvn10234l72fkp3ya8nvl9mg48m29dbzz0a7c7dc1c6jix7w"; }; propagatedBuildInputs = [ diff --git a/pynixify/packages/faradaysec/default.nix b/pynixify/packages/faradaysec/default.nix index 99647cf17f5..15c94ba6b15 100644 --- a/pynixify/packages/faradaysec/default.nix +++ b/pynixify/packages/faradaysec/default.nix @@ -16,7 +16,7 @@ buildPythonPackage rec { pname = "faradaysec"; - version = "4.5.0"; + version = "4.6.0"; src = lib.cleanSource ../../..; diff --git a/requirements.txt b/requirements.txt index 4fe7fbd0620..72e84fd5e02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,7 +36,7 @@ syslog-rfc5424-formatter>=1.1.1 simplekv>=0.13.0 Flask-KVSession-fork>=0.6.4 distro>=1.4.0 -faraday-plugins>=1.12.1,<2.0.0 +faraday-plugins>=1.13.1,<2.0.0 apispec>=6.3.0 apispec-webframeworks>=0.5.2 pyyaml From 35c092b7ba6d970f582c9837a13e80a869312466 Mon Sep 17 00:00:00 2001 From: Nahuel Alonso Date: Wed, 30 Aug 2023 14:14:04 -0300 Subject: [PATCH 10/14] fix delete on cascade --- faraday/server/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faraday/server/models.py b/faraday/server/models.py index 43442989ee5..49380fc8946 100644 --- a/faraday/server/models.py +++ b/faraday/server/models.py @@ -1917,7 +1917,7 @@ class PolicyViolationVulnerabilityAssociation(db.Model): class ReferenceTemplateVulnerabilityAssociation(db.Model): __tablename__ = 'reference_template_vulnerability_association' - vulnerability_id = Column(Integer, ForeignKey('vulnerability_template.id'), primary_key=True) + vulnerability_id = Column(Integer, ForeignKey('vulnerability_template.id', ondelete='CASCADE'), primary_key=True) reference_id = Column(Integer, ForeignKey('reference_template.id'), primary_key=True) reference = relationship( @@ -1935,7 +1935,7 @@ class ReferenceTemplateVulnerabilityAssociation(db.Model): class PolicyViolationTemplateVulnerabilityAssociation(db.Model): __tablename__ = 'policy_violation_template_vulnerability_association' - vulnerability_id = Column(Integer, ForeignKey('vulnerability_template.id'), primary_key=True) + vulnerability_id = Column(Integer, ForeignKey('vulnerability_template.id', ondelete='CASCADE'), primary_key=True) policy_violation_id = Column(Integer, ForeignKey('policy_violation_template.id'), primary_key=True) policy_violation = relationship("PolicyViolationTemplate", From e3d4af096847e0d44acaa7863931327c1b888239 Mon Sep 17 00:00:00 2001 From: Pablo Perez Date: Wed, 30 Aug 2023 15:18:53 -0300 Subject: [PATCH 11/14] Add changelog --- CHANGELOG/current/7569.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 CHANGELOG/current/7569.json diff --git a/CHANGELOG/current/7569.json b/CHANGELOG/current/7569.json new file mode 100644 index 00000000000..6264ea7ec8b --- /dev/null +++ b/CHANGELOG/current/7569.json @@ -0,0 +1,4 @@ +{ + "level": "community", + "md": "[FIX] Delete Cascade from KB. #7569" +} From 378d0607f752d7d2084b331e4df3962a8ac92d58 Mon Sep 17 00:00:00 2001 From: Nahuel Alonso Date: Thu, 31 Aug 2023 14:18:07 -0300 Subject: [PATCH 12/14] migration --- .../versions/73854f804a8d_cascade_kb_2.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 faraday/migrations/versions/73854f804a8d_cascade_kb_2.py diff --git a/faraday/migrations/versions/73854f804a8d_cascade_kb_2.py b/faraday/migrations/versions/73854f804a8d_cascade_kb_2.py new file mode 100644 index 00000000000..2391260295f --- /dev/null +++ b/faraday/migrations/versions/73854f804a8d_cascade_kb_2.py @@ -0,0 +1,31 @@ +"""cascade KB 2 + +Revision ID: 73854f804a8d +Revises: 61ded0c8fbf6 +Create Date: 2023-08-31 17:16:51.813227+00:00 + +""" +from alembic import op + + +# revision identifiers, used by Alembic. +revision = '73854f804a8d' +down_revision = '61ded0c8fbf6' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute('ALTER TABLE policy_violation_template_vulnerability_association DROP CONSTRAINT policy_violation_template_vulnerability_a_vulnerability_id_fkey') + op.execute('ALTER TABLE policy_violation_template_vulnerability_association ADD CONSTRAINT policy_violation_template_vulnerability_a_vulnerability_id_fkey FOREIGN KEY (vulnerability_id) REFERENCES vulnerability_template (id) ON DELETE CASCADE') + + op.execute('ALTER TABLE reference_template_vulnerability_association DROP CONSTRAINT reference_template_vulnerability_associat_vulnerability_id_fkey') + op.execute('ALTER TABLE reference_template_vulnerability_association ADD CONSTRAINT reference_template_vulnerability_associat_vulnerability_id_fkey FOREIGN KEY (vulnerability_id) REFERENCES vulnerability_template (id) ON DELETE CASCADE') + + +def downgrade(): + op.execute('ALTER TABLE policy_violation_template_vulnerability_association DROP CONSTRAINT policy_violation_template_vulnerability_a_vulnerability_id_fkey') + op.execute('ALTER TABLE policy_violation_template_vulnerability_association ADD CONSTRAINT policy_violation_template_vulnerability_a_vulnerability_id_fkey FOREIGN KEY (vulnerability_id) REFERENCES vulnerability_template (id)') + + op.execute('ALTER TABLE reference_template_vulnerability_association DROP CONSTRAINT reference_template_vulnerability_associat_vulnerability_id_fkey') + op.execute('ALTER TABLE reference_template_vulnerability_association ADD CONSTRAINT reference_template_vulnerability_associat_vulnerability_id_fkey FOREIGN KEY (vulnerability_id) REFERENCES vulnerability_template (id)') From a2929477088529f3ce4d635d89b2cff93af53422 Mon Sep 17 00:00:00 2001 From: Diego Nadares Date: Wed, 6 Sep 2023 14:00:14 -0300 Subject: [PATCH 13/14] Run pynixify and update swagger --- faraday/openapi/faraday_swagger.json | 1316 ++++++++--------- pynixify/packages/faraday-plugins/default.nix | 4 +- requirements.txt | 2 +- 3 files changed, 661 insertions(+), 661 deletions(-) diff --git a/faraday/openapi/faraday_swagger.json b/faraday/openapi/faraday_swagger.json index 674dd26e5b2..c6c9135388d 100644 --- a/faraday/openapi/faraday_swagger.json +++ b/faraday/openapi/faraday_swagger.json @@ -4176,42 +4176,31 @@ "Command": { "type": "object", "properties": { + "_id": { + "type": "integer", + "readOnly": true + }, "command": { "type": "string", "nullable": true, "minLength": 1 }, + "duration": { + "nullable": true + }, "itime": {}, - "hostname": { + "ip": { "type": "string", "nullable": true, "maxLength": 250 }, - "creator": { - "readOnly": true - }, - "import_source": { - "enum": [ - "report", - "shell", - "agent" - ], - "nullable": true, - "maxLength": 6 - }, - "ip": { + "hostname": { "type": "string", "nullable": true, "maxLength": 250 }, - "workspace": { - "readOnly": true - }, - "_id": { - "type": "integer", - "readOnly": true - }, - "duration": { + "params": { + "type": "string", "nullable": true }, "user": { @@ -4219,16 +4208,27 @@ "nullable": true, "maxLength": 250 }, - "params": { - "type": "string", - "nullable": true + "creator": { + "readOnly": true + }, + "workspace": { + "readOnly": true }, - "metadata": {}, "tool": { "type": "string", "nullable": true, "minLength": 1 - } + }, + "import_source": { + "enum": [ + "report", + "shell", + "agent" + ], + "nullable": true, + "maxLength": 6 + }, + "metadata": {} }, "required": [ "command", @@ -4239,77 +4239,41 @@ "ActivityFeed": { "type": "object", "properties": { - "sum_created_hosts": { - "readOnly": true, - "nullable": true - }, - "sum_created_vulnerability_low": { - "type": "integer", - "readOnly": true - }, - "workspace": { - "readOnly": true - }, - "sum_created_vulnerability_high": { + "_id": { "type": "integer", "readOnly": true }, - "params": { + "command": { "type": "string", - "nullable": true - }, - "sum_created_vulnerability_critical": { - "type": "integer", - "readOnly": true - }, - "sum_created_vulnerabilities": { - "readOnly": true, - "nullable": true + "nullable": true, + "minLength": 1 }, "ip": { "type": "string", "nullable": true, "maxLength": 250 }, - "sum_created_vulnerability_info": { - "type": "integer", - "readOnly": true - }, - "sum_created_services": { - "readOnly": true, - "nullable": true - }, - "tool": { + "hostname": { "type": "string", "nullable": true, - "minLength": 1 + "maxLength": 250 }, - "command": { + "params": { "type": "string", - "nullable": true, - "minLength": 1 - }, - "itime": {}, - "creator": { - "readOnly": true + "nullable": true }, "user": { "type": "string", "nullable": true, "maxLength": 250 }, - "sum_created_vulnerability_medium": { - "type": "integer", - "readOnly": true - }, - "sum_created_vulnerability_unclassified": { - "type": "integer", + "workspace": { "readOnly": true }, - "hostname": { + "tool": { "type": "string", "nullable": true, - "maxLength": 250 + "minLength": 1 }, "import_source": { "enum": [ @@ -4320,9 +4284,45 @@ "nullable": true, "maxLength": 6 }, - "_id": { + "itime": {}, + "sum_created_vulnerabilities": { + "readOnly": true, + "nullable": true + }, + "sum_created_hosts": { + "readOnly": true, + "nullable": true + }, + "sum_created_services": { + "readOnly": true, + "nullable": true + }, + "sum_created_vulnerability_critical": { + "type": "integer", + "readOnly": true + }, + "sum_created_vulnerability_high": { + "type": "integer", + "readOnly": true + }, + "sum_created_vulnerability_medium": { + "type": "integer", + "readOnly": true + }, + "sum_created_vulnerability_low": { + "type": "integer", + "readOnly": true + }, + "sum_created_vulnerability_info": { + "type": "integer", + "readOnly": true + }, + "sum_created_vulnerability_unclassified": { "type": "integer", "readOnly": true + }, + "creator": { + "readOnly": true } }, "required": [ @@ -4334,29 +4334,36 @@ "Credential": { "type": "object", "properties": { - "parent": {}, + "id": { + "type": "integer" + }, + "_id": { + "type": "integer", + "readOnly": true + }, "_rev": { "type": "string", "readOnly": true }, - "name": { + "parent": {}, + "username": { "type": "string", - "nullable": true + "minLength": 1 }, "description": { "type": "string" }, + "name": { + "type": "string", + "nullable": true + }, "password": { "type": "string" }, - "parent_type": {}, - "_id": { - "type": "integer", + "owner": { + "type": "string", "readOnly": true }, - "id": { - "type": "integer" - }, "owned": { "type": "boolean", "readOnly": true @@ -4364,26 +4371,19 @@ "couchdbid": { "type": "string" }, - "owner": { + "parent_type": {}, + "metadata": {}, + "host_ip": { "type": "string", "readOnly": true }, - "username": { - "type": "string", - "minLength": 1 - }, "service_name": { "type": "string", "readOnly": true }, - "metadata": {}, "target": { "type": "string", "readOnly": true - }, - "host_ip": { - "type": "string", - "readOnly": true } }, "required": [ @@ -4395,75 +4395,75 @@ "Host": { "type": "object", "properties": { - "name": { - "type": "string", - "readOnly": true + "id": { + "type": "integer" }, - "hostnames": {}, - "type": { + "_id": { + "type": "integer", "readOnly": true }, - "default_gateway": { + "_rev": { "type": "string", - "nullable": true + "readOnly": true }, "ip": { "type": "string" }, - "owned": { - "type": "boolean" + "description": { + "type": "string" + }, + "mac": { + "type": "string", + "nullable": true }, "credentials": { "type": "integer", "readOnly": true }, - "owner": { + "default_gateway": { + "type": "string", + "nullable": true + }, + "metadata": {}, + "name": { + "type": "string", "readOnly": true }, "os": { "type": "string" }, - "mac": { - "type": "string", - "nullable": true + "owned": { + "type": "boolean" }, - "vulns": { + "owner": { "readOnly": true }, - "description": { - "type": "string" + "services": { + "type": "integer", + "readOnly": true }, - "metadata": {}, - "service_summaries": { + "vulns": { "readOnly": true }, - "_rev": { - "type": "string", + "hostnames": {}, + "type": { "readOnly": true }, - "importance": { - "type": "integer" + "service_summaries": { + "readOnly": true }, - "_id": { - "type": "integer", + "versions": { "readOnly": true }, - "id": { + "importance": { "type": "integer" }, - "services": { - "type": "integer", + "severity_counts": { "readOnly": true }, "command_id": { "type": "integer", "writeOnly": true - }, - "versions": { - "readOnly": true - }, - "severity_counts": { - "readOnly": true } }, "required": [ @@ -4473,15 +4473,15 @@ "HostCount": { "type": "object", "properties": { - "info": { + "host_id": { "type": "integer", "readOnly": true }, - "low": { + "critical": { "type": "integer", "readOnly": true }, - "host_id": { + "high": { "type": "integer", "readOnly": true }, @@ -4489,20 +4489,20 @@ "type": "integer", "readOnly": true }, - "total": { - "readOnly": true - }, - "critical": { + "low": { "type": "integer", "readOnly": true }, - "high": { + "info": { "type": "integer", "readOnly": true }, "unclassified": { "type": "integer", "readOnly": true + }, + "total": { + "readOnly": true } } }, @@ -4513,9 +4513,12 @@ "Service": { "type": "object", "properties": { - "name": { - "type": "string", - "nullable": true + "id": { + "type": "integer" + }, + "_id": { + "type": "integer", + "readOnly": true }, "status": { "type": "string", @@ -4526,65 +4529,62 @@ "filtered" ] }, + "parent": { + "type": "integer" + }, "type": { "readOnly": true }, - "port": { - "type": "integer", - "readOnly": true, - "minimum": 0 + "protocol": { + "type": "string", + "nullable": true, + "minLength": 1 + }, + "description": { + "type": "string", + "nullable": true + }, + "_rev": { + "type": "string", + "readOnly": true }, - "ports": {}, "owned": { "type": "boolean" }, - "credentials": { - "type": "integer", + "owner": { "readOnly": true }, - "owner": { + "credentials": { + "type": "integer", "readOnly": true }, "vulns": { "type": "integer", "readOnly": true }, - "parent": { - "type": "integer" - }, - "protocol": { + "name": { "type": "string", - "nullable": true, - "minLength": 1 + "nullable": true }, - "description": { + "version": { "type": "string", "nullable": true }, - "summary": { - "type": "string", - "readOnly": true + "port": { + "type": "integer", + "readOnly": true, + "minimum": 0 }, + "ports": {}, "metadata": {}, - "_rev": { + "summary": { "type": "string", "readOnly": true }, - "version": { - "type": "string", - "nullable": true - }, "host_id": { "type": "integer", "readOnly": true }, - "_id": { - "type": "integer", - "readOnly": true - }, - "id": { - "type": "integer" - }, "command_id": { "type": "integer", "writeOnly": true @@ -4599,50 +4599,39 @@ "License": { "type": "object", "properties": { - "start": { - "type": "string", - "format": "date-time" + "_id": { + "type": "integer", + "readOnly": true }, - "notes": { - "type": "string", - "nullable": true + "id": { + "type": "integer" }, "product": { "type": "string", "nullable": true, "minLength": 1 }, - "_id": { - "type": "integer", - "readOnly": true + "start": { + "type": "string", + "format": "date-time" }, - "id": { - "type": "integer" + "end": { + "type": "string", + "format": "date-time" }, "lictype": { "type": "string", "nullable": true }, - "end": { + "notes": { "type": "string", - "format": "date-time" + "nullable": true } }, "required": [ "product" ] }, - "Reference": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, "Service1": { "type": "object", "properties": { @@ -4650,6 +4639,16 @@ "type": "integer", "readOnly": true }, + "ports": {}, + "status": { + "type": "string", + "default": "open", + "enum": [ + "open", + "closed", + "filtered" + ] + }, "protocol": { "type": "string", "nullable": true, @@ -4663,45 +4662,32 @@ "type": "string", "nullable": true }, - "status": { - "type": "string", - "default": "open", - "enum": [ - "open", - "closed", - "filtered" - ] - }, "summary": { "type": "string", "readOnly": true - }, - "ports": {} + } }, "required": [ "ports", "protocol" ] }, - "VulnerabilityWeb": { + "Reference": { "type": "object", "properties": { - "external_id": { - "type": "string", - "nullable": true - }, "name": { - "type": "string", - "nullable": true, - "minLength": 1 - }, - "tags": { - "readOnly": true - }, - "response": { "type": "string" }, - "hostnames": { + "type": { + "type": "string" + } + } + }, + "VulnerabilityWeb": { + "type": "object", + "properties": { + "_id": { + "type": "integer", "readOnly": true }, "status": { @@ -4713,88 +4699,81 @@ "opened" ] }, - "refs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Reference" - } + "parent_type": {}, + "website": { + "type": "string" }, - "status_code": { - "type": "integer", - "nullable": true + "issuetracker": { + "readOnly": true }, - "host_os": { + "description": { "type": "string", "readOnly": true }, - "owasp": { - "type": "array", - "readOnly": true, - "items": { - "type": "string" - } + "parent": {}, + "tags": { + "readOnly": true }, - "params": { + "severity": { "type": "string" }, - "target": { + "_rev": { "type": "string", "readOnly": true }, - "resolution": { + "easeofresolution": { "type": "string", + "enum": [ + "trivial", + "simple", + "moderate", + "difficult", + "infeasible" + ], "nullable": true }, - "query": { - "type": "string" + "owned": { + "type": "boolean", + "readOnly": true }, - "type": {}, - "custom_fields": {}, - "_attachments": {}, - "cvss3": {}, - "request": { - "type": "string" + "hostnames": { + "readOnly": true }, - "website": { + "pname": { "type": "string" }, - "confirmed": { - "type": "boolean" + "query": { + "type": "string" }, - "owned": { - "type": "boolean", + "owner": { "readOnly": true }, - "issuetracker": { - "readOnly": true + "path": { + "type": "string" }, - "owner": { + "date": { + "type": "string", + "format": "date-time", "readOnly": true }, "data": { "type": "string", "nullable": true }, - "path": { + "response": { "type": "string" }, - "tool": { + "desc": { "type": "string" }, - "method": { - "type": "string" + "impact": {}, + "confirmed": { + "type": "boolean" }, - "parent": {}, - "description": { + "name": { "type": "string", - "readOnly": true - }, - "desc": { - "type": "string" - }, - "reference_instances": {}, - "pname": { - "type": "string" + "nullable": true, + "minLength": 1 }, "service": { "readOnly": true, @@ -4804,66 +4783,87 @@ } ] }, - "metadata": {}, - "cwe": { - "type": "array", - "items": { - "type": "string" - } + "obj_id": { + "type": "string", + "readOnly": true }, - "cvss2": {}, - "cve": { + "type": {}, + "policyviolations": { "type": "array", "items": { "type": "string" } }, - "_rev": { - "type": "string", - "readOnly": true + "request": { + "type": "string" }, - "parent_type": {}, - "risk": { + "_attachments": {}, + "params": { + "type": "string" + }, + "target": { + "type": "string", "readOnly": true }, - "date": { + "host_os": { "type": "string", - "format": "date-time", "readOnly": true }, - "easeofresolution": { + "resolution": { "type": "string", - "enum": [ - "trivial", - "simple", - "moderate", - "difficult", - "infeasible" - ], "nullable": true }, - "_id": { + "method": { + "type": "string" + }, + "metadata": {}, + "status_code": { "type": "integer", - "readOnly": true + "nullable": true }, - "policyviolations": { + "custom_fields": {}, + "external_id": { + "type": "string", + "nullable": true + }, + "tool": { + "type": "string" + }, + "cve": { + "type": "array", + "items": { + "type": "string" + } + }, + "cwe": { "type": "array", "items": { "type": "string" } }, + "owasp": { + "type": "array", + "readOnly": true, + "items": { + "type": "string" + } + }, + "cvss2": {}, + "cvss3": {}, + "refs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Reference" + } + }, + "reference_instances": {}, "command_id": { "type": "integer", "writeOnly": true }, - "obj_id": { - "type": "string", + "risk": { "readOnly": true - }, - "severity": { - "type": "string" - }, - "impact": {} + } }, "required": [ "name", @@ -4876,10 +4876,10 @@ "Evidence": { "type": "object", "properties": { - "data": { + "content_type": { "readOnly": true }, - "content_type": { + "data": { "readOnly": true } } @@ -4887,15 +4887,39 @@ "VulnerabilityTemplate": { "type": "object", "properties": { - "external_id": { + "id": { + "type": "integer", + "readOnly": true + }, + "_id": { + "type": "integer", + "readOnly": true + }, + "_rev": { + "type": "string", + "readOnly": true + }, + "cwe": { + "type": "string", + "readOnly": true + }, + "description": { "type": "string", "nullable": true }, + "desc": { + "type": "string", + "readOnly": true + }, + "exploitation": { + "type": "string" + }, "name": { "type": "string", "nullable": true, "minLength": 1 }, + "references": {}, "refs": { "type": "array", "readOnly": true, @@ -4903,41 +4927,11 @@ "type": "string" } }, - "references": {}, - "customfields": {}, "resolution": { "type": "string", "nullable": true }, - "exploitation": { - "type": "string" - }, - "data": { - "type": "string" - }, - "creator_id": { - "type": "integer", - "readOnly": true - }, - "description": { - "type": "string", - "nullable": true - }, - "creator": { - "readOnly": true - }, - "desc": { - "type": "string", - "readOnly": true - }, - "cwe": { - "type": "string", - "readOnly": true - }, - "_rev": { - "type": "string", - "readOnly": true - }, + "impact": {}, "easeofresolution": { "type": "string", "enum": [ @@ -4949,26 +4943,32 @@ ], "nullable": true }, - "_id": { - "type": "integer", - "readOnly": true - }, - "id": { - "type": "integer", - "readOnly": true - }, "policyviolations": { "type": "array", "items": { "type": "string" } }, + "data": { + "type": "string" + }, + "external_id": { + "type": "string", + "nullable": true + }, + "creator": { + "readOnly": true + }, "create_at": { "type": "string", "format": "date-time", "readOnly": true }, - "impact": {} + "creator_id": { + "type": "integer", + "readOnly": true + }, + "customfields": {} }, "required": [ "exploitation", @@ -4982,19 +4982,19 @@ "type": "string", "readOnly": true }, - "confirmed": { + "medium": { "type": "integer", "readOnly": true }, - "critical": { + "high": { "type": "integer", "readOnly": true }, - "medium": { + "critical": { "type": "integer", "readOnly": true }, - "high": { + "confirmed": { "type": "integer", "readOnly": true } @@ -5003,48 +5003,48 @@ "Workspace": { "type": "object", "properties": { + "_id": { + "type": "integer", + "readOnly": true + }, + "id": { + "type": "integer" + }, "customer": { "type": "string", "nullable": true, "maxLength": 250 }, - "last_run_agent_date": { + "description": { "type": "string", - "format": "date-time", - "readOnly": true + "nullable": true + }, + "active": { + "type": "boolean" }, + "duration": {}, "name": { "type": "string" }, - "description": { - "type": "string", - "nullable": true + "public": { + "type": "boolean" }, + "scope": {}, + "stats": {}, "create_date": { "type": "string", "format": "date-time", "readOnly": true }, - "scope": {}, - "importance": { - "type": "integer" - }, - "public": { - "type": "boolean" - }, - "_id": { - "type": "integer", + "update_date": { + "type": "string", + "format": "date-time", "readOnly": true }, - "id": { - "type": "integer" - }, - "stats": {}, - "duration": {}, - "active": { + "readonly": { "type": "boolean" }, - "update_date": { + "last_run_agent_date": { "type": "string", "format": "date-time", "readOnly": true @@ -5055,8 +5055,8 @@ "$ref": "#/components/schemas/Histogram" } }, - "readonly": { - "type": "boolean" + "importance": { + "type": "integer" } }, "required": [ @@ -5066,12 +5066,12 @@ "Comment": { "type": "object", "properties": { - "object_id": { - "type": "integer" - }, "id": { "type": "integer" }, + "text": { + "type": "string" + }, "object_type": { "type": "string", "enum": [ @@ -5081,8 +5081,8 @@ "vulnerability" ] }, - "text": { - "type": "string" + "object_id": { + "type": "integer" } }, "required": [ @@ -5094,11 +5094,9 @@ "CustomFieldsSchema": { "type": "object", "properties": { - "field_order": { - "type": "integer" - }, - "field_display_name": { - "type": "string" + "id": { + "type": "integer", + "readOnly": true }, "field_name": { "type": "string" @@ -5106,14 +5104,16 @@ "field_type": { "type": "string" }, - "id": { - "type": "integer", - "readOnly": true - }, "field_metadata": { "type": "string", "nullable": true }, + "field_display_name": { + "type": "string" + }, + "field_order": { + "type": "integer" + }, "table_name": { "type": "string" } @@ -5144,77 +5144,72 @@ "Executor": { "type": "object", "properties": { + "id": { + "type": "integer", + "readOnly": true + }, "name": { "type": "string", "readOnly": true }, + "agent_id": { + "type": "integer", + "readOnly": true + }, "last_run": { "type": "string", "format": "date-time", "readOnly": true }, - "schedules": { - "readOnly": true, + "parameters_metadata": { + "type": "object", + "readOnly": true + }, + "schedules": { + "readOnly": true, "allOf": [ { "$ref": "#/components/schemas/AgentsSchedule" } ] - }, - "id": { - "type": "integer", - "readOnly": true - }, - "agent_id": { - "type": "integer", - "readOnly": true - }, - "parameters_metadata": { - "type": "object", - "readOnly": true } } }, "Agent": { "type": "object", "properties": { + "id": { + "type": "integer" + }, "name": { "type": "string", "nullable": true, "minLength": 1 }, - "last_run": { + "status": { "type": "string", - "format": "date-time", "readOnly": true }, - "creator": { - "readOnly": true + "active": { + "type": "boolean", + "nullable": true }, "create_date": { "type": "string", "format": "date-time", "readOnly": true }, - "status": { - "type": "string", - "readOnly": true - }, - "id": { - "type": "integer" - }, "update_date": { "type": "string", "format": "date-time", "readOnly": true }, - "is_online": { - "type": "boolean", + "creator": { "readOnly": true }, - "active": { + "is_online": { "type": "boolean", - "nullable": true + "readOnly": true }, "executors": { "readOnly": true, @@ -5223,6 +5218,11 @@ "$ref": "#/components/schemas/Executor" } ] + }, + "last_run": { + "type": "string", + "format": "date-time", + "readOnly": true } }, "required": [ @@ -5232,14 +5232,14 @@ "AgentAuthToken": { "type": "object", "properties": { + "token": { + "type": "string" + }, "expires_in": { "type": "number" }, "total_duration": { "type": "number" - }, - "token": { - "type": "string" } }, "required": [ @@ -5248,100 +5248,118 @@ "total_duration" ] }, - "BulkCommand": { + "BulkCredential": { "type": "object", "properties": { - "command": { + "username": { "type": "string", - "nullable": true, - "minLength": 1 + "nullable": true }, - "start_date": { + "password": { "type": "string", - "format": "date-time" + "nullable": true }, - "hostname": { + "description": { "type": "string", - "nullable": true, - "maxLength": 250 - }, - "creator": {}, - "import_source": { - "enum": [ - "report", - "shell", - "agent" - ], - "nullable": true, - "maxLength": 6 + "nullable": true }, - "ip": { + "name": { "type": "string", - "nullable": true, - "maxLength": 250 + "nullable": true + } + } + }, + "BulkService": { + "type": "object", + "properties": { + "id": { + "type": "integer" }, - "duration": { + "_id": { "type": "integer", - "x-unit": "microseconds" + "readOnly": true }, - "user": { + "status": { "type": "string", - "nullable": true, - "maxLength": 250 + "default": "open", + "enum": [ + "open", + "closed", + "filtered" + ] }, - "params": { - "type": "string", - "nullable": true + "type": { + "readOnly": true }, - "tool": { + "protocol": { "type": "string", "nullable": true, "minLength": 1 - } - }, - "required": [ - "command", - "start_date", - "tool" - ] - }, - "BulkCredential": { - "type": "object", - "properties": { + }, "description": { "type": "string", "nullable": true }, + "_rev": { + "type": "string", + "readOnly": true + }, + "owned": { + "type": "boolean" + }, + "owner": { + "readOnly": true + }, + "credentials": { + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkCredential" + } + }, + "vulns": { + "type": "integer", + "readOnly": true + }, "name": { "type": "string", "nullable": true }, - "username": { + "version": { "type": "string", "nullable": true }, - "password": { + "port": { + "type": "integer", + "minimum": 0 + }, + "metadata": {}, + "summary": { "type": "string", - "nullable": true + "readOnly": true + }, + "host_id": { + "type": "integer", + "readOnly": true + }, + "command_id": { + "type": "integer", + "writeOnly": true + }, + "vulnerabilities": { + "default": [] } - } + }, + "required": [ + "port", + "protocol" + ] }, "Vulnerability": { "type": "object", "properties": { - "external_id": { - "type": "string", - "nullable": true - }, - "name": { - "type": "string", - "nullable": true, - "minLength": 1 - }, - "tags": { - "readOnly": true - }, - "hostnames": { + "_id": { + "type": "integer", "readOnly": true }, "status": { @@ -5353,64 +5371,65 @@ "opened" ] }, - "refs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Reference" - } + "issuetracker": { + "readOnly": true }, - "host_os": { + "description": { "type": "string", "readOnly": true }, - "owasp": { - "type": "array", - "readOnly": true, - "items": { - "type": "string" - } + "tags": { + "readOnly": true }, - "target": { + "severity": { + "type": "string" + }, + "_rev": { "type": "string", "readOnly": true }, - "resolution": { + "easeofresolution": { "type": "string", + "enum": [ + "trivial", + "simple", + "moderate", + "difficult", + "infeasible" + ], "nullable": true }, - "type": {}, - "run_date": {}, - "custom_fields": {}, - "_attachments": {}, - "cvss3": {}, - "confirmed": { - "type": "boolean" - }, "owned": { "type": "boolean", "readOnly": true }, - "issuetracker": { + "hostnames": { "readOnly": true }, "owner": { "readOnly": true }, + "date": { + "type": "string", + "format": "date-time", + "readOnly": true + }, "data": { "type": "string", "nullable": true }, - "tool": { + "desc": { "type": "string" }, - "description": { - "type": "string", - "readOnly": true + "impact": {}, + "confirmed": { + "type": "boolean" }, - "desc": { - "type": "string" + "name": { + "type": "string", + "nullable": true, + "minLength": 1 }, - "reference_instances": {}, "service": { "readOnly": true, "allOf": [ @@ -5419,65 +5438,75 @@ } ] }, - "metadata": {}, - "cvss2": {}, - "cwe": { - "type": "array", - "items": { - "type": "string" - } + "obj_id": { + "type": "string", + "readOnly": true }, - "cve": { + "type": {}, + "policyviolations": { "type": "array", "items": { "type": "string" } }, - "_rev": { + "_attachments": {}, + "target": { "type": "string", "readOnly": true }, - "risk": { + "host_os": { + "type": "string", "readOnly": true }, - "date": { + "resolution": { "type": "string", - "format": "date-time", - "readOnly": true + "nullable": true }, - "easeofresolution": { + "metadata": {}, + "custom_fields": {}, + "external_id": { "type": "string", - "enum": [ - "trivial", - "simple", - "moderate", - "difficult", - "infeasible" - ], "nullable": true }, - "_id": { - "type": "integer", - "readOnly": true + "tool": { + "type": "string" }, - "policyviolations": { + "cvss2": {}, + "cvss3": {}, + "cwe": { + "type": "array", + "items": { + "type": "string" + } + }, + "cve": { + "type": "array", + "items": { + "type": "string" + } + }, + "owasp": { "type": "array", + "readOnly": true, "items": { "type": "string" } }, + "refs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Reference" + } + }, + "reference_instances": {}, "command_id": { "type": "integer", "writeOnly": true }, - "obj_id": { - "type": "string", + "risk": { "readOnly": true }, - "severity": { - "type": "string" - }, - "impact": {} + "run_date": {} }, "required": [ "name", @@ -5485,31 +5514,29 @@ "type" ] }, - "BulkService": { + "HostBulk": { "type": "object", "properties": { - "name": { - "type": "string", - "nullable": true + "id": { + "type": "integer" }, - "status": { - "type": "string", - "default": "open", - "enum": [ - "open", - "closed", - "filtered" - ] + "_id": { + "type": "integer", + "readOnly": true }, - "type": { + "_rev": { + "type": "string", "readOnly": true }, - "port": { - "type": "integer", - "minimum": 0 + "ip": { + "type": "string" }, - "owned": { - "type": "boolean" + "description": { + "type": "string" + }, + "mac": { + "type": "string", + "nullable": true }, "credentials": { "default": [], @@ -5518,163 +5545,136 @@ "$ref": "#/components/schemas/BulkCredential" } }, - "owner": { - "readOnly": true - }, - "vulns": { - "type": "integer", - "readOnly": true - }, - "protocol": { - "type": "string", - "nullable": true, - "minLength": 1 - }, - "description": { + "default_gateway": { "type": "string", "nullable": true }, - "summary": { - "type": "string", - "readOnly": true - }, "metadata": {}, - "vulnerabilities": { - "default": [] - }, - "_rev": { - "type": "string", - "readOnly": true - }, - "version": { - "type": "string", - "nullable": true - }, - "host_id": { - "type": "integer", - "readOnly": true - }, - "_id": { - "type": "integer", - "readOnly": true - }, - "id": { - "type": "integer" - }, - "command_id": { - "type": "integer", - "writeOnly": true - } - }, - "required": [ - "port", - "protocol" - ] - }, - "HostBulk": { - "type": "object", - "properties": { "name": { "type": "string", "readOnly": true }, - "hostnames": {}, - "type": { - "readOnly": true - }, - "default_gateway": { - "type": "string", - "nullable": true - }, - "ip": { + "os": { "type": "string" }, "owned": { "type": "boolean" }, - "credentials": { + "owner": { + "readOnly": true + }, + "services": { "default": [], "type": "array", "items": { - "$ref": "#/components/schemas/BulkCredential" + "$ref": "#/components/schemas/BulkService" } }, - "owner": { - "readOnly": true - }, - "os": { - "type": "string" - }, - "mac": { - "type": "string", - "nullable": true - }, "vulns": { "readOnly": true }, - "description": { - "type": "string" + "hostnames": {}, + "type": { + "readOnly": true }, - "metadata": {}, "service_summaries": { "readOnly": true }, - "vulnerabilities": { - "default": [], - "type": "array", - "items": { - "$ref": "#/components/schemas/Vulnerability" - } - }, - "_rev": { - "type": "string", + "versions": { "readOnly": true }, "importance": { "type": "integer" }, - "_id": { - "type": "integer", + "severity_counts": { "readOnly": true }, - "id": { - "type": "integer" + "command_id": { + "type": "integer", + "writeOnly": true }, - "services": { + "vulnerabilities": { "default": [], "type": "array", "items": { - "$ref": "#/components/schemas/BulkService" + "$ref": "#/components/schemas/Vulnerability" } + } + }, + "required": [ + "description", + "ip" + ] + }, + "BulkCommand": { + "type": "object", + "properties": { + "command": { + "type": "string", + "nullable": true, + "minLength": 1 }, - "command_id": { + "duration": { "type": "integer", - "writeOnly": true + "x-unit": "microseconds" }, - "versions": { - "readOnly": true + "start_date": { + "type": "string", + "format": "date-time" }, - "severity_counts": { - "readOnly": true + "ip": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "hostname": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "params": { + "type": "string", + "nullable": true + }, + "user": { + "type": "string", + "nullable": true, + "maxLength": 250 + }, + "creator": {}, + "tool": { + "type": "string", + "nullable": true, + "minLength": 1 + }, + "import_source": { + "enum": [ + "report", + "shell", + "agent" + ], + "nullable": true, + "maxLength": 6 } }, "required": [ - "description", - "ip" + "command", + "start_date", + "tool" ] }, "BulkCreate": { "type": "object", "properties": { - "command": { - "$ref": "#/components/schemas/BulkCommand" - }, "hosts": { "type": "array", "items": { "$ref": "#/components/schemas/HostBulk" } }, + "command": { + "$ref": "#/components/schemas/BulkCommand" + }, "execution_id": { "type": "integer" } @@ -5691,15 +5691,15 @@ "type": "integer", "readOnly": true }, - "user_query": { + "name": { "type": "string", "nullable": true }, - "name": { + "json_query": { "type": "string", "nullable": true }, - "json_query": { + "user_query": { "type": "string", "nullable": true } diff --git a/pynixify/packages/faraday-plugins/default.nix b/pynixify/packages/faraday-plugins/default.nix index 00d3581d407..8b58ffbe2c3 100644 --- a/pynixify/packages/faraday-plugins/default.nix +++ b/pynixify/packages/faraday-plugins/default.nix @@ -8,11 +8,11 @@ buildPythonPackage rec { pname = "faraday-plugins"; - version = "1.13.1"; + version = "1.13.2"; src = fetchPypi { inherit pname version; - sha256 = "054sxvn10234l72fkp3ya8nvl9mg48m29dbzz0a7c7dc1c6jix7w"; + sha256 = "0db1zsmv3lldi41d0av34p130srlyf2njgi33b6a1b3qk79kwgqd"; }; propagatedBuildInputs = [ diff --git a/requirements.txt b/requirements.txt index 72e84fd5e02..dadc4c1d69f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,7 +36,7 @@ syslog-rfc5424-formatter>=1.1.1 simplekv>=0.13.0 Flask-KVSession-fork>=0.6.4 distro>=1.4.0 -faraday-plugins>=1.13.1,<2.0.0 +faraday-plugins>=1.13.2,<2.0.0 apispec>=6.3.0 apispec-webframeworks>=0.5.2 pyyaml From 3a0ad2c634edc5e22c137f3975eb8cceb699bdae Mon Sep 17 00:00:00 2001 From: Diego Nadares Date: Wed, 6 Sep 2023 14:05:09 -0300 Subject: [PATCH 14/14] Ready for release 4.6.0 --- CHANGELOG/4.6.0/community.md | 1 + CHANGELOG/4.6.0/date.md | 1 + CHANGELOG/current/7569.json | 4 ---- RELEASE.md | 4 ++++ 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG/4.6.0/community.md create mode 100644 CHANGELOG/4.6.0/date.md delete mode 100644 CHANGELOG/current/7569.json diff --git a/CHANGELOG/4.6.0/community.md b/CHANGELOG/4.6.0/community.md new file mode 100644 index 00000000000..69e7011a1ee --- /dev/null +++ b/CHANGELOG/4.6.0/community.md @@ -0,0 +1 @@ + * [FIX] Delete Cascade from KB. #7569 diff --git a/CHANGELOG/4.6.0/date.md b/CHANGELOG/4.6.0/date.md new file mode 100644 index 00000000000..22e2a907171 --- /dev/null +++ b/CHANGELOG/4.6.0/date.md @@ -0,0 +1 @@ +Sep 6th, 2023 diff --git a/CHANGELOG/current/7569.json b/CHANGELOG/current/7569.json deleted file mode 100644 index 6264ea7ec8b..00000000000 --- a/CHANGELOG/current/7569.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "level": "community", - "md": "[FIX] Delete Cascade from KB. #7569" -} diff --git a/RELEASE.md b/RELEASE.md index 920834f16d1..0bcb86d1c1c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,10 @@ New features in the latest update ===================================== +4.6.0 [Sep 6th, 2023]: +--- + * [FIX] Delete Cascade from KB. #7569 + 4.5.1 [Jul 15th, 2023]: --- * [FIX] Fix pillow version to 9.4.0. #7531