mail_auto_link_obfuscation 0.2.7 → 0.3.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
- SHA1:
3
- metadata.gz: afdc835449188464de0de10eb60cd622c564ca91
4
- data.tar.gz: 285be28ed5043ffdab0082b2513b8f3e572cfaf3
2
+ SHA256:
3
+ metadata.gz: 25cb29191595a408dacac489db869286e5895f83497924b27ae270ed402f3239
4
+ data.tar.gz: 666cc0e79edecd20b0b68846b280e251ac0d45b090c1ec7d7463294b8eb6d6ed
5
5
  SHA512:
6
- metadata.gz: a29d8b3086cff05e51dc5ad92a0ccaf59fea234b4edf31cfe7bacfed0d38f35959ea51024d4c2adeafaf22511cc145c60e477934872afa5003782f03aa88a811
7
- data.tar.gz: 1711fff680ca39d034d6c82440da0e0ba8fa69c0647e9f61c023eb0ece680ea45961649545a383c3f0a22bd9aba0639917d282af22960718b237a8c310f6e961
6
+ metadata.gz: b5873c4db807994bc387a69c73259c2f8fd2b5df1d4cd5e102a269fb0c24db3c1f433a86fd71e14317114ff9d72cfad382df4d942c0c14c3aa33a4204b6028c0
7
+ data.tar.gz: de29337c0f65d77ff010506b776a659fbba854188dc83e59b0c3daffc642fccd7c9b7da2ddfc328c4d90a422f3f71177bc8e750efa2fdb35d1a33d81874fe2e9
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
data/Gemfile.lock ADDED
@@ -0,0 +1,221 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mail_auto_link_obfuscation (0.3.0)
5
+ mail (~> 2.5)
6
+ nokogiri (~> 1.6)
7
+ railties (>= 3.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (7.0.0.alpha2)
13
+ actionpack (= 7.0.0.alpha2)
14
+ activesupport (= 7.0.0.alpha2)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ actionmailbox (7.0.0.alpha2)
18
+ actionpack (= 7.0.0.alpha2)
19
+ activejob (= 7.0.0.alpha2)
20
+ activerecord (= 7.0.0.alpha2)
21
+ activestorage (= 7.0.0.alpha2)
22
+ activesupport (= 7.0.0.alpha2)
23
+ mail (>= 2.7.1)
24
+ actionmailer (7.0.0.alpha2)
25
+ actionpack (= 7.0.0.alpha2)
26
+ actionview (= 7.0.0.alpha2)
27
+ activejob (= 7.0.0.alpha2)
28
+ activesupport (= 7.0.0.alpha2)
29
+ mail (~> 2.5, >= 2.5.4)
30
+ rails-dom-testing (~> 2.0)
31
+ actionpack (7.0.0.alpha2)
32
+ actionview (= 7.0.0.alpha2)
33
+ activesupport (= 7.0.0.alpha2)
34
+ rack (~> 2.0, >= 2.2.0)
35
+ rack-test (>= 0.6.3)
36
+ rails-dom-testing (~> 2.0)
37
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
+ actiontext (7.0.0.alpha2)
39
+ actionpack (= 7.0.0.alpha2)
40
+ activerecord (= 7.0.0.alpha2)
41
+ activestorage (= 7.0.0.alpha2)
42
+ activesupport (= 7.0.0.alpha2)
43
+ nokogiri (>= 1.8.5)
44
+ actionview (7.0.0.alpha2)
45
+ activesupport (= 7.0.0.alpha2)
46
+ builder (~> 3.1)
47
+ erubi (~> 1.4)
48
+ rails-dom-testing (~> 2.0)
49
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
+ activejob (7.0.0.alpha2)
51
+ activesupport (= 7.0.0.alpha2)
52
+ globalid (>= 0.3.6)
53
+ activemodel (7.0.0.alpha2)
54
+ activesupport (= 7.0.0.alpha2)
55
+ activerecord (7.0.0.alpha2)
56
+ activemodel (= 7.0.0.alpha2)
57
+ activesupport (= 7.0.0.alpha2)
58
+ activestorage (7.0.0.alpha2)
59
+ actionpack (= 7.0.0.alpha2)
60
+ activejob (= 7.0.0.alpha2)
61
+ activerecord (= 7.0.0.alpha2)
62
+ activesupport (= 7.0.0.alpha2)
63
+ marcel (~> 1.0.0)
64
+ mini_mime (>= 1.1.0)
65
+ activesupport (7.0.0.alpha2)
66
+ concurrent-ruby (~> 1.0, >= 1.0.2)
67
+ i18n (>= 1.6, < 2)
68
+ minitest (>= 5.1)
69
+ tzinfo (~> 2.0)
70
+ ast (2.4.2)
71
+ builder (3.2.4)
72
+ coderay (1.1.3)
73
+ concurrent-ruby (1.1.9)
74
+ crass (1.0.6)
75
+ diff-lcs (1.4.4)
76
+ erubi (1.10.0)
77
+ ffi (1.15.4)
78
+ formatador (0.3.0)
79
+ globalid (0.5.2)
80
+ activesupport (>= 5.0)
81
+ guard (2.18.0)
82
+ formatador (>= 0.2.4)
83
+ listen (>= 2.7, < 4.0)
84
+ lumberjack (>= 1.0.12, < 2.0)
85
+ nenv (~> 0.1)
86
+ notiffany (~> 0.0)
87
+ pry (>= 0.13.0)
88
+ shellany (~> 0.0)
89
+ thor (>= 0.18.1)
90
+ guard-compat (1.2.1)
91
+ guard-rspec (4.7.3)
92
+ guard (~> 2.1)
93
+ guard-compat (~> 1.1)
94
+ rspec (>= 2.99.0, < 4.0)
95
+ i18n (1.8.10)
96
+ concurrent-ruby (~> 1.0)
97
+ listen (3.7.0)
98
+ rb-fsevent (~> 0.10, >= 0.10.3)
99
+ rb-inotify (~> 0.9, >= 0.9.10)
100
+ loofah (2.12.0)
101
+ crass (~> 1.0.2)
102
+ nokogiri (>= 1.5.9)
103
+ lumberjack (1.2.8)
104
+ mail (2.7.1)
105
+ mini_mime (>= 0.1.1)
106
+ marcel (1.0.1)
107
+ method_source (1.0.0)
108
+ mini_mime (1.1.1)
109
+ minitest (5.14.4)
110
+ nenv (0.3.0)
111
+ nio4r (2.5.8)
112
+ nokogiri (1.12.4-x86_64-linux)
113
+ racc (~> 1.4)
114
+ notiffany (0.1.3)
115
+ nenv (~> 0.1)
116
+ shellany (~> 0.0)
117
+ parallel (1.21.0)
118
+ parser (3.0.2.0)
119
+ ast (~> 2.4.1)
120
+ pry (0.14.1)
121
+ coderay (~> 1.1)
122
+ method_source (~> 1.0)
123
+ racc (1.5.2)
124
+ rack (2.2.3)
125
+ rack-test (1.1.0)
126
+ rack (>= 1.0, < 3)
127
+ rails (7.0.0.alpha2)
128
+ actioncable (= 7.0.0.alpha2)
129
+ actionmailbox (= 7.0.0.alpha2)
130
+ actionmailer (= 7.0.0.alpha2)
131
+ actionpack (= 7.0.0.alpha2)
132
+ actiontext (= 7.0.0.alpha2)
133
+ actionview (= 7.0.0.alpha2)
134
+ activejob (= 7.0.0.alpha2)
135
+ activemodel (= 7.0.0.alpha2)
136
+ activerecord (= 7.0.0.alpha2)
137
+ activestorage (= 7.0.0.alpha2)
138
+ activesupport (= 7.0.0.alpha2)
139
+ bundler (>= 1.15.0)
140
+ railties (= 7.0.0.alpha2)
141
+ sprockets-rails (>= 2.0.0)
142
+ rails-dom-testing (2.0.3)
143
+ activesupport (>= 4.2.0)
144
+ nokogiri (>= 1.6)
145
+ rails-html-sanitizer (1.4.2)
146
+ loofah (~> 2.3)
147
+ railties (7.0.0.alpha2)
148
+ actionpack (= 7.0.0.alpha2)
149
+ activesupport (= 7.0.0.alpha2)
150
+ method_source
151
+ rake (>= 0.13)
152
+ thor (~> 1.0)
153
+ zeitwerk (~> 2.5.0.beta3)
154
+ rainbow (3.0.0)
155
+ rake (13.0.6)
156
+ rb-fsevent (0.11.0)
157
+ rb-inotify (0.10.1)
158
+ ffi (~> 1.0)
159
+ regexp_parser (2.1.1)
160
+ rexml (3.2.5)
161
+ rspec (3.10.0)
162
+ rspec-core (~> 3.10.0)
163
+ rspec-expectations (~> 3.10.0)
164
+ rspec-mocks (~> 3.10.0)
165
+ rspec-core (3.10.1)
166
+ rspec-support (~> 3.10.0)
167
+ rspec-expectations (3.10.1)
168
+ diff-lcs (>= 1.2.0, < 2.0)
169
+ rspec-support (~> 3.10.0)
170
+ rspec-mocks (3.10.2)
171
+ diff-lcs (>= 1.2.0, < 2.0)
172
+ rspec-support (~> 3.10.0)
173
+ rspec-support (3.10.2)
174
+ rubocop (1.21.0)
175
+ parallel (~> 1.10)
176
+ parser (>= 3.0.0.0)
177
+ rainbow (>= 2.2.2, < 4.0)
178
+ regexp_parser (>= 1.8, < 3.0)
179
+ rexml
180
+ rubocop-ast (>= 1.9.1, < 2.0)
181
+ ruby-progressbar (~> 1.7)
182
+ unicode-display_width (>= 1.4.0, < 3.0)
183
+ rubocop-ast (1.11.0)
184
+ parser (>= 3.0.1.1)
185
+ rubocop-rspec (2.4.0)
186
+ rubocop (~> 1.0)
187
+ rubocop-ast (>= 1.1.0)
188
+ ruby-progressbar (1.11.0)
189
+ shellany (0.0.1)
190
+ sprockets (4.0.2)
191
+ concurrent-ruby (~> 1.0)
192
+ rack (> 1, < 3)
193
+ sprockets-rails (3.2.2)
194
+ actionpack (>= 4.0)
195
+ activesupport (>= 4.0)
196
+ sprockets (>= 3.0.0)
197
+ thor (1.1.0)
198
+ tzinfo (2.0.4)
199
+ concurrent-ruby (~> 1.0)
200
+ unicode-display_width (2.1.0)
201
+ websocket-driver (0.7.5)
202
+ websocket-extensions (>= 0.1.0)
203
+ websocket-extensions (0.1.5)
204
+ zeitwerk (2.5.0.beta3)
205
+
206
+ PLATFORMS
207
+ x86_64-linux
208
+
209
+ DEPENDENCIES
210
+ bundler
211
+ guard
212
+ guard-rspec
213
+ mail_auto_link_obfuscation!
214
+ rails (>= 3.0)
215
+ rake
216
+ rspec
217
+ rubocop
218
+ rubocop-rspec
219
+
220
+ BUNDLED WITH
221
+ 2.2.26
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This gem hooks up your Rails application and prevents email clients from automatically converting link-like text (e.g. `example.com`, `info@example.com`, `ftp://123.234.234.234`) to hyperlinks in your emails.
4
4
 
5
- Automatic links can be an undesired feature, especially when user generated content is part of your emails, e.g. a user's name. If your user is called `your.enemy.com` and you insert his name directly in your mail, you will find that most email clients will make this name clickable. This effect can brake your email layout/design and even worse, it can be considered a security issue.
5
+ Automatic links can be an undesired feature, especially when user generated content is part of your emails, e.g. a user's name. If your user is called `your.enemy.com` and you insert the name directly in your mail, you will find that most email clients will make this name clickable. This effect can brake your email layout/design and even worse, it can be considered a security issue.
6
6
 
7
7
  To prevent email clients from auto-linking any link-like text we have to outsmart their link parsers. Wrapping special link characters like `.`, `/` and `@` with invisible/non-printable [zero-width non-joiner](https://en.wikipedia.org/wiki/Zero-width_non-joiner) characters (Unicode U+200C) has shown to work for most email clients.
8
8
 
@@ -31,8 +31,8 @@ module MailAutoLinkObfuscation
31
31
 
32
32
  def extract_link_whitelist_from(doc)
33
33
  return Set.new unless doc
34
- whitelist = doc.xpath('//@href').map { |href| href.content.sub(/\Amailto:/, '') }.to_set
35
- whitelist.merge(whitelist.map { |href| href.sub(%r{\A[a-z]+://}, '') })
34
+ whitelist = doc.xpath('//@href').map { |href| href.content.sub(/\Amailto:|[?#].*\z/, '') }.to_set
35
+ whitelist.merge(whitelist.map { |href| href.sub(%r{\A\w+://}, '') })
36
36
  end
37
37
 
38
38
  def html_body_doc
@@ -79,7 +79,7 @@ module MailAutoLinkObfuscation
79
79
 
80
80
  def transform_auto_linked_pattern(text)
81
81
  text.gsub(AUTO_LINKED_PATTERN) do |match|
82
- @link_whitelist.include?(match) ? match : yield(match)
82
+ @link_whitelist.any? { |whitelisted_link| match.start_with?(whitelisted_link) } ? match : yield(match)
83
83
  end
84
84
  end
85
85
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailAutoLinkObfuscation
4
- VERSION = '0.2.7'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -20,14 +20,14 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'mail', '~> 2.5'
22
22
  spec.add_dependency 'nokogiri', '~> 1.6'
23
- spec.add_dependency 'railties', '>= 3.0', '~> 5.0'
23
+ spec.add_dependency 'railties', '>= 3.0'
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.12'
26
- spec.add_development_dependency 'guard', '~> 2.14'
27
- spec.add_development_dependency 'guard-rspec', '~> 4.7'
28
- spec.add_development_dependency 'rails', '>= 3.0', '~> 5.0'
29
- spec.add_development_dependency 'rake', '~> 10.0'
30
- spec.add_development_dependency 'rspec', '~> 3.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.49'
32
- spec.add_development_dependency 'rubocop-rspec', '~> 1.7'
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'guard'
27
+ spec.add_development_dependency 'guard-rspec'
28
+ spec.add_development_dependency 'rails', '>= 3.0'
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
32
+ spec.add_development_dependency 'rubocop-rspec'
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_auto_link_obfuscation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Jundt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
11
+ date: 2021-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -45,9 +45,6 @@ dependencies:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
- - - "~>"
49
- - !ruby/object:Gem::Version
50
- version: '5.0'
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -55,51 +52,48 @@ dependencies:
55
52
  - - ">="
56
53
  - !ruby/object:Gem::Version
57
54
  version: '3.0'
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '5.0'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: bundler
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - "~>"
59
+ - - ">="
66
60
  - !ruby/object:Gem::Version
67
- version: '1.12'
61
+ version: '0'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
- - - "~>"
66
+ - - ">="
73
67
  - !ruby/object:Gem::Version
74
- version: '1.12'
68
+ version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: guard
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - "~>"
73
+ - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '2.14'
75
+ version: '0'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - "~>"
80
+ - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '2.14'
82
+ version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: guard-rspec
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - "~>"
87
+ - - ">="
94
88
  - !ruby/object:Gem::Version
95
- version: '4.7'
89
+ version: '0'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
- - - "~>"
94
+ - - ">="
101
95
  - !ruby/object:Gem::Version
102
- version: '4.7'
96
+ version: '0'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: rails
105
99
  requirement: !ruby/object:Gem::Requirement
@@ -107,9 +101,6 @@ dependencies:
107
101
  - - ">="
108
102
  - !ruby/object:Gem::Version
109
103
  version: '3.0'
110
- - - "~>"
111
- - !ruby/object:Gem::Version
112
- version: '5.0'
113
104
  type: :development
114
105
  prerelease: false
115
106
  version_requirements: !ruby/object:Gem::Requirement
@@ -117,65 +108,62 @@ dependencies:
117
108
  - - ">="
118
109
  - !ruby/object:Gem::Version
119
110
  version: '3.0'
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: '5.0'
123
111
  - !ruby/object:Gem::Dependency
124
112
  name: rake
125
113
  requirement: !ruby/object:Gem::Requirement
126
114
  requirements:
127
- - - "~>"
115
+ - - ">="
128
116
  - !ruby/object:Gem::Version
129
- version: '10.0'
117
+ version: '0'
130
118
  type: :development
131
119
  prerelease: false
132
120
  version_requirements: !ruby/object:Gem::Requirement
133
121
  requirements:
134
- - - "~>"
122
+ - - ">="
135
123
  - !ruby/object:Gem::Version
136
- version: '10.0'
124
+ version: '0'
137
125
  - !ruby/object:Gem::Dependency
138
126
  name: rspec
139
127
  requirement: !ruby/object:Gem::Requirement
140
128
  requirements:
141
- - - "~>"
129
+ - - ">="
142
130
  - !ruby/object:Gem::Version
143
- version: '3.0'
131
+ version: '0'
144
132
  type: :development
145
133
  prerelease: false
146
134
  version_requirements: !ruby/object:Gem::Requirement
147
135
  requirements:
148
- - - "~>"
136
+ - - ">="
149
137
  - !ruby/object:Gem::Version
150
- version: '3.0'
138
+ version: '0'
151
139
  - !ruby/object:Gem::Dependency
152
140
  name: rubocop
153
141
  requirement: !ruby/object:Gem::Requirement
154
142
  requirements:
155
- - - "~>"
143
+ - - ">="
156
144
  - !ruby/object:Gem::Version
157
- version: '0.49'
145
+ version: '0'
158
146
  type: :development
159
147
  prerelease: false
160
148
  version_requirements: !ruby/object:Gem::Requirement
161
149
  requirements:
162
- - - "~>"
150
+ - - ">="
163
151
  - !ruby/object:Gem::Version
164
- version: '0.49'
152
+ version: '0'
165
153
  - !ruby/object:Gem::Dependency
166
154
  name: rubocop-rspec
167
155
  requirement: !ruby/object:Gem::Requirement
168
156
  requirements:
169
- - - "~>"
157
+ - - ">="
170
158
  - !ruby/object:Gem::Version
171
- version: '1.7'
159
+ version: '0'
172
160
  type: :development
173
161
  prerelease: false
174
162
  version_requirements: !ruby/object:Gem::Requirement
175
163
  requirements:
176
- - - "~>"
164
+ - - ">="
177
165
  - !ruby/object:Gem::Version
178
- version: '1.7'
166
+ version: '0'
179
167
  description: Obfuscate link-like mail content on delivery to prevent auto hyperlinks
180
168
  in modern email clients.
181
169
  email:
@@ -188,6 +176,7 @@ files:
188
176
  - ".rspec"
189
177
  - ".rubocop.yml"
190
178
  - Gemfile
179
+ - Gemfile.lock
191
180
  - Guardfile
192
181
  - LICENSE.txt
193
182
  - README.md
@@ -218,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
207
  - !ruby/object:Gem::Version
219
208
  version: '0'
220
209
  requirements: []
221
- rubyforge_project:
222
- rubygems_version: 2.6.14
210
+ rubygems_version: 3.2.9
223
211
  signing_key:
224
212
  specification_version: 4
225
213
  summary: Obfuscate link-like mail content on delivery to prevent auto hyperlinks in