説明
OpenAPI 2.0 の OAuth2 では、accessCode と implicit の authorizationUrl がユーザーのログイン先と同意先を指定します。
想定される影響
ホストやパスが誤っていると、ログインに失敗したり、利用者が別のサイトで認証情報を入力したりするおそれがあります。
対処方法
securityDefinitions の authorizationUrl に、プロバイダーが公開する HTTPS の認可エンドポイントを指定します。ホストとパスを確認してください。URL にフラグメント(# 以降)は指定できません。
例
新しい連携では、クライアントと認可サーバーで PKCE を使う accessCode フローを設定してください。tokenUrl には同じプロバイダーのトークンエンドポイントを指定します。
変更前
yaml
swagger: "2.0"
securityDefinitions:
petstore_auth:
type: oauth2
flow: accessCode
authorizationUrl: https://api.invalid.comp@#any.com/oauth/authorize
tokenUrl: https://api.my.company.com/oauth/token
scopes:
read:pets: read pets
変更後
yaml
swagger: "2.0"
securityDefinitions:
petstore_auth:
type: oauth2
flow: accessCode
authorizationUrl: https://api.my.company.com/oauth/authorize
tokenUrl: https://api.my.company.com/oauth/token
scopes:
read:pets: read pets