Skip to content

Commit

Permalink
chore: add error message for missing CN (#263)
Browse files Browse the repository at this point in the history
add error message for missing CN by check of RFC4515 string
  • Loading branch information
paulschwarzenberger authored Oct 30, 2024
1 parent efd1fef commit 49fae49
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def is_invalid_certificate_request(project, env_name, ca_name, common_name, csr,
if not db_list_certificates(project, env_name, ca_name):
return {"error": f"CA {ca_name} not found"}

# check CSR includes a Common Name
if "CN=" not in csr.subject.rfc4514_string():
return {"error": "CSR must include a Common Name"}

# get public key from CSR
public_key = csr.public_key()

Expand Down

0 comments on commit 49fae49

Please sign in to comment.