Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow deleteing of invalid source and block furthur invalid source #283

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions assemblyline_ui/api/v4/signature.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from flask import request
from hashlib import sha256

Expand Down Expand Up @@ -219,7 +221,7 @@ def add_signature_source(service, **_):
status_code=400)

# Ensure data source doesn't have spaces in name
data['name'] = data['name'].replace(" ", "_")
data['name'] = re.sub('[^0-9a-zA-Z_]+', '', data['name'].replace(" ", "_"))

# Ensure private_key (if any) ends with a \n
if data.get('private_key', None) and not data['private_key'].endswith("\n"):
Expand Down Expand Up @@ -356,7 +358,7 @@ def delete_signature(sid, **kwargs):
return make_api_response("", f"Signature not found. ({sid})", 404)


@signature_api.route("/sources/<service>/<name>/", methods=["DELETE"])
@signature_api.route("/sources/<service>/<path:name>/", methods=["DELETE"])
@api_login(audit=False, required_priv=['W'], allow_readonly=False, require_type=['admin', 'signature_manager'])
def delete_signature_source(service, name, **_):
"""
Expand Down