remove antivirus code (email does not allow attachments via ui)

This commit is contained in:
stvnrlly
2022-12-05 16:35:46 -05:00
parent 36e0e67afc
commit 420845fac7
15 changed files with 23 additions and 47 deletions

View File

@@ -38,7 +38,7 @@ from app import proxy_fix, webauthn_server
from app.asset_fingerprinter import asset_fingerprinter
from app.config import configs
from app.custom_auth import CustomBasicAuth
from app.extensions import antivirus_client, redis_client, zendesk_client
from app.extensions import redis_client, zendesk_client
from app.formatters import (
convert_to_boolean,
format_auth_type,
@@ -199,7 +199,6 @@ def create_app(application):
user_api_client,
# External API clients
antivirus_client,
redis_client,
zendesk_client,

View File

@@ -30,8 +30,6 @@ class Config(object):
TEMPLATE_PREVIEW_API_HOST = os.environ.get('TEMPLATE_PREVIEW_API_HOST', 'http://localhost:9999')
TEMPLATE_PREVIEW_API_KEY = os.environ.get('TEMPLATE_PREVIEW_API_KEY', 'my-secret-key')
ANTIVIRUS_API_HOST = os.environ.get('ANTIVIRUS_API_HOST', 'http://localhost:6016')
ANTIVIRUS_API_KEY = os.environ.get('ANTIVIRUS_API_KEY', 'test-key')
# Logging
NOTIFY_LOG_LEVEL = os.environ.get('NOTIFY_LOG_LEVEL', 'INFO')
@@ -55,7 +53,6 @@ class Config(object):
WTF_CSRF_ENABLED = True
WTF_CSRF_TIME_LIMIT = None
CHECK_PROXY_HEADER = False
ANTIVIRUS_ENABLED = os.environ.get('ANTIVIRUS_ENABLED') == '1'
AWS_REGION = os.environ.get('AWS_REGION')
@@ -118,9 +115,6 @@ class Test(Development):
API_HOST_NAME = 'http://you-forgot-to-mock-an-api-call-to'
REDIS_URL = 'redis://you-forgot-to-mock-a-redis-call-to'
ANTIVIRUS_API_HOST = 'https://test-antivirus'
ANTIVIRUS_API_KEY = 'test-antivirus-secret'
ANTIVIRUS_ENABLED = True
LOGO_CDN_DOMAIN = 'static-logos.test.com'
# Buckets

View File

@@ -1,9 +1,5 @@
from notifications_utils.clients.antivirus.antivirus_client import (
AntivirusClient,
)
from notifications_utils.clients.redis.redis_client import RedisClient
from notifications_utils.clients.zendesk.zendesk_client import ZendeskClient
antivirus_client = AntivirusClient()
zendesk_client = ZendeskClient()
redis_client = RedisClient()

View File

@@ -28,7 +28,7 @@ from app import (
notification_api_client,
service_api_client,
)
from app.main import main, no_cookie
from app.main import main
from app.main.forms import (
ChooseTimeForm,
CsvUploadForm,
@@ -43,7 +43,6 @@ from app.s3_client.s3_csv_client import (
s3upload,
set_metadata_on_csv_upload,
)
from app.template_previews import TemplatePreview
from app.utils import (
PermanentRedirect,
should_skip_template_page,

View File

@@ -1,8 +1,5 @@
import base64
from io import BytesIO
import requests
from flask import current_app, json
from flask import current_app
from app import current_service

View File

@@ -147,7 +147,7 @@
{% macro notification_status_field(notification) %}
{% set displayed_on_single_line = notification.status in ['created', 'pending', 'pending-virus-check', 'sending', 'delivered', 'accepted', 'received'] %}
{% set displayed_on_single_line = notification.status in ['created', 'pending', 'sending', 'delivered', 'accepted', 'received'] %}
{% if not notification %}
{% call field(align='right') %}{% endcall %}

View File

@@ -16,11 +16,7 @@
field_headings_visible=False
) %}
{% call row_heading() %}
{% if item.status in ('pending-virus-check', 'virus-scan-failed') %}
<span class="file-list-filename loading-indicator">Checking</span>
{% else %}
<a class="govuk-link govuk-link--no-visited-state file-list-filename" href="{{ single_notification_url(notification_id=item.id) }}">{{ item.to.splitlines()|join(', ') if item.to else '' }}</a>
{% endif %}
<a class="govuk-link govuk-link--no-visited-state file-list-filename" href="{{ single_notification_url(notification_id=item.id) }}">{{ item.to.splitlines()|join(', ') if item.to else '' }}</a>
<p class="file-list-hint">
{{ item.preview_of_content }}
</p>

View File

@@ -74,9 +74,7 @@
<dd class="api-notifications-item__data-value">{{ notification[key] }}</dd>
{% endif %}
{% endfor %}
{% if notification.status not in ('pending-virus-check', 'virus-scan-failed') %}
<a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=notification.id) }}">View {{ 1|message_count_label(notification.template.template_type, suffix='') }}</a>
{% endif %}
<a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=notification.id) }}">View {{ 1|message_count_label(notification.template.template_type, suffix='') }}</a>
</dl>
</div>
</details>

