JSON Pointer lookup accepts malformed tilde escapes in object keys
Chưa có ai nhận issue này.
Đá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
- 47/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start with Resolver.lookup and the mapping branch that decodes ~1 and ~0; compare its behavior with RFC 6901 section 3. Check the existing resolution exception types and tests for Resolver.lookup and Resource.pointer. Done means malformed escapes such as ~2 and trailing ~ fail resolution while correctly escaped forms such as ~02 still succeed; the issue leaves the exception choice open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Resolver.lookup accepts malformed JSON Pointer tilde escapes when a matching object key exists. For example, ~2 and a trailing ~ are treated as literal key text rather than an invalid pointer.
from referencing import Registry
from referencing.jsonschema import DRAFT202012
resource = DRAFT202012.create_resource({
"$defs": {"~2": {"type": "integer"}, "~": {"type": "string"}},
})
resolver = Registry().resolver_with_root(resource)
print(resolver.lookup("#/$defs/~2").contents) # {'type': 'integer'}
print(resolver.lookup("#/$defs/~").contents) # {'type': 'string'}
# The correctly escaped forms work too:
print(resolver.lookup("#/$defs/~02").contents) # {'type': 'integer'}
print(resolver.lookup("#/$defs/~0").contents) # {'type': 'string'}
RFC 6901 section 3 permits only ~0 and ~1 as escapes and defines invalid syntax as an error condition. Section 7 leaves the error-handling mechanism to the application. I would expect the first two lookups to fail resolution; the correctly escaped forms should continue to succeed.
Reproduced on main at 45e3c7f0b8191f6f433417d26a59e1e2857f0fcb, Python 3.13.17, macOS ARM64, attrs 26.1.0 and rpds-py 2026.6.3. A local matrix checked six valid and six invalid fragments through both Resolver.lookup and Resource.pointer: all valid controls resolved, but all invalid fragments resolved too. This includes a~b, ~0~ and percent-encoded %7E2; ~01 and ~00 were valid controls to preserve decoding order.
The existing suite, including its pinned referencing-suite submodule, passed locally: 503 passed, 132 xfailed and 406 subtests passed. These are baseline results, not tests of a fix.
The mapping branch currently replaces ~1 and ~0 without validating the token first. I checked #387 and #427: those concern array indices; #444 concerns traversal into scalar values. This report concerns object-key escape syntax and does not propose taking over those patches.
Is rejecting malformed escapes the intended behavior, and should it use an existing resolution exception or a distinct syntax error? I have not prepared a production patch pending that API/compatibility decision. This was found through local code inspection, not a production incident; no security impact is claimed.
OpenAI Codex (GPT-6) assisted with investigation, local reproduction and drafting.
- Ngôn ngữ chính
- Python
- Star
- 56
- Fork
- 55
- Merge trung bình
- 6 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 python-jsonschema/referencing
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
python-jsonschema/referencing#444 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
python-jsonschema/referencing#434 ·
-
$ref resolution in a $dynamicRef target ($dynamicAnchor) happening from base URI instead of targetĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
python-jsonschema/referencing#445 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
python-jsonschema/referencing#442 ·
-
$dynamicRef doesn't find $dynamicAnchor overrides in root schemas without $idCó thể đã có người làm @aqeelat đã nhận 175 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
python-jsonschema/referencing#366 ·
Tất cả issue của python-jsonschema/referencing
Issue tương tự
-
Độ 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
-
AIR-Bench Foundation reads the first letter of the word after "answer" as the model's choiceCó thể đã có người làm @beartester34 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelscope/evalscope#2330 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Distribution plot crashes when a numeric feature is constant in the train or test setCó thể đã có người làm @adembilge đã nhận hôm nay. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MAIF/shapash#847 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
namespace team:operations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
EclipseFdn/open-vsx.org#16738 ·
Maintainer thường phản hồi trong vòng 1 ngày