format: email rejects RFC 5321 Mailbox values when the TLD is not recognized
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu với openapi-request-validator-core/pom.xml và lần theo đường đi của format: đường đi của email qua EmailFormat của NetworkNT, IPv6AwareEmailValidator, Apache Commons EmailValidator và DomainValidator. Xác minh hành vi hiện tại đối với các domain hợp lệ về mặt cú pháp nhưng có TLD không được nhận diện, sau đó xác định phạm vi kiểm thử cho thấy cú pháp Mailbox của RFC 5321 được chấp nhận mà không yêu cầu TLD của IANA.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
format: email validation currently appears to reject email addresses whose domain has a syntactically valid top-level label but is not in the validator's recognized/IANA TLD list.
That seems stricter than the OpenAPI email format definition, which says that email is an email address as defined by the RFC 5321 Mailbox rule.
Example
Schema:
type: object
properties:
email:
type: string
format: email
required:
- email
Request body:
{
"email": "[email protected]"
}
Actual result: validation fails.
Expected result: this should pass format: email syntax validation, because the domain part is syntactically valid under RFC 5321:
Mailbox = Local-part "@" ( Domain / address-literal )
Domain = sub-domain *("." sub-domain)
RFC 5321 does not require the final label to be present in the IANA root zone or in an implementation-maintained TLD list for the address to match the Mailbox grammar.
Relevant code path
This seems to come from the Java validation stack rather than from OpenAPI itself:
-
openapi-request-validator-core/pom.xmldepends oncom.networknt:json-schema-validator. -
NetworkNT’s
com.networknt.schema.format.EmailFormatconstructs:new IPv6AwareEmailValidator(true, true) -
IPv6AwareEmailValidatorextends Apache Commons Validator’sEmailValidator. -
Apache Commons
EmailValidator.isValidDomain(...)delegates toDomainValidator. -
DomainValidator.isValid(...)checks that the domain has a recognized top-level domain viaisValidTld(...). -
DomainValidatordocuments this as validation of TLDs “as defined and maintained by the Internet Assigned Numbers Authority (IANA).”
Why this matters
This makes format: email unsuitable for some valid API inputs, including internal/test/private domains (with local DNS resolution).
Suggested fix
Please consider to configure the underlying email validator so format: email checks RFC 5321 Mailbox syntax without requiring a recognized/IANA TLD.
Thanks!
- Ngôn ngữ chính
- Java
- Star
- 17
- Fork
- 6
- 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 atlassian/openapi-request-validator
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
-
Make the Locale configurableĐang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 55/100
-
openapi-request-validator-core:3.0.0 - NoSuchMethodError: SchemaRegistry.getSchema(JsonNode)Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
-
Message context not populated when validating response headersCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Tất cả issue của atlassian/openapi-request-validator
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
521xueweihan/HelloGitHub#4105 ·
-
Awaiting further input from submitter
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Regression in 5.9.0: CuratorCache fails with ClassCastException when the client is not a CuratorFrameworkBaseCó thể đã có người làm @sftwnd đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày