설명
전역 security 배열의 {}는 익명 접근을 허용하는 선택지입니다. 배열에 다른 인증 방식이 있어도 이 선택지는 유효합니다.
잠재적 영향
이 설정을 상속하는 작업은 클라이언트에 인증이 선택 사항인 것으로 표시됩니다.
해결 방법
인증이 필수라면 배열에서 {}를 제거하고 서버가 요구하는 인증 방식만 참조하세요. security에는 배열을 사용해야 하므로 security: {}는 유효하지 않습니다.
예시
변경 후에는 exampleSecurity가 지정한 X-API-Key 헤더가 필요합니다.
변경 전
json
{
"openapi": "3.0.0",
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "ok"
}
}
}
}
},
"security": [
{}
],
"info": {
"title": "Simple API overview",
"version": "1.0.0"
},
"components": {
"securitySchemes": {
"exampleSecurity": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
}
}
}
}
변경 후
json
{
"openapi": "3.0.0",
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "ok"
}
}
}
}
},
"security": [
{
"exampleSecurity": []
}
],
"info": {
"title": "Simple API overview",
"version": "1.0.0"
},
"components": {
"securitySchemes": {
"exampleSecurity": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
}
}
}
}