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

Validation of identity objects in /upload and PUT /document/identity #75

Open
JuAlMan opened this issue Aug 2, 2024 · 4 comments
Open

Comments

@JuAlMan
Copy link

JuAlMan commented Aug 2, 2024

Using image docker.sunet.se/dc4eu/apigw:apiv28

When uploading a document or using the PUT /document/identity call for adding identities, it is possible to submit invalid identity objects like this:

"identities": [
        {
            "name": 2
        }
    ]

We propose that all identity objects in the array should be validated to make sure that all required attributes are set and the types are matching.

@masv3971
Copy link
Collaborator

masv3971 commented Sep 2, 2024

should be fixed with, e1ea46f

@JuAlMan
Copy link
Author

JuAlMan commented Sep 2, 2024

I tried with the same invalid identity object as i posted before, but still get no validation errors. The objects with the submitted identities array don't seem to be validated

@masv3971
Copy link
Collaborator

masv3971 commented Sep 11, 2024

When I tried with the above request, I got;

{
	"error": {
		"title": "validation_error",
		"details": [
			{
				"field": "authentic_source",
				"namespace": "authentic_source",
				"type": "string",
				"validation": "required",
				"validationParam": "",
				"value": ""
			},
			{
				"field": "document_type",
				"namespace": "document_type",
				"type": "string",
				"validation": "required",
				"validationParam": "",
				"value": ""
			},
			{
				"field": "document_id",
				"namespace": "document_id",
				"type": "string",
				"validation": "required",
				"validationParam": "",
				"value": ""
			}
		]
	}
}

@masv3971 masv3971 self-assigned this Sep 24, 2024
@JuAlMan
Copy link
Author

JuAlMan commented Sep 25, 2024

I am sorry, i guess i didn't outline the problem precisely enough.

What i meant is that the identity objects in the array are not validated. So if i submit a request like

{
    "authentic_source": "data_existent_in_db",
    "document_type": "data_existent_in_db",
    "document_id": "data_existent_in_db",
    "identities": [
        {
            "name": 2
        }
    ]
}

This just works fine even though the submitted identity object is obviously not valid. Of course i get a validation error as well if i leave out any of the top-level attributes like document_id, etc.

Same behaviour with the upload call. So our request is that that every submitted identity object should be validated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants