Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

format: email rejects RFC 5321 Mailbox values when the TLD is not recognized

Đang mở
#28 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
api, backend

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.xml depends on com.networknt:json-schema-validator.

  • NetworkNT’s com.networknt.schema.format.EmailFormat constructs:

    new IPv6AwareEmailValidator(true, true)
    
  • IPv6AwareEmailValidator extends Apache Commons Validator’s EmailValidator.

  • Apache Commons EmailValidator.isValidDomain(...) delegates to DomainValidator.

  • DomainValidator.isValid(...) checks that the domain has a recognized top-level domain via isValidTld(...).

  • DomainValidator documents 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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của atlassian/openapi-request-validator

Tất cả issue của atlassian/openapi-request-validator

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.