運行Spring Boot應用程式后,我可以使用以下鏈接訪問服務器上的一個檔案:
http://localhost:8080/myweb/env.json
該檔案不僅包含服務器相關的資料,還包含應用程式相關的資料。應用程式相關的資料具有在application.properties檔案中定義的所有屬性。這是一個安全漏洞。
{
"profile"。[],
"server.port": {
"local.server.port": 8080。
},
"servletContextInitParams": {},
"systemProperties": {},
"systemEnvironment": {},
"applicationConfig: [classpath:/application.properties]"/span>: {}。
這個檔案是如何被生成的,我們如何限制它被公開訪問?
uj5u.com熱心網友回復:
這來自于Spring Boot Actuator
management.endpoint.env.enabled=false
將禁用這個端點
如果它不作業,請嘗試management.endpoints.web.exposure.exclude=env
或者你可以用這個配置禁用所有這些東西
management.endpoints.enabled-by-default=false。
你可以在這里讀到更多關于它的資訊。 https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/313439.html
標籤:
