Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
= +swf_fu+ {}[https://travis-ci.org/marcandre/swf_fu]
With the +swf_fu+ plugin, rails treats your swf files like any other asset (images, javascripts, etc...).
+swf_fu+ (pronounced "swif-fu", bonus joke for french speakers) uses SWFObject 2.2 to embed swf objects in HTML and supports all its options. SWFObject 2 is such a nice library that Adobe now uses it as the official way to embed swf! SWFObject's project can be found at http://code.google.com/p/swfobject
Comments and pull requests welcome: http://github.com/marcandre/swf_fu
== Compatibility
Version 2 of +swf_fu+ is an engine for Rails 3.1+ and Ruby 1.8.7+.
Version 1.x was a plugin for previous versions of Rails and should not be used with Rails 3.1+. If you want to use it, checkout the v1.x branch[https://github.com/marcandre/swf_fu/tree/v1.x]. If you are upgrading to Rails 3.1+, remove the plugin!
== Install
Add to your +Gemfile+:
gem "swf_fu", "~> 2.0"
Then run bundle install
.
You also need to require some javascripts, so in your app/assets/javascripts/application.js
you want to append:
\= require swf_fu
== Usage
=== Embedding in HTML
To embed a swf file, use +swf_tag+: <%= swf_tag "i_like_flashing" %>
Exactly like images and javascripts, +swf_tag+ will use +swf_path+ to determine the path of the swf file; it will assume it is in /assets/swfs/ or in /public/swfs/ unless specified otherwise and it will add the ".swf" extension automatically.
You can specify alternate content either with the options :alt => "Get Flash!" or you can use +swf_tag+ as a block:
<% swf_tag "i_like_flashing" do %> Get Flash <% end %>
=== Options
You can override these default options with a global setting:
ActionView::Base.swf_default_options = {:mode => :static} # All swf_tag will use the static mode by default
In your config files, you can write this as:
config.action_view.swf_default_options = {:mode => :static} # All swf_tag will use the static mode by default
Any of these options can be a +Proc+, in which case it will be called each time swf_tag is called.
For example, the following will generate unique IDs:
my_swf_counter = 0 config.action_view.swf_default_options[:id] = Proc.new{"swf_unique_id_#{my_swf_counter+=1}"}
=== swf_path
+swf_tag+ implements and relies on +swf_path+ which behaves in a similar fashion to +image_path+, +javascript_path+, etc...:
swf_path("example") => "/swfs/example.swf" or "/assets/example.swf" swf_path("example.swf") => "/swfs/example.swf" or "/assets/example.swf" swf_path("fonts/optima") => "/swfs/fonts/optima.swf" or "/assets/fonts/optima.swf" swf_path("/fonts/optima") => "/fonts/optima.swf" swf_path("http://www.example.com/game.swf") => "http://www.example.com/game.swf"
It takes into account the global setting +asset_host+, like any other asset:
ActionController::Base.asset_host = "http://assets.example.com" image_path("logo.jpg") => "http://assets.example.com/images/logo.jpg" swf_path("fonts/optima") => "http://assets.example.com/swfs/fonts/optima.swf"
Copyright (c) 2010-2013 Marc-André Lafortune, released under the BSD license
FAQs
Unknown package
We found that swf-guess 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.