GitXplorerGitXplorer
n

loppers

public
7 stars
2 forks
3 issues

Commits

List of commits on branch master.
Unverified
c7df011f5bd77b3a5d38752d992ef7049c6e38f9

spring cleaning

nnarrowtux committed 7 months ago
Unverified
1dba8cece046e7ac1883bec8c663ce46e68a86d4

release 1.0

nnarrowtux committed 4 years ago
Verified
5adcf8b181e23cb8069b4980bb8379bb6f926098

Merge pull request #12 from h4cc/master

nnarrowtux committed 5 years ago
Unverified
fc020806fae703feedbcdf3f599e3563f5baf6a5

Added tests for sigils.

hh4cc committed 5 years ago
Verified
30e0c4d49b8b5b02c38a00274861a78f6dafe5ce

Merge pull request #9 from groxio-learning/master

nnarrowtux committed 6 years ago
Unverified
9f58c0a5fb96c6cf27f24363e8867ed1a9e12011

loppers special forms permits case

bbatate committed 6 years ago

README

The README file for this repository.

Loppers

A code validator for the Elixir-AST.

It can operate on both white- and blacklists.

Basic example:

quoted = quote do
  "hello"
  |> String.upcase
  |> String.pad_leading(4, "0")
end
whitelist = Loppers.special_forms ++ [
  {Kernel, :|>},
  {String, :upcase},
  {String, :pad_leading}
]
:ok = Loppers.validate(quoted, whitelist: whitelist)

Features

  • Ideally used in combination with Code.string_to_quoted/2 to check for nasty things in untrusted code.
  • Operate against a whitelist, blacklist or a mix of both (blacklist > whitelist)
  • Works with alias and import in the code (special handling for that in the Loppers.Walk module)
  • Returns the AST-Fragment (including the line number if your compiler provides it) so you can add squiggly lines to the editor at the right place.
  • Whitelist a module with functions with {Application.Callbacks, :__all__}
  • Whitelist a module with all child-modules and functions with {Application.Callbacks, :__submodules_all__}

Installation

The package can be installed by adding loppers to your list of dependencies in mix.exs:

def deps do
  [{:loppers, "~> 0.1.2"}]
end