Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Fastapi generated api do not get authentication parameters from Cookie

オープン
#583 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
fastapi, python

調査の方向性

まず、生成された API 認証のエントリポイントと issue に示されている middleware を特定し、bearer token がどのように読み取られるかを調べます。その経路を、提供された仕様の securitySchemes cookieAuth および bearerAuth と比較します。cookie の認証情報が処理され、関連する仕様パラメータが尊重されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

scope:code-generation

The generated function supports the bearer token but not cookie.

@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
    # retrieve the bearer token from the header
    # and save it for use in the AuthClient
    authorization = request.headers.get('Authorization')
    if authorization:
        set_authentication_token(authorization)

    return await call_next(request)

The cookie authentication is handy when the application is secured by a gatekeeper, as it comes for free on every request.

It's also ignoring the parameter coming from the spec, like in

  securitySchemes:
    bearerAuth:
      scheme: bearer
      bearerFormat: JWT
      type: http
      x-bearerInfoFunc: cloudharness.auth.decode_token
    cookieAuth:
      type: apiKey
      name: kc-access
      in: cookie
      x-apikeyInfoFunc: cloudharness.auth.decode_token

This is not necessarily required as we don't have different decode token handlers, but can be confusins as the Connexion apis require those instead

主要言語
Python
スター
19
フォーク
5
平均マージ
11日 20時間
マージ済み PR(30日)
1

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MetaCell/cloud-harness のほかの issue

MetaCell/cloud-harness の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。