nodeSolidServer / nodeSolidServer/node-solid-server

fix: make WebID profile fetch respect NODE_TLS_REJECT_UNAUTHORIZED in tests

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

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

主要言語
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_UNAUTHORIZED is 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

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

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