nodeSolidServer / nodeSolidServer/node-solid-server
fix: make WebID profile fetch respect NODE_TLS_REJECT_UNAUTHORIZED in tests
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 1.8k
- フォーク
- 308
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Problem
The WebID-TLS integration tests timeout because the internal fetch() in lib/webid/lib/get.mjs doesn't respect NODE_TLS_REJECT_UNAUTHORIZED=0.
When verifying a WebID certificate, the server fetches the user's profile (e.g., https://tim.localhost:7777/profile/card#me). In tests, this URL uses a self-signed certificate that the internal fetch rejects.
Simplest Fix (~5 lines)
Modify lib/webid/lib/get.mjs to use an HTTPS agent that respects the environment variable:
import fetch from 'node-fetch'
import https from 'https'
import { URL } from 'url'
// Respect NODE_TLS_REJECT_UNAUTHORIZED for testing with self-signed certs
const agent = process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0'
? new https.Agent({ rejectUnauthorized: false })
: undefined
export default function get (webid, callback) {
// ... existing code ...
fetch(uri.href, { method: 'GET', headers, agent })
// ...
}
Why This Works
- In production:
NODE_TLS_REJECT_UNAUTHORIZEDis not set, so normal cert validation applies - In tests: The env var is already set by the test runner (
cross-env NODE_TLS_REJECT_UNAUTHORIZED=0) - No changes needed to test infrastructure or certificates
After This Fix
Remove describe.skip from test/integration/acl-tls-test.mjs and the tests should pass.
Related
- #1841 - Original tracking issue
- #1842 - Documentation PR explaining the issue
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
lib/webid/lib/get.mjs から始めて、内部の fetch 呼び出しと HTTPS の処理を調べます。次に、describe.skip を削除してから test/integration/acl-tls-test.mjs を実行します。NODE_TLS_REJECT_UNAUTHORIZED=0 で WebID-TLS 統合テストに合格し、通常の証明書検証が変更されていないことを完了条件とします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend, networking, testing
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 58/100