fix: make WebID profile fetch respect NODE_TLS_REJECT_UNAUTHORIZED in tests
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, networking, testing
Hướng nghiên cứu
Bắt đầu với lib/webid/lib/get.mjs và kiểm tra lời gọi fetch nội bộ của nó cũng như cách xử lý HTTPS. Sau đó chạy test/integration/acl-tls-test.mjs sau khi xóa describe.skip; được xem là hoàn tất khi các bài kiểm thử tích hợp WebID-TLS vượt qua với NODE_TLS_REJECT_UNAUTHORIZED=0, trong khi việc xác thực chứng chỉ thông thường vẫn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- JavaScript
- Star
- 1.8k
- Fork
- 308
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodeSolidServer/node-solid-server
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
nodeSolidServer/node-solid-server#1848 · 2 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
nodeSolidServer/node-solid-server#1841 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
nodeSolidServer/node-solid-server#1147 ·
-
remove bootstrap dependency Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
nodeSolidServer/node-solid-server#1867 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
nodeSolidServer/node-solid-server#1853 ·
Tất cả issue của nodeSolidServer/node-solid-server
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Seeed-Studio/wiki-documents#5655 · 2 bình luận ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
capricorn86/happy-dom#2435 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Edit: CW+ Đang mởchannels:edit check:passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
01 type: bug 30 needs: triage 99 tag: UX Accessibility
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100