tweak webauthn rest errors

simplify logic by changing the dao function to require a user id and a
webauthn cred id. Note that this changes the response from a 400 to a
404 if the cred is for a different user than the supplied id.

give a minimum length to the text fields in POSTS to create/update a
credential to avoid surprising unexpected edge cases involving empty
string names etc.
This commit is contained in:
Leo Hemsted
2021-05-12 15:34:37 +01:00
parent d6fead7c04
commit c190886bfe
4 changed files with 60 additions and 47 deletions

View File

@@ -3,9 +3,9 @@ post_create_webauthn_credential_schema = {
"description": "POST webauthn_credential schema",
"type": "object",
"properties": {
"name": {"type": "string"},
"credential_data": {"type": "string"},
"registration_response": {"type": "string"},
"name": {"type": "string", "minLength": 1},
"credential_data": {"type": "string", "minLength": 1},
"registration_response": {"type": "string", "minLength": 1},
},
"required": ["name", "credential_data", "registration_response"],
"additionalProperties": False
@@ -16,7 +16,7 @@ post_update_webauthn_credential_schema = {
"description": "POST update webauthn_credential schema",
"type": "object",
"properties": {
"name": {"type": "string"},
"name": {"type": "string", "minLength": 1},
},
"required": ["name"],
"additionalProperties": False