Merge pull request #3040 from jramosf/patch-1
Raise ValidationError if CSR contains invalid CN
This commit is contained in:
commit
5870ff4713
|
@ -99,8 +99,12 @@ def csr(data):
|
||||||
raise ValidationError("CSR presented is not valid.")
|
raise ValidationError("CSR presented is not valid.")
|
||||||
|
|
||||||
# Validate common name and SubjectAltNames
|
# Validate common name and SubjectAltNames
|
||||||
for name in request.subject.get_attributes_for_oid(NameOID.COMMON_NAME):
|
try:
|
||||||
common_name(name.value)
|
for name in request.subject.get_attributes_for_oid(NameOID.COMMON_NAME):
|
||||||
|
common_name(name.value)
|
||||||
|
except ValueError as err:
|
||||||
|
current_app.logger.info("Error parsing Subject from CSR: %s", err)
|
||||||
|
raise ValidationError("Invalid Subject value in supplied CSR")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
alt_names = request.extensions.get_extension_for_class(
|
alt_names = request.extensions.get_extension_for_class(
|
||||||
|
|
Loading…
Reference in New Issue