heroic-sns 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +4 -0
- data/.travis.yml +6 -0
- data/CHANGELOG +9 -0
- data/Gemfile +5 -0
- data/README.md +49 -33
- data/Rakefile +15 -0
- data/bin/fake-sns +26 -0
- data/demo/config.ru +54 -0
- data/demo/demo.erb +35 -0
- data/description.txt +6 -0
- data/heroic-sns.gemspec +23 -0
- data/lib/heroic/sns.rb +1 -0
- data/lib/heroic/sns/version.rb +5 -0
- data/test/fixtures/notification.json +12 -0
- data/test/fixtures/sns.crt +15 -0
- data/test/fixtures/sns.key +15 -0
- data/test/fixtures/subscription.json +12 -0
- data/test/fixtures/unsubscribe.json +12 -0
- metadata +44 -12
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2Q1NmY1MjNhNGViOTI4NDk1N2FjZmQzYWZjNTE2ZTM4MzM3OTlkNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmFkMjY5YzdiMDQ3ODMwZjQyNDNkNzY1ZGM3MzU3OWVmNWYzNDJkYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZkY2QwOTkwZmRkMzc4ZmMwNTcyYTc5MDRlZjQ1ZTkxN2JmZjMwZWI4MTA4
|
10
|
+
MTRmYzRjMmRjM2M3YTJiOTdlOGZlN2IyMzQyMjAyYWJiZjQ4OTc2Zjg1Yjll
|
11
|
+
MGQ5NjM5ZmM5ZmY5YjdmYjg4Y2ZmZjFiNmUzZDc2Zjk3OWQwMDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDBhNWZmMzY1N2M0YTM5MWY4Njk0ZWQyNTc0NGY0NDk2NTQ4N2U4NDIwODE1
|
14
|
+
NWMwNjhlNzYyNWUzZmE2YjZiMzBkN2Q3ZGM1NjczMDJiOGQ2MGVlNzAyZDQ5
|
15
|
+
MWY4N2RkZDJlOGQ4YWJlM2U0OTUzN2ZmNDNlZWIyODdjYmEwZDU=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
ADDED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -1,34 +1,40 @@
|
|
1
|
-
# Heroic SNS
|
1
|
+
# Heroic::SNS, Rack middleware for Amazon SNS endpoints
|
2
2
|
|
3
|
-
|
4
|
-
Service (SNS) endpoints.
|
3
|
+
Heroic::SNS provides secure, lightweight Rack middleware for AWS Simple
|
4
|
+
Notification Service (SNS) endpoints.
|
5
5
|
|
6
|
-
SNS messages to your web application are intercepted,
|
7
|
-
|
6
|
+
Any SNS messages POSTed by Amazon to your web application are intercepted,
|
7
|
+
parsed, verified, and then passed along via the `sns.message` environment key.
|
8
8
|
|
9
|
-
If something goes wrong, the error will be passed along
|
10
|
-
environment key. `Endpoint` does not log any messages itself.
|
9
|
+
If something goes wrong, the error will be passed along via the `sns.error`
|
10
|
+
environment key. `Heroic::SNS::Endpoint` does not log any messages itself.
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
**Heroic::SNS aims to be secure.** All message signatures are verified (to avoid
|
13
|
+
forgeries) and stale messages are rejected (to avoid replay attacks).
|
14
|
+
|
15
|
+
**Heroic::SNS aims to be lightweight.** Beside Ruby standard libraries there are
|
16
|
+
no dependencies beside [rack][]. Specifically, Heroic::SNS *does not* depend on [aws-sdk][]. They will be friendly to each other, however, if you include both
|
17
|
+
in a project.
|
15
18
|
|
16
19
|
[aws-sdk]: https://github.com/aws/aws-sdk-ruby
|
17
20
|
[rack]: http://rack.github.io/
|
18
21
|
|
19
22
|
## Overview
|
20
23
|
|
21
|
-
1.
|
22
|
-
2.
|
23
|
-
3.
|
24
|
+
1. `gem install heroic-sns`
|
25
|
+
2. `require 'heroic/sns'`
|
26
|
+
3. Install `Heroic::SNS::Endpoint` in your Rack app's middleware stack
|
27
|
+
4. Get SNS messages from `env['sns.message']`
|
28
|
+
5. Get errors from `env['sns.error']`
|
24
29
|
|
25
30
|
## How to use it
|
26
31
|
|
27
|
-
|
32
|
+
Once you have installed the gem, simply add the following to your `config.ru`
|
33
|
+
file:
|
28
34
|
|
29
35
|
use Heroic::SNS::Endpoint, :topics => /:aws-ses-bounces$/
|
30
36
|
|
31
|
-
|
37
|
+
On Rails, you could also install it in `/config/initializers/sns_endpoint.rb`:
|
32
38
|
|
33
39
|
Rails.application.config.middleware.use Heroic::SNS::Endpoint, :topic => ...
|
34
40
|
|
@@ -36,21 +42,21 @@ The Endpoint class takes an options hash as an argument, and understands these
|
|
36
42
|
options:
|
37
43
|
|
38
44
|
`:topic` is required, and provides a filter that defines what SNS topics are
|
39
|
-
handled by this endpoint. A message is considered either "on-topic" or
|
40
|
-
"off-topic"
|
45
|
+
handled by this endpoint. **A message is considered either "on-topic" or
|
46
|
+
"off-topic".** You can supply any of the following:
|
41
47
|
|
42
|
-
- a single topic ARN
|
43
|
-
-
|
48
|
+
- a `String` containing a single topic ARN
|
49
|
+
- an `Array` of `String` representing a list of topic ARNs
|
44
50
|
- a `RegExp` which matches on-topic ARNs
|
45
51
|
- a `Proc` which accepts an ARN as an argument and returns `true` or `false` for
|
46
52
|
on-topic and off-topic ARNs, respectively.
|
47
53
|
|
48
|
-
The key `
|
54
|
+
The key `:topics` is also supported.
|
49
55
|
|
50
56
|
`:auto_confirm` affects how on-topic subscription confirmations are handled.
|
51
57
|
|
52
|
-
- If `true`, they are confirmed by retrieving the URL in the `SubscribeURL`
|
53
|
-
of the SNS message, and your app is not notified.
|
58
|
+
- If `true`, they are confirmed by retrieving the URL in the `SubscribeURL`
|
59
|
+
field of the SNS message, and your app is not notified.
|
54
60
|
- If `false`, they are ignored; your app is also not notified.
|
55
61
|
- If `nil`, there is no special handling and the message is passed along to your
|
56
62
|
app.
|
@@ -96,7 +102,17 @@ You must skip the authenticity token verification to allow Amazon to POST to the
|
|
96
102
|
controller action. Be careful not to disable it for more actions than you need.
|
97
103
|
Be sure to disable any authentication checks for that action, too.
|
98
104
|
|
99
|
-
##
|
105
|
+
## Multiple endpoint URLs
|
106
|
+
|
107
|
+
If you are receiving multiple notifications at multiple endpoint URLs, you
|
108
|
+
should only include one instance of the Endpoint in your middleware stack, and
|
109
|
+
ensure that its topic filter allows all the notifications you are interested in
|
110
|
+
to pass through.
|
111
|
+
|
112
|
+
`Endpoint` does not interact with the URL path at all; if you want your
|
113
|
+
subscriptions to go to different URLs, simply set them up that way.
|
114
|
+
|
115
|
+
## Off-topic notifications
|
100
116
|
|
101
117
|
As a security measure, `Endpoint` requires you to set up a topic filter. Any
|
102
118
|
notifications that do not match this filter are not passed along to your
|
@@ -114,20 +130,20 @@ messages will be treated as on topic. Be aware that it is dangerous to leave
|
|
114
130
|
`:auto_confirm` enabled with a permissive topic filter, as this will allow
|
115
131
|
anyone to subscribe your web app to any SNS notification.
|
116
132
|
|
117
|
-
##
|
133
|
+
## Contributing
|
118
134
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
135
|
+
* Fork the project.
|
136
|
+
* Make your feature addition or bug fix and include tests.
|
137
|
+
* Update `CHANGELOG`.
|
138
|
+
* Send a pull request.
|
123
139
|
|
124
|
-
|
125
|
-
subscriptions to go to different URLs, simply set them up that way.
|
140
|
+
## Copyright and License
|
126
141
|
|
127
|
-
|
142
|
+
Copyright 2013, Heroic Software Inc and Contributors.
|
128
143
|
|
129
|
-
|
144
|
+
This project [is licensed under the Apache license](LICENSE).
|
130
145
|
|
131
|
-
|
146
|
+
Direct correspondence to Benjamin Ragheb via email at <ben@benzado.com>
|
147
|
+
or on Twitter [@benzado](https://twitter.com/benzado).
|
132
148
|
|
133
149
|
[![Build Status](https://travis-ci.org/benzado/heroic-sns.png?branch=master)](https://travis-ci.org/benzado/heroic-sns)
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
|
7
|
+
Rake::TestTask.new do |t|
|
8
|
+
t.libs << 'test'
|
9
|
+
end
|
10
|
+
|
11
|
+
task :demo do
|
12
|
+
sh 'rackup -Ilib demo/config.ru'
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => :test
|
data/bin/fake-sns
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'securerandom'
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
Net::HTTP.start('localhost', 9292) do |http|
|
7
|
+
ARGV.each do |path|
|
8
|
+
File.open(path) do |f|
|
9
|
+
json = f.read
|
10
|
+
message = JSON.parse(json)
|
11
|
+
type, message_id, topic_arn = message.values_at(*%w[Type MessageId TopicArn])
|
12
|
+
puts "Type: #{type}"
|
13
|
+
puts "MessageId: #{message_id}"
|
14
|
+
puts "TopicArn: #{topic_arn}"
|
15
|
+
headers = {
|
16
|
+
'Content-Type' => 'text/plain',
|
17
|
+
'x-amz-sns-message-type' => type,
|
18
|
+
'x-amz-sns-message-id' => message_id,
|
19
|
+
'x-amz-sns-topic-arn' => topic_arn,
|
20
|
+
'x-amz-sns-subscription-arn' => "#{topic_arn}:#{SecureRandom.uuid}"
|
21
|
+
}
|
22
|
+
res = http.post('/', json, headers)
|
23
|
+
p res
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/demo/config.ru
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'heroic/sns'
|
3
|
+
|
4
|
+
# `rackup -Ilib` at the command line to start this rack app
|
5
|
+
|
6
|
+
class MessageCapture
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
def call(env)
|
11
|
+
if message = env['sns.message']
|
12
|
+
path = "#{message.id}.txt"
|
13
|
+
File.open(path, 'w') { |f| f.write(message.to_json) } unless File.exists?(path)
|
14
|
+
end
|
15
|
+
@app.call(env)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class DemoApp
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
@events = Array.new
|
23
|
+
@template = ERB.new(File.read(File.join(File.dirname(__FILE__), 'demo.erb')))
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(env)
|
27
|
+
if error = env['sns.error']
|
28
|
+
@events << error
|
29
|
+
puts "SNS Error: #{error}"
|
30
|
+
response(500, 'Error')
|
31
|
+
elsif message = env['sns.message']
|
32
|
+
@events << message
|
33
|
+
puts "*** MESSAGE #{message.id} RECEIVED ***"
|
34
|
+
puts "Subject: #{message.subject}\n\n" if message.subject
|
35
|
+
puts message.body
|
36
|
+
puts "*** END MESSAGE ***"
|
37
|
+
response(200, 'OK')
|
38
|
+
else
|
39
|
+
content = @template.result(binding)
|
40
|
+
[200, { 'Content-Type' => 'text/html' }, [ content ]]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def response(code, text)
|
45
|
+
[code, {'Content-Type' => 'text/plain', 'Content-Length' => text.length.to_s}, [text]]
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
use Rack::Lint
|
51
|
+
use Heroic::SNS::Endpoint, topics: Proc.new { true }, auto_confirm: nil, auto_unsubscribe: nil
|
52
|
+
use Rack::Lint
|
53
|
+
use MessageCapture
|
54
|
+
run DemoApp.new
|
data/demo/demo.erb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Heroic::SNS::Endpoint Demo</title>
|
5
|
+
<style>
|
6
|
+
th { text-align: left; }
|
7
|
+
</style>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<p>Send SNS messages to this server and then reload to see them here.</p>
|
11
|
+
<% @events.each do |event| %>
|
12
|
+
<hr/>
|
13
|
+
<% if event.is_a? Heroic::SNS::Error %>
|
14
|
+
<p><b>Error</b> <code><%= event.message %></code></p>
|
15
|
+
<% else %>
|
16
|
+
<table>
|
17
|
+
<tr><th>Message</th><td><%= event.id %></td></td>
|
18
|
+
<tr><th>Topic</th><td><%= event.topic_arn %></td></td>
|
19
|
+
<tr><th>Time</th><td><%= event.timestamp %></td></td>
|
20
|
+
<tr><th>Type</th><td><%= event.type %></td></td>
|
21
|
+
<% if event.subject %>
|
22
|
+
<tr><th>Subject</th><td><%= event.subject %></td></td>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
25
|
+
<pre><%= event.body %></pre>
|
26
|
+
<% if event.subscribe_url %>
|
27
|
+
<div><a href="<%= event.subscribe_url %>">Click Here to Subscribe</a></div>
|
28
|
+
<% end %>
|
29
|
+
<% if event.unsubscribe_url %>
|
30
|
+
<div><a href="<%= event.unsubscribe_url %>">Click Here to Unsubscribe</a></div>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
</body>
|
35
|
+
</html>
|
data/description.txt
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
Secure, lightweight Rack middleware for Amazon Simple Notification Service (SNS)
|
2
|
+
endpoints. SNS messages are intercepted, parsed, verified, and then passed along
|
3
|
+
to the web application via the 'sns.message' environment key. Heroic::SNS has no
|
4
|
+
dependencies besides Rack (specifically, the aws-sdk gem is not needed).
|
5
|
+
SNS message signatures are verified in order to reject forgeries and replay
|
6
|
+
attacks.
|
data/heroic-sns.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "heroic/sns/version"
|
3
|
+
|
4
|
+
# See: http://guides.rubygems.org/specification-reference/
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'heroic-sns'
|
8
|
+
s.version = Heroic::SNS::VERSION
|
9
|
+
s.summary = "Lightweight Rack middleware for AWS SNS endpoints"
|
10
|
+
s.description = File.read('description.txt')
|
11
|
+
s.license = 'Apache'
|
12
|
+
|
13
|
+
s.author = "Benjamin Ragheb"
|
14
|
+
s.email = 'ben@benzado.com'
|
15
|
+
s.homepage = 'https://github.com/benzado/heroic-sns'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
|
19
|
+
s.platform = Gem::Platform::RUBY
|
20
|
+
s.required_ruby_version = '>= 1.8.7'
|
21
|
+
s.add_runtime_dependency 'rack', '~> 1.4'
|
22
|
+
s.add_runtime_dependency 'json', '~> 1.7.7'
|
23
|
+
end
|
data/lib/heroic/sns.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"Type" : "Notification",
|
3
|
+
"MessageId" : "5b75c78f-8c52-5271-9250-8e51f8ced1a1",
|
4
|
+
"TopicArn" : "arn:aws:sns:us-east-1:777594007835:racktest",
|
5
|
+
"Subject" : "tmnt",
|
6
|
+
"Message" : "booyakasha!",
|
7
|
+
"Timestamp" : "2013-04-09T19:56:12.524Z",
|
8
|
+
"SignatureVersion" : "1",
|
9
|
+
"Signature" : "E6kUvZBxVnybY2tX3XpRlkZGfxw6W+d0E38IRBmrmLn/ANMx6RdG694xOguZsPX+t1rGvCMUmF9uPTJAkCTAkeCsy+VzYrvujgBTg2i50Lt/sfFslAOZFGXntHjN1R865VO8pscviCxFsaaiKobcAw2UjdgMguMZ6xrt80LAJFM=",
|
10
|
+
"SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
|
11
|
+
"UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:777594007835:racktest:24ed571c-0bdb-4da8-925a-f47aa0777a00"
|
12
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIICSzCCAbQCCQDjh2/2exmnNjANBgkqhkiG9w0BAQUFADBqMQswCQYDVQQGEwJV
|
3
|
+
UzETMBEGA1UECAwKV2FzaGluZ3RvbjEQMA4GA1UEBwwHU2VhdHRsZTEYMBYGA1UE
|
4
|
+
CgwPQW1hem9uLmNvbSBJbmMuMRowGAYDVQQDDBFzbnMuYW1hem9uYXdzLmNvbTAe
|
5
|
+
Fw0xMzA1MDUwNjUwMjVaFw0yMzA1MDUwNjUwMjVaMGoxCzAJBgNVBAYTAlVTMRMw
|
6
|
+
EQYDVQQIDApXYXNoaW5ndG9uMRAwDgYDVQQHDAdTZWF0dGxlMRgwFgYDVQQKDA9B
|
7
|
+
bWF6b24uY29tIEluYy4xGjAYBgNVBAMMEXNucy5hbWF6b25hd3MuY29tMIGfMA0G
|
8
|
+
CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCurgL0UtoZn07o7RTSgLI2OB8zvWJQGml
|
9
|
+
EJg9sklFL4DLsoqGU0qrQOq1AtbSevUlkIEHjrp9yZZqKBtbTtEeLYHeKdCQ/cYI
|
10
|
+
jS/VpYssfNM3aCjNUcgOZzAL3jr2xKNE7IaQRY1DUp3CNCq9prj1ieZ/pTa9M93P
|
11
|
+
freWW8S2ywIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAKXys+Orn3upqKnntj2+ZazJ
|
12
|
+
Jflvh91E7oQ2/pmWtO5jHKhu0hkD1yxbdQX2zTDuXhhoGN2pxSvvqCalR0lLQZLV
|
13
|
+
usV2I8HhTH8pYQTZWBW9kfdB1vgbB50J4O2PUnP4g2VgzOMi4Vzt2/WSSQdmMmVV
|
14
|
+
sLGpdYn+U2IvPgc5jdMV
|
15
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,15 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIICXgIBAAKBgQDCurgL0UtoZn07o7RTSgLI2OB8zvWJQGmlEJg9sklFL4DLsoqG
|
3
|
+
U0qrQOq1AtbSevUlkIEHjrp9yZZqKBtbTtEeLYHeKdCQ/cYIjS/VpYssfNM3aCjN
|
4
|
+
UcgOZzAL3jr2xKNE7IaQRY1DUp3CNCq9prj1ieZ/pTa9M93PfreWW8S2ywIDAQAB
|
5
|
+
AoGBAJ1di5JxRwFNofLqbrXIX8u0CGaUUbTjSvzMFlv1kmTI6Mq0tGGtOfB/e61g
|
6
|
+
Z/6cwzPiPYPAAlHY8SdE1ibJ4Q+ZY1QSJJ7aPBTCoZtoa/pXzWtfgRu5CGRCDpLu
|
7
|
+
WTEn6zwv8eNmeX8C5GTLGKBDeo2wUJ9hgyXHH9BasUSVQsuhAkEA96tCmARErCrT
|
8
|
+
OdDg/nO1qxH6822lqzdlJoZzUmXooUidCTM6SmDZh+xeR/u1AVNi+Ay8ImPf1pir
|
9
|
+
yyg7+snu0wJBAMlHlR1D1F9R1poYXWNgCG3ubNYeAcENjnjTVaTcPY0GjLoQqeHI
|
10
|
+
ZdOIH0IXGcG30PzCiN5U9gstYTZIfEoITSkCQQCnTpn992QsqgFm3SQgwCnJFqxg
|
11
|
+
JYH018cM72aYEx/DVDpBLMoD1MkeeR53oiH0c1A4IOI2mSFs5lWnN9bM4/zhAkEA
|
12
|
+
le21PBxXaD08noIBplFVVhWgionFgrkHZCb/h5LqYk77qmlZMa6lcsDVj9RHQk4a
|
13
|
+
5Pw/GWWt9LtzywyJUFgIqQJAUrBbnrmRqUWvlpjDaKeAAMy8URsp6UfSUZzoE5fe
|
14
|
+
oe/flOqC8m4SjxLvq+vZNeavP5/j5j4BRf+g5gD0GqXRIg==
|
15
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"Type" : "SubscriptionConfirmation",
|
3
|
+
"MessageId" : "0d2474c6-4928-4878-aced-421f2f197b96",
|
4
|
+
"Token" : "2336412f37fb687f5d51e6e241d164b14a5cd1b9e576b8d39bd752f279ff94cfb9d0ba217bdf2898e2b48d719b903880a5332117e194d90f7ee844ddbd8d672883f7d83eb9f780cff7319dc07a004c79ee4d55d0a29e782d8ac2f6ef751f8c02728f3382c8ab3f5ce0b8a439f985bac5",
|
5
|
+
"TopicArn" : "arn:aws:sns:us-east-1:777594007835:racktest",
|
6
|
+
"Message" : "You have chosen to subscribe to the topic arn:aws:sns:us-east-1:777594007835:racktest.\nTo confirm the subscription, visit the SubscribeURL included in this message.",
|
7
|
+
"SubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-1:777594007835:racktest&Token=2336412f37fb687f5d51e6e241d164b14a5cd1b9e576b8d39bd752f279ff94cfb9d0ba217bdf2898e2b48d719b903880a5332117e194d90f7ee844ddbd8d672883f7d83eb9f780cff7319dc07a004c79ee4d55d0a29e782d8ac2f6ef751f8c02728f3382c8ab3f5ce0b8a439f985bac5",
|
8
|
+
"Timestamp" : "2013-04-09T19:44:39.541Z",
|
9
|
+
"SignatureVersion" : "1",
|
10
|
+
"Signature" : "ce73LnwE9kZ4sEUEGh/s63myK/sb7x1HkwP079h08CQN1wIF9/HVdqCEB56o8ngc9x1bp1lKQtHVVMPUWEoNnx1CJinj8/BcL0BiEL2Q/+4og1ucWMQ/3vnISVwE5MUrYzcDBFJdrZHDEO3RRCVeqF4GHV0nuD1CqKzvven8ORU=",
|
11
|
+
"SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem"
|
12
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"Type" : "UnsubscribeConfirmation",
|
3
|
+
"MessageId" : "30ce782a-cb22-474a-bb42-a4b2ebd0df6a",
|
4
|
+
"Token" : "2336412f37fb687f5d51e6e241d164b14a5cd1b9e5753984c8d8cb6b1ec4709760069dd0e49f5b8f0b9030fcd08778bf41c80d105a934de1699bdb77e286185a7e24c142b55cd16f58b7e7eedc478a384c875379b2d6d9f153a3909dd0912eb84e3c9c5a210f68f9ce8707a0d23d14f4",
|
5
|
+
"TopicArn" : "arn:aws:sns:us-east-1:777594007835:racktest",
|
6
|
+
"Message" : "You have chosen to deactivate subscription arn:aws:sns:us-east-1:777594007835:racktest:24ed571c-0bdb-4da8-925a-f47aa0777a00.\nTo cancel this operation and restore the subscription, visit the SubscribeURL included in this message.",
|
7
|
+
"SubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-1:777594007835:racktest&Token=2336412f37fb687f5d51e6e241d164b14a5cd1b9e5753984c8d8cb6b1ec4709760069dd0e49f5b8f0b9030fcd08778bf41c80d105a934de1699bdb77e286185a7e24c142b55cd16f58b7e7eedc478a384c875379b2d6d9f153a3909dd0912eb84e3c9c5a210f68f9ce8707a0d23d14f4",
|
8
|
+
"Timestamp" : "2013-04-09T20:00:52.060Z",
|
9
|
+
"SignatureVersion" : "1",
|
10
|
+
"Signature" : "M2cQRoTu16zvpZr8q8tgLuZeea1d5K+PS/AT1MqVCbGVr1hiax24JzlymoKSDYGTLAYFbLlh+Kx+0gbOQKfIVoxfUofsFZtCp/RW+iEAfinDfVBSfFoMyTeVVLZgsdigrdUVO99R707XwbS4zftj3dpIFP/2R5RzNzzPuAMN+pM=",
|
11
|
+
"SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem"
|
12
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroic-sns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Ragheb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -24,16 +24,33 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.4'
|
27
|
-
|
28
|
-
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.7
|
41
|
+
description: ! 'Secure, lightweight Rack middleware for Amazon Simple Notification
|
42
|
+
Service (SNS)
|
43
|
+
|
44
|
+
endpoints. SNS messages are intercepted, parsed, verified, and then passed along
|
29
45
|
|
30
|
-
|
46
|
+
to the web application via the ''sns.message'' environment key. Heroic::SNS has
|
47
|
+
no
|
31
48
|
|
32
|
-
|
49
|
+
dependencies besides Rack (specifically, the aws-sdk gem is not needed).
|
33
50
|
|
34
|
-
|
51
|
+
SNS message signatures are verified in order to reject forgeries and replay
|
35
52
|
|
36
|
-
|
53
|
+
attacks.
|
37
54
|
|
38
55
|
'
|
39
56
|
email: ben@benzado.com
|
@@ -41,11 +58,27 @@ executables: []
|
|
41
58
|
extensions: []
|
42
59
|
extra_rdoc_files: []
|
43
60
|
files:
|
44
|
-
-
|
61
|
+
- .gitignore
|
62
|
+
- .travis.yml
|
63
|
+
- CHANGELOG
|
64
|
+
- Gemfile
|
45
65
|
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/fake-sns
|
69
|
+
- demo/config.ru
|
70
|
+
- demo/demo.erb
|
71
|
+
- description.txt
|
72
|
+
- heroic-sns.gemspec
|
73
|
+
- lib/heroic/sns.rb
|
46
74
|
- lib/heroic/sns/endpoint.rb
|
47
75
|
- lib/heroic/sns/message.rb
|
48
|
-
- lib/heroic/sns.rb
|
76
|
+
- lib/heroic/sns/version.rb
|
77
|
+
- test/fixtures/notification.json
|
78
|
+
- test/fixtures/sns.crt
|
79
|
+
- test/fixtures/sns.key
|
80
|
+
- test/fixtures/subscription.json
|
81
|
+
- test/fixtures/unsubscribe.json
|
49
82
|
- test/helper.rb
|
50
83
|
- test/test_endpoint.rb
|
51
84
|
- test/test_message.rb
|
@@ -53,7 +86,7 @@ homepage: https://github.com/benzado/heroic-sns
|
|
53
86
|
licenses:
|
54
87
|
- Apache
|
55
88
|
metadata: {}
|
56
|
-
post_install_message:
|
89
|
+
post_install_message:
|
57
90
|
rdoc_options: []
|
58
91
|
require_paths:
|
59
92
|
- lib
|
@@ -74,4 +107,3 @@ signing_key:
|
|
74
107
|
specification_version: 4
|
75
108
|
summary: Lightweight Rack middleware for AWS SNS endpoints
|
76
109
|
test_files: []
|
77
|
-
has_rdoc:
|