Bug: Cookie with SameSite.DEFAULT_MODE sends an empty SameSite= attribute

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

メンテナーはふだん 1 日以内に返信

@anishmehta24 がすでに取り組んでいます。

2026年10月30日 から。

  • #8709 @anishmehta24 による — オープン

評価

この issue はまだ評価されていません。

説明

bug event_handlers

Expected Behaviour

Cookie(..., same_site=SameSite.DEFAULT_MODE) leaves the SameSite attribute out of the Set-Cookie header, so the browser applies its default (the same as Go's http.SameSiteDefaultMode, which these names follow).

Current Behaviour

Cookie.__str__ checks if self.same_site:, which is true for every enum member, and DEFAULT_MODE has the value "", so the header gets an attribute with no value: SameSite=. That is not a valid SameSite value.

Code snippet

from aws_lambda_powertools.shared.cookies import Cookie, SameSite

str(Cookie(name="session", value="abc", same_site=SameSite.DEFAULT_MODE))
# 'session=abc; Secure; SameSite='

Steps to Reproduce

  1. Create a Cookie with same_site=SameSite.DEFAULT_MODE.
  2. Return it in a Response(cookies=[...]) or call str() on it.
  3. The Set-Cookie value ends with SameSite=.

Possible Solution

Only write the attribute when the enum value is not empty. I can open a PR.

Powertools for AWS Lambda (Python) version

latest (develop, 3.38.0)

AWS Lambda function runtime

3.12

Packaging format used

PyPi

Debugging logs

No response

主要言語
Python
スター
3.3k
フォーク
511
平均マージ
3日 8時間
マージ済み PR(30日)
92

環境構築

はじめの一歩

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

aws-powertools/powertools-lambda-python のほかの issue

aws-powertools/powertools-lambda-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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