설명
작업의 security가 implicit 흐름을 참조하면 클라이언트는 리디렉션 응답으로 액세스 토큰을 받습니다.
잠재적 영향
리디렉션에서 토큰이 노출되면 해당 권한이 악용될 수 있고, 잘못된 토큰을 받으면 다른 계정으로 요청할 수 있습니다.
해결 방법
클라이언트와 인가 서버에서 PKCE를 사용하는 인가 코드 흐름을 설정하세요. securityDefinitions의 흐름을 accessCode로 바꾸고 공급자의 HTTPS 엔드포인트를 지정하세요. 작업에는 필요한 스코프만 요청하세요.
예시
예시의 GET /는 같은 petstore_auth를 참조하고 read:api만 요구합니다.
변경 전
json
{
"swagger": "2.0",
"paths": {
"/": {
"get": {
"security": [
{
"petstore_auth": []
}
]
}
}
},
"securityDefinitions": {
"petstore_auth": {
"type": "oauth2",
"flow": "implicit",
"authorizationUrl": "https://api.my.company.com/oauth/authorize",
"scopes": {
"read:api": "read your apis"
}
}
}
}
변경 후
json
{
"swagger": "2.0",
"paths": {
"/": {
"get": {
"security": [
{
"petstore_auth": [
"read:api"
]
}
]
}
}
},
"securityDefinitions": {
"petstore_auth": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://api.my.company.com/oauth/authorize",
"tokenUrl": "https://api.my.company.com/oauth/token",
"scopes": {
"write:api": "modify apis in your account",
"read:api": "read your apis"
}
}
}
}