[Bug]: `x509_v2` mishandles some GeneralNames
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
What happened?
There are some valid GeneralName values that are not accepted by salt.utils.x509._parse_general_names and invalid ones that are. It also does not differentiate properly between regular GeneralNames and the ones used in the nameConstraints extension. Most of them affect the URI type. Some shoutouts:
- nameConstraints
URI: Must be in the same format asDNS, but.foo.baris not accepted andhttps://foo.baris. URI: We automatically encode unicode in thehostnameportion according to IDNA. We should automatically encode other segments according to IRI.URI: IPv6 addresses as hostname result in an exception.URI: One without an authority (likemailto:foo@b.ar) is silently dropped.URI: Regular ones require a scheme, but we don't.URI: Thehostnamecan be an explicit absolute root (foo.bar.), which is rejected.email: We IDNA-encode the domain, but we don't check for unicode in the local (user) part, which is invalid. Unicode email addresses should be put into anotherNameofSmtpUTF8Mailboxtype.IP: A regular IPAddress must contain a single address, but we additionally accept network ranges.- nameConstraints
IP: IPAddress must contain a network range, but we additionally accept IP addresses. DNS: While not following more modern TLS specs,foo*.bar.bazandfoo.*.barused to be valid wildcard definitions and could still be used by other specs. They result in an exception currently.
Type of salt install
Official deb
Major version
3006.x, 3007.x, 3008.x
What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)
ubuntu-24.04
salt --versions-report output
Latest HEAD of 3006.x
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt.utils.x509._parse_general_names and map the listed URI, email, IP, DNS, and nameConstraints cases to their expected valid or invalid behavior. Compare regular GeneralNames with nameConstraints handling, then verify that each listed distinction is covered by the relevant x509 tests; done means valid values are accepted, invalid values are rejected, and no listed cases are silently dropped or raise unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100