Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new URL-related validation args (public, https_only, no_ip) #24

Merged
merged 10 commits into from
Nov 17, 2024

Conversation

RaneemAlRushud
Copy link
Contributor

@RaneemAlRushud RaneemAlRushud commented Nov 1, 2024

Adds 4 independent URL validation args:

  • https , public, not_private, not_ip

Screenshot 2024-11-02 at 10 16 06 PM

# Most restrictive
rd::Url.new(['https', 'public'])

# Block private resources but allow public IPs
rd::Url.new(['not_private'])

# Block IPs but allow private domains
rd::Url.new(['not_ip'])

# Block both private resources and IPs
rd::Url.new(['not_private', 'not_ip'])

RaneemAlRushud and others added 8 commits October 27, 2024 04:45
Adds three independent URL validation rules:
- public: validates against real public domains
- https_only: enforces HTTPS protocol
- no_ip: blocks direct IP addresses

* `not_ip_url.rb` + `not_local_url.rb` rules have been deleted
Adds three independent URL validation rules:
- public: validates against real public domains
- https_only: enforces HTTPS protocol
- no_ip: blocks direct IP addresses

* `not_ip_url.rb` + `not_local_url.rb` rules have been deleted
lib/mini_defender/rules/url.rb Outdated Show resolved Hide resolved
lib/mini_defender/rules/url.rb Outdated Show resolved Hide resolved
lib/mini_defender/rules/url.rb Outdated Show resolved Hide resolved
lib/mini_defender/rules/url.rb Outdated Show resolved Hide resolved
lib/mini_defender/data/public_domain_patterns.txt Outdated Show resolved Hide resolved
lib/mini_defender/detectors/public_domain_detector.rb Outdated Show resolved Hide resolved
lib/mini_defender/detectors/public_domain_detector.rb Outdated Show resolved Hide resolved
lib/mini_defender/detectors/public_domain_detector.rb Outdated Show resolved Hide resolved
lib/mini_defender/detectors/public_domain_detector.rb Outdated Show resolved Hide resolved
…te network check

- Use proper public domain (`public_suffix`) validation checking both structure and access

- Add pattern loading with memoization for private/reserved domains

- Fix error message consistency across validation scenarios

- Add tests for validation scenarios
@RaneemAlRushud RaneemAlRushud marked this pull request as ready for review November 4, 2024 11:35
Copy link
Owner

@ahoshaiyan ahoshaiyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RaneemAlRushud great work 🚀

I have some changes in mind I will do and release a new version

@ahoshaiyan ahoshaiyan merged commit adac39a into ahoshaiyan:master Nov 17, 2024
1 check passed
@RaneemAlRushud
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants