CodeSampleX

サンプル

rack-protection 4.2.1: Prevent Rack::Protection::AuthenticityToken from denying safe GET requests when session middleware is absent, while validating masked and unmasked CSRF tokens on unsafe requests

検証済みサンプル — gem rack-protection 4.2.1: Prevent Rack::Protection::AuthenticityToken from denying safe GET requests when session middleware is absent, while…

sha256:cbdc3c3ea3ec557a27fc8fb08067ec858f4e4f30056c1856d23e37bef67466a5

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
1
宣言された環境 ruby linux x64 ruby ruby rubygems

検証実行環境

環境 コントラクト ステージ 実行日
ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-16
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 SKIPPED compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL
CONTAINER_RUN · rubygems@1
2026-08-18

ケース

HOW
ゴール
Prevent Rack::Protection::AuthenticityToken from denying safe GET requests when session middleware is absent, while validating masked and unmasked CSRF tokens on unsafe requests
パッケージ
シンボル
  • Rack::Protection::AuthenticityToken
  • Rack::Protection::AuthenticityToken.token
環境
ruby
作成日
2026-08-16T16:29:45Z

コントラクト

  1. AuthenticityToken responds with 403 Forbidden on safe GET requests when env lacks rack.session
  2. AuthenticityToken populates session[:csrf] with a 44-character Base64 token on valid GET requests
  3. AuthenticityToken accepts BREACH-mitigated 88-character masked tokens generated via AuthenticityToken.token
  4. AuthenticityToken accepts raw unmasked tokens matching session[:csrf] over HTTP_X_CSRF_TOKEN
  5. AuthenticityToken rejects unsafe POST requests with invalid tokens with 403 Forbidden and text/plain body
  6. AuthenticityToken restricts path-scoped per-form tokens strictly to matching request paths

ファイル

  • Gemfile
  • NOTES.md
  • csx.json
  • test/contract.rb

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed