Mongodb驱动程序需要通过spring.data.mongodb.uri进行连接字符串,您不能通过单个属性来设置它。
当您调用驱动器信息或env时,它将mongodb的所有机密数据显示为用户名、密码、主机、.
存在一个变通方法来隐藏信息的特定属性(在本例中为spring.data.mongodb.uri ? )。
非常感谢。
发布于 2021-11-17 14:26:31
是的,公开env和信息端点可能是一个代价高昂的安全错误。
如果不需要,可以使用禁用端点,也可以使用打开某些端点的身份验证和访问控制。。
发布于 2021-11-18 13:25:14
解决办法是使用
management:
endpoint:
info:
enabled: true
keys-to-sanitize: # Hide secrets data for cybersecurity
spring.data.mongodb.uri,.*password*.,.*secret.*,.*key.*,.*token.*,.*credentials.*
env:
enabled: true
keys-to-sanitize: # Hide secrets data for cybersecurity
spring.data.mongodb.uri,.*password*.,.*secret.*,.*key.*,.*token.*,.*credentials.*https://stackoverflow.com/questions/70003209
复制相似问题