feat: As a user, I want to store basic auth credentials in hashed form, to not leak them to authorized admins
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- lua
調査の方向性
参照されている151行目付近の plugins/basic-auth.lua から始め、consumer credentials がどのように保存され、チェックされるかを追跡してください。issue では、保存パスが特定されていないとされています。提案されている hashed_password と hash の設定を、既存の basic-auth および key-auth の動作と比較し、その後、credential の保存と認証を対象とするテストを定義してください。完了条件には、合意済みの hashing 設計、互換性のある設定動作、および両方の credential タイプに対する QA を含めます。
索引モデルが issue の本文から書いたものです。
説明
Description
As a User, I want to store basic auth credentials in a hashed way, to not leak credentials to other admin users.
Hi, we are manaiging APISIX with a team of people using the apisix-dashboard.
There is a different set of users that have authenticated access to some APIs exposed via APISIX (not the admin API). We use consumers and a combination of basic-auth and restrict-consumers-plugins to restrict access. We have noticed, that all basic-auth credentials of consumers are stored in a readable format for admins (i.e. if you go to consumers -> <consumer> -> credentials -> <basic-auth-credential>, you can see the plain password for this user.
This allows for trivial impersonation of people and API access for admin users. Thus, I would like to see at least the option to store basic-auth passwords in a hashed way. Sane defaults would be to use SHA512 or bcrypt (depending on which algorithms are supported by lua), with a defined salt, e.g. SHA512(USERNAME.PASSWORD).
The same is true for key-auth API keys.
I am open to help with both code fragments, testing and QA, although I am not very familiar with lua.
The schema for configuration would be something like:
# user config
{
"username": "testuser",
"plugins": {
"basic-auth": {
"username": "my-basic-credential", # existing
"password": "my-password", # existing
"hashed_password": "<hash>", # mutually exclusive to password, allows outside hashing
"hash": "sha512" # sane default, future-proofing if algorithm needs to be changed
}
}
}
Regarding implementation, there need to be 2 sections:
- saving new credentials - didn't find that in a quick search. There needs to be some logic for differentation between
passwordandhashed_passwordparameter - checking the credentials (pseudocode,
plugins/basic-auth.lua:151)
# snippet of basic-auth.lua
# import library
local hash = require("lua-hash")
...
# within find_consumer(ctx), before line 151
if cur_consumer.auth_conf.hash != "" then
local password_to_check = hash.oneshot(cur_consumer.auth_conf.hash, username .. password)
else
local password_to_check = password
fi
if cur_consumer.auth_conf.password ~= password_to_check then
Please let me know what you think of the idea. Let me know if you need any more information; as I said, I can contribute code as well, but I will need some pointers in regards to boilerplate (requirements, tests, ...) that need to be implented.
- 主要言語
- Lua
- スター
- 17.3k
- フォーク
- 3k
- 平均マージ
- 4日 16時間
- マージ済み PR(30日)
- 69
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/apisix のほかの issue
-
bug: an admin key injected with ${{VAR}} that contains only digits becomes a number, so the correct key gets 401対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
bug(body-transformer): runtime crash when request or response body is a JSON primitive対応中かも @bhuvan-somisetty が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
bug: openapi-to-mcp appends a second ? to a query-suffixed path template対応中かも @lordcheng10 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
-
ai-proxy forwards client `Transfer-Encoding: chunked` but sends an unchunked body (upstream 400)対応中かも @locker95 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
As a user, I want the opa plugin to propagate trace context (traceparent) to OPA, so that OPA spans are linked to the APISIX request trace対応中かも @GitNimay が 20 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/apisix#14051 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
google/executor.nvim#46 ·
-
forever from-game
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
openmap-world/openmap#96 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
teradata-labs/loom#624 ·
メンテナーはふだん 1 日以内に返信
-
[Forever] Whuut's the Rush (97275) shown as available before Yelmak's Medley (97242) is completedオープンData Correction Forever
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信