aws-sdk-rails 3.7.0 → 3.7.1

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: e4a36f06cb28402d5c089672aa4e88a7ec087d61496c5d2f2855a61c11b3ca4b
4
- data.tar.gz: 19f617df06780135dd75d1f6e76911c2104f8b3f2201b0654b97d29a2fd61bbc
3
+ metadata.gz: 48698b21d8248ac597ad8fd9d334e52d9399cf5880c994ffe556aa2e988f81e6
4
+ data.tar.gz: bd88191e84e5676435a2d2135ad6f6835cb8c624eef573c688a81c3bd9e8f255
5
5
  SHA512:
6
- metadata.gz: 4d0fb987757cb4b86b660e3180355a8d9870df3f85798f4ab1d085cd03fb448cba686438f0ee7bc96687daeac5faeeee44e8bdf0e88097c243d70bf1531dd0c5
7
- data.tar.gz: ad77218a0c85cf43fe3eb8123dedd52d7914bdbfa6323a46299b743c97340edf5fe59774efae0fece141b9ae4e02949e2d17ad2cb00bb119e514e6367442c929
6
+ metadata.gz: ec0f7a6f90b736285486d3a36d7aab50cf1d368d9ea69f4b76031634b16df1e899d8146586b9b806f0921f2afebecc5444fe25badf4f0d8bf54a3cf42f472b3c
7
+ data.tar.gz: bbfe9b2488cf8c141a5e196a2ebe9631705ed176327db28a1503213f82aac81f3ec37be4f77109665fbf3690c344c52870b39f5c12f35d031b89387b057bbe5a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.7.1
@@ -81,12 +81,30 @@ module Aws
81
81
  end
82
82
 
83
83
  def sent_from_docker_host?(request)
84
- app_runs_in_docker_container? && request.ip == '172.17.0.1'
84
+ app_runs_in_docker_container? && default_gw_ips.include?(request.ip)
85
85
  end
86
86
 
87
87
  def app_runs_in_docker_container?
88
88
  @app_runs_in_docker_container ||= `[ -f /proc/1/cgroup ] && cat /proc/1/cgroup` =~ /docker/
89
89
  end
90
+
91
+ def default_gw_ips
92
+ default_gw_ips = ['172.17.0.1']
93
+
94
+ if File.exist?('/proc/net/route')
95
+ File.open('/proc/net/route').each_line do |line|
96
+ fields = line.strip.split
97
+ next if fields.size != 11
98
+
99
+ # Destination == 0.0.0.0 and Flags & RTF_GATEWAY != 0
100
+ if fields[1] == '00000000' && (fields[3].hex & 0x2) != 0
101
+ default_gw_ips << IPAddr.new_ntoh([fields[2].hex].pack('L')).to_s
102
+ end
103
+ end
104
+ end
105
+
106
+ default_gw_ips
107
+ end
90
108
  end
91
109
  end
92
110
  end
@@ -25,12 +25,17 @@ module Aws
25
25
  # Rails expects this method to exist, and to handle a Mail::Message object
26
26
  # correctly. Called during mail delivery.
27
27
  def deliver!(message)
28
- params = {
29
- content: { raw: { data: message.to_s } },
30
- from_email_address: message.smtp_envelope_from, # defaults to From header
31
- # defaults to destinations (To,Cc,Bcc) - stick all on bcc to be delivered anyway
32
- destination: { bcc_addresses: message.smtp_envelope_to }
28
+ params = { content: { raw: { data: message.to_s } } }
29
+ # smtp_envelope_from will default to the From address *without* sender names.
30
+ # By omitting this param, SESv2 will correctly use sender names from the mail headers.
31
+ # We should only use smtp_envelope_from when it was explicitly set (instance variable set)
32
+ params[:from_email_address] = message.smtp_envelope_from if message.instance_variable_get(:@smtp_envelope_from)
33
+ params[:destination] = {
34
+ to_addresses: to_addresses(message),
35
+ cc_addresses: message.cc,
36
+ bcc_addresses: message.bcc
33
37
  }
38
+
34
39
  @client.send_email(params).tap do |response|
35
40
  message.header[:ses_message_id] = response.message_id
36
41
  end
@@ -40,6 +45,15 @@ module Aws
40
45
  def settings
41
46
  {}
42
47
  end
48
+
49
+ private
50
+
51
+ # smtp_envelope_to will default to the full destinations (To, Cc, Bcc)
52
+ # SES v2 API prefers each component split out into a destination hash.
53
+ # When smtp_envelope_to was set, use it explicitly for to_address only.
54
+ def to_addresses(message)
55
+ message.instance_variable_get(:@smtp_envelope_to) ? message.smtp_envelope_to : message.to
56
+ end
43
57
  end
44
58
  end
45
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-record
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  requirements: []
182
- rubygems_version: 3.2.7
182
+ rubygems_version: 3.2.3
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: AWS SDK for Ruby on Rails Plugin