No plain text passwords in Spring Boot’s application.properties

Alex

Having something like

security.user.password = plainTextPassword

inside Spring Boot’s application.properties is obviously an anti-pattern as it prevents the code from being pushed to a public SCM. In my non-Spring Boot projects I use

security.user.password = ${myPasswordFromMavenSettingsXML}

and put a corresponding <properties/> reference inside my pom.xml. Using Maven’s resource filter plugin the passwords are replaced at build time so the application have access to actual plain text passwords after it has been build and deployed.

For some reason Maven’s resource filter plugin does not work in this case. Is there a way to not commit plain text passwords to an SCM and let Spring Boot to insert them at build time?

g00glen00b

Spring boot has multiple mechanisms to provided externalized configuration. Some examples are command line arguments, environment variables and also application properties outside of your packaged JAR.

What I usually do:

Locally we configured several environment variables. Most (if not all) IDE's allow you to configure environment variables from within the run configuration.

For example if you don't want to expose the spring.datasource.password property you could set an environment variable called SPRING_DATASOURCE_PASSWORD.

When we deploy on another environment, we usually choose to add another application.properties or application.yml file within the same folder as the application JAR/WAR, since Spring boot picks that up as well.


Another solution is to use Spring cloud since it has a config service which can be used as a microservice to provide configuration. The configuration can be versioned using SCM as well, but you can put it on a separate system that is not connected to your source code.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Plain text passwords and application authentication compared to Windows

From Java

Spring Boot how to hide passwords in properties file

From Dev

Spring Boot how to hide passwords in properties file

From Dev

Secure plain text passwords in configuration

From Dev

Plain text passwords are disabled NetBios remote connection

From Dev

password store storing some passwords in plain text

From Dev

Spring boot - custom variables in Application.properties

From Java

Spring Boot application.properties value not populating

From Dev

spring boot 1.4, spock and application.properties

From Dev

Tomcat Not reading Spring-Boot Application Properties

From Dev

The correct format of application.properties in spring boot

From Dev

Not able to access Spring boot application.properties

From Dev

Spring Boot read values from application properties

From Dev

Spring Boot not recognizing application.properties file

From Dev

Spring boot application specific external properties

From Dev

spring boot 1.4, spock and application.properties

From Dev

Update spring boot datasource properties on application startup

From Dev

Password Encoding - BCrypt - Not Authorising Hashed Passwords, authorising on plain text only

From Dev

Use wpa_supplicant without plain text passwords

From Dev

Password Encoding - BCrypt - Not Authorising Hashed Passwords, authorising on plain text only

From Dev

Encrypting plain-text passwords and passing variables to xml for display in android

From Dev

Can I send plain text passwords through RabbitMQ?

From Dev

List of properties available for application.properties in Spring Boot?

From Dev

parent properties for application-{profile}.properties with Spring-Boot app

From Dev

Using Maven properties in application.properties in Spring Boot

From Dev

get properties from application.properties in spring boot

From Dev

How to use hashed passwords with netplan (for wpa2 enterprise) instead of plain text passwords?

From Java

application.yml vs application.properties for Spring Boot

From Java

Environment Specific application.properties file in Spring Boot application

Related Related

  1. 1

    Plain text passwords and application authentication compared to Windows

  2. 2

    Spring Boot how to hide passwords in properties file

  3. 3

    Spring Boot how to hide passwords in properties file

  4. 4

    Secure plain text passwords in configuration

  5. 5

    Plain text passwords are disabled NetBios remote connection

  6. 6

    password store storing some passwords in plain text

  7. 7

    Spring boot - custom variables in Application.properties

  8. 8

    Spring Boot application.properties value not populating

  9. 9

    spring boot 1.4, spock and application.properties

  10. 10

    Tomcat Not reading Spring-Boot Application Properties

  11. 11

    The correct format of application.properties in spring boot

  12. 12

    Not able to access Spring boot application.properties

  13. 13

    Spring Boot read values from application properties

  14. 14

    Spring Boot not recognizing application.properties file

  15. 15

    Spring boot application specific external properties

  16. 16

    spring boot 1.4, spock and application.properties

  17. 17

    Update spring boot datasource properties on application startup

  18. 18

    Password Encoding - BCrypt - Not Authorising Hashed Passwords, authorising on plain text only

  19. 19

    Use wpa_supplicant without plain text passwords

  20. 20

    Password Encoding - BCrypt - Not Authorising Hashed Passwords, authorising on plain text only

  21. 21

    Encrypting plain-text passwords and passing variables to xml for display in android

  22. 22

    Can I send plain text passwords through RabbitMQ?

  23. 23

    List of properties available for application.properties in Spring Boot?

  24. 24

    parent properties for application-{profile}.properties with Spring-Boot app

  25. 25

    Using Maven properties in application.properties in Spring Boot

  26. 26

    get properties from application.properties in spring boot

  27. 27

    How to use hashed passwords with netplan (for wpa2 enterprise) instead of plain text passwords?

  28. 28

    application.yml vs application.properties for Spring Boot

  29. 29

    Environment Specific application.properties file in Spring Boot application

HotTag

Archive