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

API-key authenticated GraphQL queries fail with "Invalid CSRF token" on every guarded resolver (7.4.0-beta.3)

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

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

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

評価

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

調査の方向性

Start by reproducing the guarded and unguarded GraphQL requests against the /graphql endpoint with the x-api-key header, then trace the authentication and CSRF handling used by the info, array, and docker resolvers. Done means valid API-key requests reach guarded resolvers without requiring a cookie/session CSRF token, while existing session authentication remains covered.

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

説明

Environment

  • Unraid version: 7.4.0-beta.3
  • API key created via WebGUI: Settings → Management Access → API Keys, role: admin

Summary

Any GraphQL query that hits a resolver with an auth guard fails with Invalid CSRF token / UNAUTHENTICATED when authenticated purely via the x-api-key header — even though the official docs and a related report (Connect login loop from unraid-api socket path mismatch) both state that "the API responds correctly when using an explicit API key," implying API-key auth should bypass CSRF entirely (which is a cookie/session-auth concern).

This isn't intermittent — it's 100% reproducible across every guarded field I tried, while a query with no valid resolver (or a resolver with no guard, like welcome) passes authentication fine and returns a normal GraphQL error/response instead.

Steps to reproduce

# This succeeds (passes auth, hits GraphQL validation instead):
curl -s -k -X POST "https://<unraid-ip>/graphql" \
  -H "content-type: application/json" \
  -H "x-api-key: $API_KEY" \
  --data-raw '{"query":"{ welcome { message } }"}'

# This fails every time with "Invalid CSRF token":
curl -s -k -X POST "https://<unraid-ip>/graphql" \
  -H "content-type: application/json" \
  -H "x-api-key: $API_KEY" \
  --data-raw '{"query":"query { info { os { platform } } }"}'

Observed behavior

{"errors":[{"message":"Invalid CSRF token","locations":[{"line":1,"column":9}],"path":["info"],"extensions":{"code":"UNAUTHENTICATED","originalError":{"message":"Invalid CSRF token","error":"Unauthorized","statusCode":401}}}],"data":null}

Repeated 4x back-to-back with identical headers — same result every time. Also reproduced on array { state } and docker { containers { names state status } }.

Expected behavior

A request authenticated via a valid x-api-key header should authenticate the same way regardless of which resolver/field is queried — guarded resolvers shouldn't additionally require a CSRF token that only makes sense for cookie/session-based auth.

Impact

This makes the GraphQL API effectively unusable for programmatic/automation use via API keys, since essentially every field that returns real data (info, array, docker, etc.) is guarded and hits this. Only fields with no guard (e.g. welcome) work.

Possibly related to the socket-path/CSRF issue described in https://product.unraid.net/p/7-3-1-connect-login-loop-from-unraid-api-socket-path-mismatch, which may be a regression carried into this beta.

🤖 Generated with Claude Code

主要言語
TypeScript
スター
113
フォーク
23
平均マージ
1日 21時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

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

unraid/api のほかの issue

unraid/api の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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