postageapp 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb7fce16defbeb345e4b38780b1fe03a30b15aa60a6da835366f7ae583fef0e
|
4
|
+
data.tar.gz: 5201a95c68b7c63ae1db1059131dd31fbc0a4945ebec7f8540ac52d838a81f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d57a61ffdc8390963c98490e6b0e68cf98ccf396294cd603acc35c1874044d4453d69ccdbccb550f2cbc7746d64b19078dd62be7d915d80527922048c9909d97
|
7
|
+
data.tar.gz: d93cbdac054b4b5cce7c18e64aa911970c8746293b87f595e1964ccfccc63ad4f7ef9df09412a6e167b9c8982645dd679b56ef90a31f1cb19deda2cc967ef04d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.2
|
@@ -1,50 +1,52 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if (defined?(ActionMailbox) and defined?(ActionMailbox::BaseController))
|
4
|
+
class ActionMailbox::Ingresses::PostageApp::InboundEmailsController < ActionMailbox::BaseController
|
5
|
+
before_action :hmac_authenticate
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
def create
|
8
|
+
ActionMailbox::InboundEmail.create_and_extract_message_id!(message_param)
|
8
9
|
|
9
|
-
|
10
|
+
head(:ok)
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
rescue JSON::ParserError => e
|
13
|
+
logger.error(e.message)
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
head(:unprocessable_entity)
|
16
|
+
end
|
16
17
|
|
17
|
-
private
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
private
|
19
|
+
def message_param
|
20
|
+
params.require(:inbound_email).require(:message)
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
def hmac_authenticate
|
24
|
+
return if (hmac_authenticated?)
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
head(:unauthorized)
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
def hmac_authenticated?
|
30
|
+
if (PostageApp.config.postback_secret.present?)
|
31
|
+
ActiveSupport::SecurityUtils.secure_compare(
|
32
|
+
request.headers["X-PostageApp-Signature"],
|
33
|
+
hmac_signature(message_param, PostageApp.config.postback_secret)
|
34
|
+
)
|
35
|
+
else
|
36
|
+
raise ArgumentError, <<~END.squish
|
37
|
+
Missing required PostageApp "postback secret" which can be set as
|
38
|
+
in the Rails Encypted Credentials, as POSTAGEAPP_API_POSTBACK_SECRET
|
39
|
+
in the environment, or via a config/initializer script using the
|
40
|
+
PostageApp.config method.
|
41
|
+
END
|
42
|
+
end
|
41
43
|
end
|
42
|
-
end
|
43
44
|
|
44
|
-
private
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
private
|
46
|
+
def hmac_signature(*content)
|
47
|
+
Base64.strict_encode64(
|
48
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, *content)
|
49
|
+
)
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
PostageApp::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
if (defined?(ActionMailbox))
|
3
|
+
scope '/rails/action_mailbox', module: 'action_mailbox/ingresses' do
|
4
|
+
post '/postageapp/inbound_emails' => 'postage_app/inbound_emails#create',
|
5
|
+
as: :rails_postageapp_inbound_emails
|
6
|
+
end
|
5
7
|
end
|
6
8
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postageapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Tadman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-08-
|
13
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mail
|