View File

@@ -23,7 +23,7 @@
</p>
<p class="govuk-body">
There are other pages on US Notifywhere you can get help:
There are other pages on US Notify where you can get help:
</p>
<h2 class="govuk-heading-m govuk-!-margin-bottom-1">

View File

@@ -8,10 +8,10 @@ from orderedset._orderedset import OrderedSet
from werkzeug.datastructures import MultiDict
from werkzeug.routing import RequestRedirect
SENDING_STATUSES = ['created', 'pending', 'sending', 'pending-virus-check']
SENDING_STATUSES = ['created', 'pending', 'sending']
DELIVERED_STATUSES = ['delivered', 'sent']
FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure',
'technical-failure', 'virus-scan-failed', 'validation-failed']
'technical-failure', 'validation-failed']
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
NOTIFICATION_TYPES = ["sms", "email"]

View File

@@ -24,7 +24,6 @@ FLASK_APP=application.py
FLASK_ENV=development
WERKZEUG_DEBUG_PIN=off
ANTIVIRUS_ENABLED=0
NODE_VERSION=16.15.1
#############################################################

View File

@@ -49,15 +49,14 @@ from tests.conftest import (
(
'',
[
'created', 'pending', 'sending', 'pending-virus-check',
'delivered', 'sent',
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
'virus-scan-failed', 'validation-failed'
'created', 'pending', 'sending', 'delivered', 'sent', 'failed',
'temporary-failure', 'permanent-failure', 'technical-failure',
'validation-failed'
]
),
(
'sending',
['sending', 'created', 'pending', 'pending-virus-check']
['sending', 'created', 'pending']
),
(
'delivered',
@@ -67,7 +66,7 @@ from tests.conftest import (
'failed',
[
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
'virus-scan-failed', 'validation-failed'
'validation-failed'
]
)
]

View File

@@ -38,15 +38,14 @@ def test_old_jobs_hub_redirects(
(
'',
[
'created', 'pending', 'sending', 'pending-virus-check',
'delivered', 'sent',
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
'virus-scan-failed', 'validation-failed'
'created', 'pending', 'sending', 'delivered', 'sent', 'failed',
'temporary-failure', 'permanent-failure', 'technical-failure',
'validation-failed'
]
),
(
'sending',
['sending', 'created', 'pending', 'pending-virus-check']
['sending', 'created', 'pending']
),
(
'delivered',
@@ -55,7 +54,7 @@ def test_old_jobs_hub_redirects(
(
'failed',
[
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed',
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
'validation-failed'
]
)

View File

@@ -516,7 +516,7 @@ def test_is_over_threshold(number, total, threshold, result):
def test_get_tech_failure_status_box_data_removes_percentage_data():
stats = {
'failures':
{'permanent-failure': 0, 'technical-failure': 0, 'temporary-failure': 1, 'virus-scan-failed': 0},
{'permanent-failure': 0, 'technical-failure': 0, 'temporary-failure': 1},
'test-key': 0,
'total': 5589
}
@@ -612,11 +612,11 @@ def test_platform_admin_displays_stats_in_right_boxes_and_with_correct_styling(
):
platform_stats = {
'email': {'failures':
{'permanent-failure': 3, 'technical-failure': 0, 'temporary-failure': 0, 'virus-scan-failed': 0},
{'permanent-failure': 3, 'technical-failure': 0, 'temporary-failure': 0},
'test-key': 0,
'total': 145},
'sms': {'failures':
{'permanent-failure': 0, 'technical-failure': 1, 'temporary-failure': 0, 'virus-scan-failed': 0},
{'permanent-failure': 0, 'technical-failure': 1, 'temporary-failure': 0},
'test-key': 5,
'total': 168},
}

View File

@@ -940,7 +940,7 @@ def test_upload_valid_csv_shows_preview_and_table(
row = page.select('table tbody tr')[row_index]
assert 'id' not in row
assert normalize_spaces(str(row.select('td')[index + 1])) == cell
def test_show_all_columns_if_there_are_duplicate_recipient_columns(
client_request,