address some security issues

This commit is contained in:
Usman Nasir
2022-08-17 10:38:02 +05:00
parent bb5415a927
commit 17821ad6ea
4 changed files with 43 additions and 30 deletions

View File

@@ -58,7 +58,6 @@ class secMiddleware:
for key, value in data.items():
if request.path.find('gitNotify') > -1:
break
if type(value) == str or type(value) == bytes:
pass
else:
@@ -72,6 +71,22 @@ class secMiddleware:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
if hasattr(value, "__len__"):
for items in value:
if items.find('- -') > -1 or items.find('\n') > -1 or items.find(';') > -1 or items.find(
'&&') > -1 or items.find('|') > -1 or items.find('...') > -1 \
or items.find("`") > -1 or items.find("$") > -1 or items.find(
"(") > -1 or items.find(")") > -1 \
or items.find("'") > -1 or items.find("[") > -1 or items.find(
"]") > -1 or items.find("{") > -1 or items.find("}") > -1 \
or items.find(":") > -1 or items.find("<") > -1 or items.find(">") > -1:
logging.writeToFile(request.body)
final_dic = {
'error_message': "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : < >.",
"errorMessage": "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : < >."}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
else:
if request.build_absolute_uri().find('api/remoteTransfer') > -1 or request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1:
continue
if key == 'CLAMAV_VIRUS' or key == "Rspamdserver" or key == 'smtpd_milters' or key == 'non_smtpd_milters' or key == 'key' or key == 'cert' or key == 'recordContentAAAA' or key == 'backupDestinations' or key == 'ports' \

View File

@@ -1841,8 +1841,6 @@ $parameters = array(
stdoutput = ProcessUtilities.outputExecutioner(command)
elif self.data['plugin'] == 'selected':
pluginsList = ''

View File

@@ -10,7 +10,7 @@
<div class="container">
<span id="pluginbID" style="display: none">{{ pluginbID }}</span>
<div id="page-title">
<h2 id="domainNamePage">{% trans "Eidt Plugin Bucket" %}
<h2 id="domainNamePage">{% trans "Edit Plugin Bucket" %}
</h2>
</div>

View File

@@ -44,7 +44,7 @@
</div>
{% else %}
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-2 control-label">{% trans "Choose Restronig Method " %}</label>
<label class="col-sm-2 control-label">{% trans "Choose Restoring Method " %}</label>
<div class="col-sm-10">
<select ng-click="checkmethode()" id="RestoreMethode" class="form-control" required>
<option value="-1">Select Method</option>