Subscription status response validators omit validation of data and nested lastTransactions
Chưa có ai nhận issue này.
- #467 của @Shubham-Padkonde — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 84/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ệ
- typescript
- Lĩnh vực
- api
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra các validator trong dist/models/StatusResponse.js, dist/models/SubscriptionGroupIdentifierItem.js và dist/models/LastTransactionsItem.js sau khi build package. Theo dõi cách các mảng tùy chọn và validator lồng nhau được xử lý, sau đó thêm phạm vi kiểm thử hồi quy cho các kiểu mảng không hợp lệ, các mục lồng nhau sai định dạng và các trường bị bỏ qua hoặc lồng nhau hợp lệ. Công việc được xem là hoàn tất khi các response lồng nhau không hợp lệ trả về false, trong khi các response hợp lệ và các trường tùy chọn bị bỏ qua vẫn được chấp nhận.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
StatusResponseValidator checks environment, bundleId and appAppleId, but never validates data, which is declared as SubscriptionGroupIdentifierItem[].
There is a second gap in the nested model: SubscriptionGroupIdentifierItemValidator checks only subscriptionGroupIdentifier and never validates lastTransactions, which is declared as LastTransactionsItem[].
Consequently, the response validator accepts a non-array data value, malformed subscription-group entries and malformed transaction entries. Connecting StatusResponseValidator to the existing subscription-group validator alone would not fully address the problem, because that validator also omits its nested array.
Reproduction
From the repository root, after building the package:
const {
StatusResponseValidator,
} = require('./dist/models/StatusResponse.js');
const {
SubscriptionGroupIdentifierItemValidator,
} = require('./dist/models/SubscriptionGroupIdentifierItem.js');
const {
LastTransactionsItemValidator,
} = require('./dist/models/LastTransactionsItem.js');
const responseValidator = new StatusResponseValidator();
const groupValidator = new SubscriptionGroupIdentifierItemValidator();
const transactionValidator = new LastTransactionsItemValidator();
console.log(responseValidator.validate({ data: 'not-an-array' }));
// true
console.log(groupValidator.validate({ lastTransactions: 'not-an-array' }));
// true
const invalidTransaction = { signedTransactionInfo: 123 };
console.log(responseValidator.validate({
data: [{
subscriptionGroupIdentifier: '123',
lastTransactions: [invalidTransaction],
}],
}));
// true
console.log(transactionValidator.validate(invalidTransaction));
// false
Expected behavior
When present, data must be an array of valid subscription-group items. Within each group, lastTransactions, when present, must be an array of valid transaction items. Invalid nested values should cause validation of the containing response to return false.
Omitted optional fields should remain accepted, consistent with the current model definitions.
Impact
AppStoreServerAPIClient.getAllSubscriptionStatuses uses StatusResponseValidator. Its runtime validation therefore does not enforce the declared structure of the subscription data returned to callers. Downstream code may receive incompatible values despite a successful client validation result.
This concerns structural validation of the API response. Cryptographic verification of the signed transaction and renewal payloads remains a separate operation.
Suggested change
- In
StatusResponseValidator, check that a presentdatavalue is an array and validate each entry withSubscriptionGroupIdentifierItemValidator. - In
SubscriptionGroupIdentifierItemValidator, check that a presentlastTransactionsvalue is an array and validate each entry withLastTransactionsItemValidator. - Add regression coverage for invalid array types, invalid nested fields and valid nested responses.
- Ngôn ngữ chính
- TypeScript
- Star
- 388
- Fork
- 88
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 apple/app-store-server-library-node
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
NotificationHistoryResponseValidator uses the response validator for history items and accepts malformed item fieldsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 54/100
-
Cloudflare Workers (nodejs_compat): SignedDataVerifier passes with online checks; two non-crypto blockers remainCó thể đã có người làm @vishalhabib99 đã nhận 4 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
apple/app-store-server-library-node#476 · 1 bình luận · 1 reaction ·
-
Abort OCSP requests when the response times outCó thể đã có người làm @TorinAsakura đã nhận 71 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Tất cả issue của apple/app-store-server-library-node
Issue tương tự
-
bug priority: low role: BE stage: now
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
ahmadrosid/nakama#2594 ·
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 70/100
milind-soni/OpenMausBot#6495 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Navigating the session tree adds the branch's prompts to Up-arrow history againCó thể đã có người làm @acmerfight đã nhận hôm nay. Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
earendil-works/pi#12279 ·
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 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
approved documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 89/100
vitest-dev/vitest#12015 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày