Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
= Attached
Attached is a Ruby on Rails file attachment tool that lets users upload to the cloud. The gem supports AWS, Google and Rackspace for storage networks by default. It is influenced (and copied) from Paperclip and makes heavy use of the incredibly awesome Fog library.
== Requirements
The gem is tested with:
== Installation
gem install attached
== Optional
brew install imagemagick brew install lame
== Examples
Migration:
rails g model video name:string encoding:attachment
class CreateVideo < ActiveRecord::Migration def self.up create_table :videos do |t| t.string :name t.attachment :encoding
t.timestamps
end
end
def self.down
drop_table :videos
end
end
Model:
class Video < ActiveRecord::Base
has_attached :encoding, styles: {
webm: { extension: '.webm' },
mp4: { extension: '.mp4' },
ogv: { extension: '.ogv' },
}
after_save do
remote.encode(self.encoding.url)
end
end
Form:
<%= form_for @video, html: { multipart: true } do |form| %> <%= form.file_field :encoding %> <% end %>
View:
== Advanced
=== Validations
validates_attached_presence :file validates_attached_size :file, in: 2.kilobytes..2.megabytes validates_attached_extension :file, in: %w(jpe jpg jpeg png)
==== Storage
has_attached :file, medium: :aws, credentials: "#{Rails.root}/config/aws.yml"
has_attached :file, medium: :google, credentials: "#{Rails.root}/config/google.yml"
has_attached :file, medium: :rackspace, credentials: "#{Rails.root}/config/rackspace.yml"
Attached::Attachment.options[:medium] = :aws Attached::Attachment.options[:credentials] = "#{Rails.root}/config/aws.yml"
Attached::Attachment.options[:medium] = :google Attached::Attachment.options[:credentials] = "#{Rails.root}/config/google.yml"
Attached::Attachment.options[:medium] = :rackspace Attached::Attachment.options[:credentials] = "#{Rails.root}/config/rackspace.yml"
=== Processors
has_attached :file, processor: :image, styles: { small: { size: '200x200>', extension: '.jpg', quality: 90 }, large: { size: '400x400<', extension: '.jpg', quality: 90 }, default: { size: '300x300#', extension: '.jpg', quality: 90 }, }
has_attached :file, processor: :image, styles: { small: { operation: :decrease, width: 200, height: 200, extension: '.jpg', quality: 90 }, large: { operation: :increase, width: 400, height: 400, extension: '.jpg', quality: 90 }, default: { operation: :resize, width: 300, height: 300, extension: '.jpg', quality: 90 }, }
has_attached :file, processor: :audio, styles: { full: { preset: '320kbps', extension: '.wav' }, large: { preset: '256kbps', extension: '.wav' }, small: { preset: '128kbps', extension: '.wav' }, }
has_attached :file, processor: :audio, styles: { full: { preset: 'insane', extension: '.wav' }, large: { preset: 'extreme', extension: '.wav' }, small: { preset: 'medium', extension: '.wav' }, }
=== Strategies
has_attached :file, processor: ..., styles: { ... }, strategy: :delay has_attached :file, processor: ..., styles: { ... }, strategy: :cache
=== Reprocessing
rake attached:process[Image,file] rake attached:process[Audio,file]
=== Aliases
Attached::Attachment.options[:alias] = "https://storage.ksylvest.com/"
Attached::Attachment.options[:aliases] = %w( https://a.storage.ksylvest.com/ https://b.storage.ksylvest.com/ https://c.storage.ksylvest.com/ https://d.storage.ksylvest.com/ )
=== Metadata
Attached::Attachment.options[:metadata] = { 'Cache-Control' => 'max-age=3153600' }
== Status
{}[https://gemnasium.com/ksylvest/attached] {}[https://travis-ci.org/ksylvest/attached] {}[https://coveralls.io/r/ksylvest/attached] {}[https://codeclimate.com/github/ksylvest/attached]
== Copyright
Copyright (c) 2010 - 2014 Kevin Sylvestre. See LICENSE for details.
FAQs
Unknown package
We found that attached demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.