In an API I have there's a requirement to use an authentication method other than OAuth2 or any kind of token generation which requires making an extra HTTP call.
With this in mind there's this https://www.xml.com/pub/a/2003/12/17/dive.html
I've only stored passwords as hashes and used functions like password_verify
to know the user sent the proper credentials without actually knowing the password stored in DB.
WSSE requires to encrypt with SHA1 the credentials being sent, which means the API needs to retrieve the password in plain text to recreate the digest and compare it to the one sent by the user.
So, how should I be storing this password if the code needs it to recreate the hash?
Should I have something like a master password and store them encrypted instead of hashed?
Most of the information I've found about WSSE is very very old, and some implementations have it marked as deprecated, do you know any other type of standard authentication where the user can generate the token instead of having to make an extra HTTP call?
Someone wants you to use this WSSE? I would brush up your resume and start interviewing - it sounds like that place is on track for a “we liquidated our internal IT and now pay a consulting firm” level of security event.
In the meantime, If you have to store a non-rolling API secret for your app to use, and it’s going to live a long time (not regenerated), then you need to secure the entire environment that has access to that secret. Any additional local reversible encryption is just security theater.
In this scenario, you need a popular modern well supported password vault soltion. Do not attempt to roll your own. The purpose of this vault is not to protect the secret, it is to quickly reset the secret* when it inevitably eventually gets compromised.
You must do frequent tests of replacing this secret, in production, with a new one. This is not theoretical. You will eventually either test it on your own terms, or on the badguys’ terms.
Good luck, you’re going to need it.
Someone want’s me to implement a way to access a resource without having to make the extra HTTP calls required by OAuth, WSSE is a possibility since I saw it had some standards to send the credentials in a secure way.
I have been reading about WSSE for less than a week '^-^
Yeah, the idea would be the tokens used to generate the digest WSSE requires will live in our secure environment, and that’s the question: how is a secure environment created to store tokens/API keys of users which will be used to authenticate them into my API?
I haven’t implemented this kind of stuff so I don’t know what are the best practices to store this kind of sensitive data.
So, I’d need to research password vaults to store my user’s secrets so I can use them to authenticate them?
I went into WSSE since sending a client id + secret seems just rewording of basic authentication and well, sending the credentials in plain text seems more insecure than sending a hash.
Neat. I can help with some of these concepts:
You can protect your Basic Auth password simply by storing it in cleartext where it is needed with reasonable protections
(This is again assuming your use case is actually okay for not having OAuth. If it’s health data, suck it up and do real OAuth, obviously.)
Reasonable protections for your Basic Auth passwords:
In summary:
Happy sailing!
Edit: Also, practice replacing the secret, ideally with automation - and preferrably do so every 90 days.
Edit 2: Make that password as long as heck and meaningless. No one needs to memorize this thing. Generate it random, long and meaningless, paste it in two places, and forget about it for 90 days.
Edit 3: Deliver this secret to your end user over the phone (spoken to a human, not a text message). Do so every 90 days. When they complain, ask them if they’re interested in OAuth now.