Giter Club home page Giter Club logo

Comments (3)

Iwark avatar Iwark commented on July 25, 2024 8

You can:

|> cast_attachements(params, [:image], allow_paths: true)

Changelog

from arc_ecto.

jung-hunsoo avatar jung-hunsoo commented on July 25, 2024 1

@denispeplin How about adding a custom validation which filters only valid URLs like starting with http or https?

Personally, I'm using a filter like this;

  defp apply_image_remote_url(attrs) do
    case attrs["image_remote_url"] != nil && String.starts_with?(attrs["image_remote_url"], ["http://", "https://"]) do
      true -> Map.put(attrs, "image", attrs["image_remote_url"])
      false -> attrs
    end
  end

I think it'd better to provide options in addition to allow_paths in the library.

from arc_ecto.

denispeplin avatar denispeplin commented on July 25, 2024

This leads to security issue: I want only allow to upload files from remote URL, but this also allows local uploads (any file from /etc for example).
Can I disallow local uploads, but with remote uploads still enabled?
Or should I implement some custom validation to prevent local uploads?

from arc_ecto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.