Rule validation treats .1.2.3.4 and *.1.2.3.4 differently

Open Beginner friendly
#488 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, swift
Domain
security

Research direction

Read rejectionReason(forRemoteHost:) in Sources/Shared/RuleTransport.swift around lines 181-193 and compare how the *. and . prefixes are stripped before the IP/CIDR check (the .-prefix path currently skips it). Normalise both spellings to the same suffix and run the existing cases in Scripts/test_rule_transport.sh first to see the harness. Add a case asserting .1.2.3.4 is rejected like *.1.2.3.4; done when both are rejected for the same reason and the script passes.

Written by the indexing model from the issue text.

Description

area:shared bug priority:low status:queued

Since #199, a host rule written as .example.com means exactly the same as *.example.com. The validation in Sources/Shared/RuleTransport.swift (rejectionReason(forRemoteHost:), around lines 181-193) still treats them differently when the part after the prefix is an IP address or CIDR: *.1.2.3.4 is rejected, while .1.2.3.4 is accepted.

It is harmless today, because .1.2.3.4 can only ever match that literal host text, but the two spellings should be validated the same way.

Done when: .-prefixed and *.-prefixed host patterns go through the same check, so .1.2.3.4 is rejected for the same reason as *.1.2.3.4, with a case for it in Scripts/test_rule_transport.sh.

Dominant language
Swift
Stars
49
Forks
5
Avg merge
14h 18m
Merged PRs (30d)
102

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from isaaclins/freesnitch

All issues in isaaclins/freesnitch

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.