설명
OpenAPI 3.0의 OAuth2 authorizationCode와 implicit 흐름에서 authorizationUrl은 사용자가 로그인하고 권한을 부여하는 주소입니다.
잠재적 영향
주소가 잘못되면 사용자 동의 절차가 중단되거나 신뢰할 수 없는 사이트로 연결될 수 있습니다.
해결 방법
components.securitySchemes의 해당 흐름에서 authorizationUrl을 공급자의 공식 HTTPS 인가 엔드포인트로 설정하세요. 호스트와 경로를 대조하고 # 프래그먼트를 제외하세요.
예시
예시의 authorizationCode를 사용할 때는 클라이언트와 인가 서버에서 PKCE도 설정하세요.
변경 전
json
{
"openapi": "3.0.0",
"components": {
"securitySchemes": {
"petstore_auth": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://api.invalid.company.com#@evil.com/oauth/authorize",
"tokenUrl": "https://api.my.company.com/oauth/token",
"scopes": {
"write:api": "modify apis in your account",
"read:api": "read your apis"
}
}
}
}
}
}
}
변경 후
json
{
"openapi": "3.0.0",
"components": {
"securitySchemes": {
"petstore_auth": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"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"
}
}
}
}
}
}
}