Skip to content

Carrierwave download of external url #2695

@janz93

Description

@janz93

Problem

Hello everyone 👋

I am facing errors from Webmock and VCR where specs fail with an unhandled web request error. e.g. UnhandledHTTPRequestError or NetConnectNotAllowedError.
During my investigation I noticed that those unhandled web requests are caused by the download! method. This method gets called if an external_url is present. Which is here the case.

Question

My goal is to have an offline test suite, therefore, I was a bit surprised about this behavior, since I set enable_processing to false.
I solved the offline approach by mocking all requests:

  1. Prevent IP resolving -> Overwrite the SsrfFilter::DEFAULT_RESOLVER Add way to globally disable filter arkadiyt/ssrf_filter#33 (comment)
  2. Mock the external_url URI request -> webmock/vcr

Currently, I am unsure if this is the best approach or if carrierwave should handle this automatically depending on the enable_processing setting. Especially since setting enable_processing to false causes an early exit anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions