-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add way to globally disable filter #33
Comments
@fsateler it's a little more cumbersome but you could do something like:
|
Thanks, I'll try that. Still, it's a bit cumbersome. |
Hello, I was running into the same issue recently and found a more reasonable workaround by replacing the default resolver for tests by dropping the following code in a class FakeTestIpResolverForSsrfFilter
def self.call(hostname)
new(hostname)
end
def initialize(hostname)
@hostname = hostname
end
def reject(...)
self
end
def empty?
false
end
def sample
@hostname
end
end
SsrfFilter.module_eval do
remove_const(:DEFAULT_RESOLVER)
const_set(:DEFAULT_RESOLVER, FakeTestIpResolverForSsrfFilter)
end You could also be sending the |
When using test request mocks (like webmocks gem), the SSRF filter makes it impossible to mock the requests, because the DNS is resolved before making the request. That is:
This will fail because the request will be to whatever example.com happens to resolve to.
For testing, it would be useful to be able to globally disable the filtering, and go directly to the underlying request library.
The text was updated successfully, but these errors were encountered: