Best practice to store password used in REST services

0
Hello, I had a simple question regarding storing password used for REST services (under HTTP Headers → Use HTTP auth → Username / Password) Currently I am using the password as a constant (thinking if it changes in the future, I can change it via Model Options without changing the code in Mendix ) Any best practices here with regards to security? Thanks
asked
2 answers
0

Hi Harry, although the constant is a often used solution for this, everyone with access to the environments and teamserver could retrieve the values.

A safer solution would be the use of the Encryption module in combination with a Settings entity. In de settings entity you could store your endpoint and username and password. Saving of changing your password could be done in asimilar way you change your ‘Account’ password where you encrypt while saving and decrypt when using it to call the REST endpoint.

 

Example: 

answered
0

Hi Harry,

If the password/key should be editable front-end, I prefer the implementation with the Encryption module. This is perfectly shown in the EmailTemplate module for the SMTP-password.

If the password/key is not editable front-end, the Mendix constants are just fine. If someone does not have transportation rights to the environment, that person cannot view the constants (see error screenshot below). And you can also Mask the value, such that you don't show it accidentally when showing/sharing your screen or exporting the constants to an Excel (see second screenshot below).

Good luck!

Johan

 

answered