I need to use a sensitive value as primary identifier in a REST Api.
This would be identified as:
DELETE /api/sometoken/<sensitiveid>
Since sensitive data should not be included in URLs, I wonder what the best option is.
Sensitive ID in body
Would it be a valid solution to set the id as json in the body?
This would result in DELETE /api/sometoken
with body { "id": "<sensitiveid>" }
I am not sure if this is ok, since DELETE
does not directly reference an entity by url.
Abuse POST
Alternatively, I could use POST
instead of DELETE
, and contain the information about delete in the body or url. I assume this would be even worse.
Abstract ID
This most complex solution would probably be using a different id.
When using GET
, to lookup the all sensitive ids for my subscription and then DELETE
the abstract id.
Hashed ID
I thought of making an sha-256 hash and taking the first n characters to id identify the sensitive token.
DELETE /api/sometoken/<hashofsensitiveid>