strip-tags 1.0.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +80 -31
- data/README.md +9 -9
- data/lib/strip-tags/matchers.rb +5 -1
- data/lib/strip-tags/version.rb +1 -1
- data/run-tests.sh +6 -0
- data/strip_tags.gemspec +0 -2
- metadata +3 -33
- data/gemfiles/activemodel-5.2.gemfile +0 -5
- data/gemfiles/activemodel-6.1.gemfile +0 -5
- data/gemfiles/activemodel-7.0.gemfile +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0028c1ad9d486eef4c972747922e9a484fc7ff2356b488c31175eee5f08774ce'
|
4
|
+
data.tar.gz: b2cb48f07cb9e2d12e0d21bb128038c3d22fb46ef40cf36762ff5dd92c8d4804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cc80ad2c09f2df5eb7e6fb45c2bc50dc2d7233ce6ec4aa37ccf17690f7d7f88a3bf6fec8b547e05c2ff9c771df7db1c2ccd3a52528fdcfa05b3855d71825729
|
7
|
+
data.tar.gz: 4a0d4e2b8f0bb28024c2aea463359c7b094fd89b6b6f5de434878dad8f566a06c64f2c96289af8f84a2bc52abea96630c18085d27ddea77145938b9601d04367
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,65 +1,100 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strip-tags (1.
|
4
|
+
strip-tags (1.1.1)
|
5
5
|
activemodel (>= 5.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (7.
|
11
|
-
actionview (= 7.
|
12
|
-
activesupport (= 7.
|
13
|
-
|
10
|
+
actionpack (7.1.2)
|
11
|
+
actionview (= 7.1.2)
|
12
|
+
activesupport (= 7.1.2)
|
13
|
+
nokogiri (>= 1.8.5)
|
14
|
+
racc
|
15
|
+
rack (>= 2.2.4)
|
16
|
+
rack-session (>= 1.0.1)
|
14
17
|
rack-test (>= 0.6.3)
|
15
|
-
rails-dom-testing (~> 2.
|
16
|
-
rails-html-sanitizer (~> 1.
|
17
|
-
actionview (7.
|
18
|
-
activesupport (= 7.
|
18
|
+
rails-dom-testing (~> 2.2)
|
19
|
+
rails-html-sanitizer (~> 1.6)
|
20
|
+
actionview (7.1.2)
|
21
|
+
activesupport (= 7.1.2)
|
19
22
|
builder (~> 3.1)
|
20
|
-
erubi (~> 1.
|
21
|
-
rails-dom-testing (~> 2.
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
active_attr (0.
|
24
|
-
actionpack (>= 3.0.2, < 7.
|
25
|
-
activemodel (>= 3.0.2, < 7.
|
26
|
-
activesupport (>= 3.0.2, < 7.
|
27
|
-
activemodel (7.
|
28
|
-
activesupport (= 7.
|
29
|
-
activesupport (7.
|
23
|
+
erubi (~> 1.11)
|
24
|
+
rails-dom-testing (~> 2.2)
|
25
|
+
rails-html-sanitizer (~> 1.6)
|
26
|
+
active_attr (0.16.0)
|
27
|
+
actionpack (>= 3.0.2, < 7.2)
|
28
|
+
activemodel (>= 3.0.2, < 7.2)
|
29
|
+
activesupport (>= 3.0.2, < 7.2)
|
30
|
+
activemodel (7.1.2)
|
31
|
+
activesupport (= 7.1.2)
|
32
|
+
activesupport (7.1.2)
|
33
|
+
base64
|
34
|
+
bigdecimal
|
30
35
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
36
|
+
connection_pool (>= 2.2.5)
|
37
|
+
drb
|
31
38
|
i18n (>= 1.6, < 2)
|
32
39
|
minitest (>= 5.1)
|
40
|
+
mutex_m
|
33
41
|
tzinfo (~> 2.0)
|
42
|
+
base64 (0.2.0)
|
43
|
+
bigdecimal (3.1.5)
|
34
44
|
builder (3.2.4)
|
35
45
|
concurrent-ruby (1.2.2)
|
46
|
+
connection_pool (2.4.1)
|
36
47
|
crass (1.0.6)
|
37
48
|
diff-lcs (1.5.0)
|
49
|
+
drb (2.2.0)
|
50
|
+
ruby2_keywords
|
38
51
|
erubi (1.12.0)
|
39
52
|
i18n (1.14.1)
|
40
53
|
concurrent-ruby (~> 1.0)
|
41
|
-
|
54
|
+
io-console (0.7.1)
|
55
|
+
irb (1.11.1)
|
56
|
+
rdoc
|
57
|
+
reline (>= 0.4.2)
|
58
|
+
loofah (2.22.0)
|
42
59
|
crass (~> 1.0.2)
|
43
60
|
nokogiri (>= 1.12.0)
|
44
|
-
minitest (5.
|
45
|
-
|
61
|
+
minitest (5.21.1)
|
62
|
+
mutex_m (0.2.0)
|
63
|
+
nokogiri (1.16.0-arm64-darwin)
|
46
64
|
racc (~> 1.4)
|
47
|
-
|
48
|
-
|
65
|
+
nokogiri (1.16.0-x86_64-linux)
|
66
|
+
racc (~> 1.4)
|
67
|
+
psych (5.1.2)
|
68
|
+
stringio
|
69
|
+
racc (1.7.3)
|
70
|
+
rack (2.2.8)
|
71
|
+
rack-session (1.0.2)
|
72
|
+
rack (< 3)
|
49
73
|
rack-test (2.1.0)
|
50
74
|
rack (>= 1.3)
|
51
|
-
|
75
|
+
rackup (1.0.0)
|
76
|
+
rack (< 3)
|
77
|
+
webrick
|
78
|
+
rails-dom-testing (2.2.0)
|
52
79
|
activesupport (>= 5.0.0)
|
53
80
|
minitest
|
54
81
|
nokogiri (>= 1.6)
|
55
82
|
rails-html-sanitizer (1.6.0)
|
56
83
|
loofah (~> 2.21)
|
57
84
|
nokogiri (~> 1.14)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
85
|
+
railties (7.1.2)
|
86
|
+
actionpack (= 7.1.2)
|
87
|
+
activesupport (= 7.1.2)
|
88
|
+
irb
|
89
|
+
rackup (>= 1.0.0)
|
90
|
+
rake (>= 12.2)
|
91
|
+
thor (~> 1.0, >= 1.2.2)
|
92
|
+
zeitwerk (~> 2.6)
|
93
|
+
rake (13.1.0)
|
94
|
+
rdoc (6.6.2)
|
95
|
+
psych (>= 4.0.0)
|
96
|
+
reline (0.4.2)
|
97
|
+
io-console (~> 0.5)
|
63
98
|
rspec-core (3.12.2)
|
64
99
|
rspec-support (~> 3.12.0)
|
65
100
|
rspec-expectations (3.12.3)
|
@@ -68,17 +103,31 @@ GEM
|
|
68
103
|
rspec-mocks (3.12.6)
|
69
104
|
diff-lcs (>= 1.2.0, < 2.0)
|
70
105
|
rspec-support (~> 3.12.0)
|
106
|
+
rspec-rails (6.1.0)
|
107
|
+
actionpack (>= 6.1)
|
108
|
+
activesupport (>= 6.1)
|
109
|
+
railties (>= 6.1)
|
110
|
+
rspec-core (~> 3.12)
|
111
|
+
rspec-expectations (~> 3.12)
|
112
|
+
rspec-mocks (~> 3.12)
|
113
|
+
rspec-support (~> 3.12)
|
71
114
|
rspec-support (3.12.1)
|
115
|
+
ruby2_keywords (0.0.5)
|
116
|
+
stringio (3.1.0)
|
117
|
+
thor (1.3.0)
|
72
118
|
tzinfo (2.0.6)
|
73
119
|
concurrent-ruby (~> 1.0)
|
120
|
+
webrick (1.8.1)
|
121
|
+
zeitwerk (2.6.12)
|
74
122
|
|
75
123
|
PLATFORMS
|
76
124
|
arm64-darwin-22
|
125
|
+
x86_64-linux
|
77
126
|
|
78
127
|
DEPENDENCIES
|
79
128
|
active_attr (~> 0.15)
|
80
129
|
rake
|
81
|
-
rspec
|
130
|
+
rspec-rails
|
82
131
|
strip-tags!
|
83
132
|
|
84
133
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ gem "strip-tags"
|
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
class DrunkPokerPlayer < ActiveRecord::Base
|
34
|
-
|
34
|
+
strip_tags
|
35
35
|
end
|
36
36
|
```
|
37
37
|
|
@@ -40,7 +40,7 @@ end
|
|
40
40
|
```ruby
|
41
41
|
# all attributes will be stripped except :boxers
|
42
42
|
class SoberPokerPlayer < ActiveRecord::Base
|
43
|
-
|
43
|
+
strip_tags except: :boxers
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
@@ -49,7 +49,7 @@ end
|
|
49
49
|
```ruby
|
50
50
|
# only :shoe, :sock, and :glove attributes will be stripped
|
51
51
|
class ConservativePokerPlayer < ActiveRecord::Base
|
52
|
-
|
52
|
+
strip_tags only: [:shoe, :sock, :glove]
|
53
53
|
end
|
54
54
|
```
|
55
55
|
|
@@ -58,7 +58,7 @@ end
|
|
58
58
|
```ruby
|
59
59
|
# Only records with odd ids will be stripped
|
60
60
|
class OddPokerPlayer < ActiveRecord::Base
|
61
|
-
|
61
|
+
strip_tags if: :strip_me?
|
62
62
|
|
63
63
|
def strip_me?
|
64
64
|
id.odd?
|
@@ -69,9 +69,9 @@ end
|
|
69
69
|
### Using `unless`
|
70
70
|
|
71
71
|
```ruby
|
72
|
-
#
|
72
|
+
# strip_tags will be applied randomly
|
73
73
|
class RandomPokerPlayer < ActiveRecord::Base
|
74
|
-
|
74
|
+
strip_tags unless: :strip_me?
|
75
75
|
|
76
76
|
def strip_me?
|
77
77
|
[true, false].sample
|
@@ -84,7 +84,7 @@ end
|
|
84
84
|
```ruby
|
85
85
|
# Empty attributes will not be converted to nil
|
86
86
|
class BrokePokerPlayer < ActiveRecord::Base
|
87
|
-
|
87
|
+
strip_tags allow_empty: true
|
88
88
|
end
|
89
89
|
```
|
90
90
|
|
@@ -98,7 +98,7 @@ It also works on other ActiveModel classes, such as [Mongoid](http://mongoid.org
|
|
98
98
|
class User
|
99
99
|
include Mongoid::Document
|
100
100
|
|
101
|
-
|
101
|
+
strip_tags only: :email
|
102
102
|
end
|
103
103
|
```
|
104
104
|
|
@@ -112,7 +112,7 @@ class Person
|
|
112
112
|
attribute :name
|
113
113
|
attribute :email
|
114
114
|
|
115
|
-
|
115
|
+
strip_tags
|
116
116
|
end
|
117
117
|
|
118
118
|
```
|
data/lib/strip-tags/matchers.rb
CHANGED
@@ -30,7 +30,11 @@ module StripTags
|
|
30
30
|
@attribute = attribute
|
31
31
|
subject.send("#{@attribute}=", "foo> & <<script>alert('xss')</script>")
|
32
32
|
subject.valid?
|
33
|
-
|
33
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new("7.1")
|
34
|
+
subject.send(@attribute) == "foo> & <alert('xss')"
|
35
|
+
else
|
36
|
+
subject.send(@attribute) == "foo> & <"
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
data/lib/strip-tags/version.rb
CHANGED
data/run-tests.sh
ADDED
data/strip_tags.gemspec
CHANGED
@@ -28,7 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_runtime_dependency "activemodel", ">= 5.2"
|
31
|
-
spec.add_development_dependency "active_attr", "~> 0.15"
|
32
|
-
spec.add_development_dependency "rspec", ">= 3.12.0"
|
33
31
|
spec.add_development_dependency "rake"
|
34
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strip-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Moen Wulffeld
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -24,34 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: active_attr
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.15'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.15'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 3.12.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 3.12.0
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: rake
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,12 +53,10 @@ files:
|
|
81
53
|
- LICENSE
|
82
54
|
- README.md
|
83
55
|
- Rakefile
|
84
|
-
- gemfiles/activemodel-5.2.gemfile
|
85
|
-
- gemfiles/activemodel-6.1.gemfile
|
86
|
-
- gemfiles/activemodel-7.0.gemfile
|
87
56
|
- lib/strip-tags.rb
|
88
57
|
- lib/strip-tags/matchers.rb
|
89
58
|
- lib/strip-tags/version.rb
|
59
|
+
- run-tests.sh
|
90
60
|
- strip_tags.gemspec
|
91
61
|
homepage: https://github.com/wulffeld/strip-tags
|
92
62
|
licenses:
|