mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-28 18:24:00 -04:00
remove antivirus code (email does not allow attachments via ui)
This commit is contained in:
@@ -38,7 +38,7 @@ from app import proxy_fix, webauthn_server
|
|||||||
from app.asset_fingerprinter import asset_fingerprinter
|
from app.asset_fingerprinter import asset_fingerprinter
|
||||||
from app.config import configs
|
from app.config import configs
|
||||||
from app.custom_auth import CustomBasicAuth
|
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 (
|
from app.formatters import (
|
||||||
convert_to_boolean,
|
convert_to_boolean,
|
||||||
format_auth_type,
|
format_auth_type,
|
||||||
@@ -199,7 +199,6 @@ def create_app(application):
|
|||||||
user_api_client,
|
user_api_client,
|
||||||
|
|
||||||
# External API clients
|
# External API clients
|
||||||
antivirus_client,
|
|
||||||
redis_client,
|
redis_client,
|
||||||
zendesk_client,
|
zendesk_client,
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ class Config(object):
|
|||||||
|
|
||||||
TEMPLATE_PREVIEW_API_HOST = os.environ.get('TEMPLATE_PREVIEW_API_HOST', 'http://localhost:9999')
|
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')
|
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
|
# Logging
|
||||||
NOTIFY_LOG_LEVEL = os.environ.get('NOTIFY_LOG_LEVEL', 'INFO')
|
NOTIFY_LOG_LEVEL = os.environ.get('NOTIFY_LOG_LEVEL', 'INFO')
|
||||||
@@ -55,7 +53,6 @@ class Config(object):
|
|||||||
WTF_CSRF_ENABLED = True
|
WTF_CSRF_ENABLED = True
|
||||||
WTF_CSRF_TIME_LIMIT = None
|
WTF_CSRF_TIME_LIMIT = None
|
||||||
CHECK_PROXY_HEADER = False
|
CHECK_PROXY_HEADER = False
|
||||||
ANTIVIRUS_ENABLED = os.environ.get('ANTIVIRUS_ENABLED') == '1'
|
|
||||||
|
|
||||||
AWS_REGION = os.environ.get('AWS_REGION')
|
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'
|
API_HOST_NAME = 'http://you-forgot-to-mock-an-api-call-to'
|
||||||
REDIS_URL = 'redis://you-forgot-to-mock-a-redis-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'
|
LOGO_CDN_DOMAIN = 'static-logos.test.com'
|
||||||
|
|
||||||
# Buckets
|
# Buckets
|
||||||
|
|||||||
@@ -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.redis.redis_client import RedisClient
|
||||||
from notifications_utils.clients.zendesk.zendesk_client import ZendeskClient
|
from notifications_utils.clients.zendesk.zendesk_client import ZendeskClient
|
||||||
|
|
||||||
antivirus_client = AntivirusClient()
|
|
||||||
zendesk_client = ZendeskClient()
|
zendesk_client = ZendeskClient()
|
||||||
redis_client = RedisClient()
|
redis_client = RedisClient()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ from app import (
|
|||||||
notification_api_client,
|
notification_api_client,
|
||||||
service_api_client,
|
service_api_client,
|
||||||
)
|
)
|
||||||
from app.main import main, no_cookie
|
from app.main import main
|
||||||
from app.main.forms import (
|
from app.main.forms import (
|
||||||
ChooseTimeForm,
|
ChooseTimeForm,
|
||||||
CsvUploadForm,
|
CsvUploadForm,
|
||||||
@@ -43,7 +43,6 @@ from app.s3_client.s3_csv_client import (
|
|||||||
s3upload,
|
s3upload,
|
||||||
set_metadata_on_csv_upload,
|
set_metadata_on_csv_upload,
|
||||||
)
|
)
|
||||||
from app.template_previews import TemplatePreview
|
|
||||||
from app.utils import (
|
from app.utils import (
|
||||||
PermanentRedirect,
|
PermanentRedirect,
|
||||||
should_skip_template_page,
|
should_skip_template_page,
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import base64
|
|
||||||
from io import BytesIO
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from flask import current_app, json
|
from flask import current_app
|
||||||
|
|
||||||
from app import current_service
|
from app import current_service
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
|
|
||||||
{% macro notification_status_field(notification) %}
|
{% 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 %}
|
{% if not notification %}
|
||||||
{% call field(align='right') %}{% endcall %}
|
{% call field(align='right') %}{% endcall %}
|
||||||
|
|||||||
@@ -16,11 +16,7 @@
|
|||||||
field_headings_visible=False
|
field_headings_visible=False
|
||||||
) %}
|
) %}
|
||||||
{% call row_heading() %}
|
{% call row_heading() %}
|
||||||
{% if item.status in ('pending-virus-check', 'virus-scan-failed') %}
|
<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>
|
||||||
<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 %}
|
|
||||||
<p class="file-list-hint">
|
<p class="file-list-hint">
|
||||||
{{ item.preview_of_content }}
|
{{ item.preview_of_content }}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -74,9 +74,7 @@
|
|||||||
<dd class="api-notifications-item__data-value">{{ notification[key] }}</dd>
|
<dd class="api-notifications-item__data-value">{{ notification[key] }}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% 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>
|
||||||
<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 %}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="govuk-body">
|
<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>
|
</p>
|
||||||
|
|
||||||
<h2 class="govuk-heading-m govuk-!-margin-bottom-1">
|
<h2 class="govuk-heading-m govuk-!-margin-bottom-1">
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ from orderedset._orderedset import OrderedSet
|
|||||||
from werkzeug.datastructures import MultiDict
|
from werkzeug.datastructures import MultiDict
|
||||||
from werkzeug.routing import RequestRedirect
|
from werkzeug.routing import RequestRedirect
|
||||||
|
|
||||||
SENDING_STATUSES = ['created', 'pending', 'sending', 'pending-virus-check']
|
SENDING_STATUSES = ['created', 'pending', 'sending']
|
||||||
DELIVERED_STATUSES = ['delivered', 'sent']
|
DELIVERED_STATUSES = ['delivered', 'sent']
|
||||||
FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure',
|
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
|
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
|
||||||
|
|
||||||
NOTIFICATION_TYPES = ["sms", "email"]
|
NOTIFICATION_TYPES = ["sms", "email"]
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ FLASK_APP=application.py
|
|||||||
FLASK_ENV=development
|
FLASK_ENV=development
|
||||||
WERKZEUG_DEBUG_PIN=off
|
WERKZEUG_DEBUG_PIN=off
|
||||||
|
|
||||||
ANTIVIRUS_ENABLED=0
|
|
||||||
NODE_VERSION=16.15.1
|
NODE_VERSION=16.15.1
|
||||||
|
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|||||||
@@ -49,15 +49,14 @@ from tests.conftest import (
|
|||||||
(
|
(
|
||||||
'',
|
'',
|
||||||
[
|
[
|
||||||
'created', 'pending', 'sending', 'pending-virus-check',
|
'created', 'pending', 'sending', 'delivered', 'sent', 'failed',
|
||||||
'delivered', 'sent',
|
'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
'validation-failed'
|
||||||
'virus-scan-failed', 'validation-failed'
|
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'sending',
|
'sending',
|
||||||
['sending', 'created', 'pending', 'pending-virus-check']
|
['sending', 'created', 'pending']
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'delivered',
|
'delivered',
|
||||||
@@ -67,7 +66,7 @@ from tests.conftest import (
|
|||||||
'failed',
|
'failed',
|
||||||
[
|
[
|
||||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||||
'virus-scan-failed', 'validation-failed'
|
'validation-failed'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -38,15 +38,14 @@ def test_old_jobs_hub_redirects(
|
|||||||
(
|
(
|
||||||
'',
|
'',
|
||||||
[
|
[
|
||||||
'created', 'pending', 'sending', 'pending-virus-check',
|
'created', 'pending', 'sending', 'delivered', 'sent', 'failed',
|
||||||
'delivered', 'sent',
|
'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
'validation-failed'
|
||||||
'virus-scan-failed', 'validation-failed'
|
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'sending',
|
'sending',
|
||||||
['sending', 'created', 'pending', 'pending-virus-check']
|
['sending', 'created', 'pending']
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'delivered',
|
'delivered',
|
||||||
@@ -55,7 +54,7 @@ def test_old_jobs_hub_redirects(
|
|||||||
(
|
(
|
||||||
'failed',
|
'failed',
|
||||||
[
|
[
|
||||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed',
|
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||||
'validation-failed'
|
'validation-failed'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ def test_is_over_threshold(number, total, threshold, result):
|
|||||||
def test_get_tech_failure_status_box_data_removes_percentage_data():
|
def test_get_tech_failure_status_box_data_removes_percentage_data():
|
||||||
stats = {
|
stats = {
|
||||||
'failures':
|
'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,
|
'test-key': 0,
|
||||||
'total': 5589
|
'total': 5589
|
||||||
}
|
}
|
||||||
@@ -612,11 +612,11 @@ def test_platform_admin_displays_stats_in_right_boxes_and_with_correct_styling(
|
|||||||
):
|
):
|
||||||
platform_stats = {
|
platform_stats = {
|
||||||
'email': {'failures':
|
'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,
|
'test-key': 0,
|
||||||
'total': 145},
|
'total': 145},
|
||||||
'sms': {'failures':
|
'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,
|
'test-key': 5,
|
||||||
'total': 168},
|
'total': 168},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ def test_upload_valid_csv_shows_preview_and_table(
|
|||||||
row = page.select('table tbody tr')[row_index]
|
row = page.select('table tbody tr')[row_index]
|
||||||
assert 'id' not in row
|
assert 'id' not in row
|
||||||
assert normalize_spaces(str(row.select('td')[index + 1])) == cell
|
assert normalize_spaces(str(row.select('td')[index + 1])) == cell
|
||||||
|
|
||||||
|
|
||||||
def test_show_all_columns_if_there_are_duplicate_recipient_columns(
|
def test_show_all_columns_if_there_are_duplicate_recipient_columns(
|
||||||
client_request,
|
client_request,
|
||||||
|
|||||||
Reference in New Issue
Block a user