• Stars
    star
    75
  • Rank 409,991 (Top 9 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 10 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Upload files securely

rack-secure-upload

Gem Version Dependency Status Build Status Coverage Status Code Climate

Upload files securely

Installation

Add the rack-secure-upload gem to your Gemfile.

gem "rack-secure-upload"

And run bundle install.

Rack App

require 'rack-secure-upload'
use Rack::SecureUpload::Middleware, :fsecure
run MyApp

Rails App

In config/application.rb

module MyApp
  class Application < Rails::Application
    config.middleware.insert_before ActionDispatch::ParamsParser, Rack::SecureUpload::Middleware, :avast
  end 
end

Options

You can add some options like below.

use Rack::SecureUpload::Middleware, :fsecure, {foo: :bar}

fallback

  • proc { |env, params, path| }
    • use return value of proc
  • :raise
    • raise Rack::SecureUpload::InsecureFileError |
  • else
    • return 406

AntiVirus Softwares

Avast

  1. Get license
  2. Install the package
wget -c http://files.avast.com/files/linux/avast4workstation-1.3.0-1.i586.rpm
sudo yum localinstall avast4workstation-1.3.0-1.i586.rpm
avast -V # Input your license
avast-update

F-Secure

  1. Get license (Optional)
  2. Install the package
wget http://download.f-secure.com/webclub/f-secure-linux-security-10.00.60.tar.gz
tar xvzf f-secure-linux-security-10.00.60.tar.gz
sudo ./f-secure-linux-security-10.00.60/f-secure-linux-security-10.00.60

Test this middleware

  1. Download eicar test file
  2. Upload it

You can try this with sample app

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2014 Daisuke Taniwaki. See LICENSE for details.

More Repositories

1

rack-dev-mark

Show dev mark on development env
Ruby
353
star
2

mandriller

Mandrill SMTP API integration for ActionMailer
Ruby
125
star
3

acts_as_hashids

Use Youtube-Like ID in ActiveRecord seamlessly.
Ruby
85
star
4

activerecord-time-scope

Time-Related Scope for ActiveRecord
Ruby
35
star
5

hubot-alias

Action alias for hubot
CoffeeScript
21
star
6

akka-pusher

Pusher meets Akka
Scala
19
star
7

hubot-tabelog

Pick up a restaurant to go
CoffeeScript
19
star
8

paperclip-deflater

Deflate Processor for Paperclip
Ruby
17
star
9

issue-checker-for-github

Chrome Extension to check github issues assigned to you
CoffeeScript
14
star
10

hubot-privilege

Hubot is so smart! He can ignore you and your friends.
CoffeeScript
9
star
11

cron-hpa

"Cron"HorizontalPodAutoscaler
Go
8
star
12

activerecord-after-transaction

Execute Procs After Transaction
Ruby
8
star
13

ucrspawner

JupyterHub spawner for Marathon Universal Containerizer Runtime (UCR)
Python
7
star
14

e2e-tester

Open source End-to-End test service
Ruby
7
star
15

wordpress-client

Wordpress API Wrapper
Ruby
7
star
16

git-kustomize-diff

Diff tool for Kustomize
Go
7
star
17

fluent-plugin-fork

Fork output by separating values for fluentd
Ruby
4
star
18

cluster-lending-manager

Lending Manager of Kubernetes Cluster
Go
4
star
19

node-custom-console

Custom Console for Node.js
CoffeeScript
4
star
20

url_regexp

Generate regular expression for URL
Ruby
4
star
21

node-env-switcher

Switch env per request
JavaScript
2
star
22

chainer-watchdog

Watchdog extension for Chainer
Python
2
star
23

jupyter-env-whitelist

Hide Confidential Environment Variables from Notebooks in JupyterHub.
Python
2
star
24

k8s-virtual-device-plugin

Virtual Device Plugin for Kubernetes
Go
2
star
25

browserstack-screenshot-task

A sample task of browserstack screenshot API
Ruby
2
star
26

jquery-sticky

Make any element sticky in the container
JavaScript
2
star
27

bugsnag-ruby-ext

Extension of Bugsnag Ruby Client
Ruby
2
star
28

faraday_middleware-retry_proxy

Retry with proxy in Faraday
Ruby
1
star
29

jquery-inserter

Chrome Extension to insert any version of jQuery to any page
JavaScript
1
star
30

paperclip_rotation

Rotation Processor For Paperclip
Ruby
1
star
31

terraform-codepipeline-run-task

Terraform module to run a task in codepipeline
Python
1
star
32

capistrano-misc

Useful tools for Capistrano 2
Ruby
1
star
33

akka-pusher-play-app

Play application for akka pusher
Scala
1
star