socket pnpm add / socket yarn add scan the alias name instead of the aliased package
Maintainer thường phản hồi trong vòng 1 ngày
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
- 85/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
Đọc src/utils/npm-spec.mts và hàm safeParseNpmSpec; nó thiếu một nhánh alias và sử dụng kết quả từ npm-package-arg. Thêm xử lý cho kiểu 'alias' sử dụng subSpec để trả về gói và phiên bản thực. Xác minh với SOCKET_CLI_DEBUG=1 socket pnpm add my-lodash@npm:[email protected] rằng pkg:npm/[email protected] được gửi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The shadow pnpm and yarn wrappers check packages with the Socket API before they install them. For an npm alias spec, the check looks up the alias name instead of the package that gets installed.
safeParseNpmSpec in src/utils/npm-spec.mts reads name and version from the npm-package-arg result. For an alias, npm-package-arg returns type: 'alias', sets name to the alias, and puts the real package in subSpec. The function has no branch for alias, so it returns the alias name with no version.
| Command argument | PURL sent for scanning | Package installed |
|---|---|---|
my-lodash@npm:[email protected] |
pkg:npm/my-lodash |
[email protected] |
node-types@npm:@types/[email protected] |
pkg:npm/node-types |
@types/[email protected] |
As a result, the installed package never gets checked. If an unrelated package has the alias name, its alerts are reported instead. socket yarn install has the same problem with aliased package.json dependencies such as "my-lodash": "npm:lodash@^4", because it builds name@version from each entry and passes the result to the same function.
Steps to reproduce
- Run
SOCKET_CLI_DEBUG=1 socket pnpm add my-lodash@npm:[email protected]. - Check the
packagePurlsdebug output.
Expected result
pkg:npm/[email protected]
Actual result
pkg:npm/my-lodash
Version
v1.x branch at 766b1e6 / [email protected].
- Ngôn ngữ chính
- TypeScript
- Star
- 336
- Fork
- 72
- Merge trung bình
- 8 giờ 18 phút
- Pull request đã merge (30 ngày)
- 70
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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 SocketDev/socket-cli
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SocketDev/socket-cli#1160 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`socket npm outdated --json` appends an error object after valid JSON when npm exits with code 1Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
SocketDev/socket-cli#1656 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
SocketDev/socket-cli#1525 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
SocketDev/socket-cli#1517 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
SocketDev/socket-cli#1498 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-cli
Issue tương tự
-
Shell: serve the home app's Cookie Policy on a hard reloadCó thể đã có người làm @2001anshkaushik đã nhận hôm nay. Đang mởfeature module:ai
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
rocketride-org/rocketride-server#2899 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
wazuh/wazuh-dashboard-plugins#9551 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
gofish-graphics/gofish-graphics#1252 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
optimization P3 size:XS
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
josephfung/curia#2366 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
stranded-follow-up sweep trusts any issue whose body carries the marker as the tracking issueĐang mởtype:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
nightgauge/nightgauge#2688 ·
Maintainer thường phản hồi trong vòng 1 ngày