New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

policia

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

policia

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Policia

== Information

Policia is a simple generator of Amazon S3 policy document signatures for use in authenticating POST/REST/API uploads to you S3 buckets.

For more information on Amazon S3 Policy Documents {see the their documentation}[http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_Authentication.html].

== Installation

Install the latest stable release:

[sudo] gem install policia

Or if using bundler add the following to your Gemfile:

gem 'policia'

== Example use

An quick example, note to at least change YOUR-S3-BUCKET-NAME, YOUR-S3-ACCESS-KEY and YOUR-S3-SECRET-KEY

@document = { "expiration" => "2012-12-12T00:00:00Z", "conditions" => [ {"bucket" => "YOUR-S3-BUCKET-NAME"}, ["starts-with", "$key", ""], {"acl" => "public-read"}, {"success_action_redirect" => "YOUR-CHOICE-OF-CALLBACK"}, ["starts-with", "$Content-Type", "image"] ] }

@policy_document = Policia.new("YOUR-S3-SECRET-KEY", @document)

Then in your form (i.e. using ERB template)

<form action="http://YOUR-S3-BUCKET-NAME.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
  <input type="hidden" name="key" value="${filename}">
  <input type="hidden" name="AWSAccessKeyId" value="YOUR-S3-ACCESS-KEY">
  <input type="hidden" name="acl" value="public-read">
  <input type="hidden" name="success_action_redirect" value="YOUR-CHOICE-OF-CALLBACK">

  <input type="hidden" name="policy" value="<%= @policy_document.policy %>">
  <input type="hidden" name="signature" value="<%= @policy_document.signature %>">

  <input type="hidden" name="Content-Type" value="image/jpeg">
  <!-- Include any additional input fields here -->

  File to upload to S3: <input name="file" type="file"> <input type="submit">
</form>

The example above will post your file to your amazon s3 bucket root and then return to your given callback with parameters containing file info.

FAQs

Package last updated on 05 May 2011

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc