icalendar 2.12.1 → 2.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/icalendar/values/uri.rb +2 -1
- data/lib/icalendar/version.rb +1 -1
- data/spec/values/uri_spec.rb +43 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad06e861392ab70f0e800ac4f2a6b81f019aaf3548a35e513f02bcc975968b86
|
|
4
|
+
data.tar.gz: 16562bdeae817fc8afd4e0b6de7090a42c0b095cb56640d5b9183cfb3a07bb74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 927cd1536b413039b75f4c2a100ca169bb17897c10754b4806762d341aaa4b7800fc93e7bc81566681a678a853fefc0d54fad5fdd0316c10f0245f91864d2faf
|
|
7
|
+
data.tar.gz: 5d9c09347062a5dd73ad23cd75905c5508b8a72ce0447241ee282fa6bbcc7d259e4a26309fc90af718f14f14b18ca78403bc849898b42147c5368ae6edb21d13
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
## Unreleased
|
|
2
2
|
|
|
3
|
+
## 2.12.2 - 2026-03-21
|
|
4
|
+
- Fix a potential property injection issue through escaping control characters in URI values - Wes Ring
|
|
5
|
+
|
|
3
6
|
## 2.12.1 - 2025-10-19
|
|
4
7
|
- Fix a problem with invalid ics generation for calendars with custom properties that include a `tzid` parameter.
|
|
5
8
|
|
data/lib/icalendar/values/uri.rb
CHANGED
|
@@ -6,6 +6,7 @@ module Icalendar
|
|
|
6
6
|
module Values
|
|
7
7
|
|
|
8
8
|
class Uri < Value
|
|
9
|
+
CONTROL_BYTES_REGEX = /[\x00-\x1F\x7F]/.freeze
|
|
9
10
|
|
|
10
11
|
def initialize(value, *args)
|
|
11
12
|
parsed = URI.parse(value) rescue value
|
|
@@ -13,7 +14,7 @@ module Icalendar
|
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def value_ical
|
|
16
|
-
value.to_s
|
|
17
|
+
value.to_s.gsub(CONTROL_BYTES_REGEX) { |char| "%%%02X" % char.ord }
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
data/lib/icalendar/version.rb
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Icalendar::Values::Uri do
|
|
4
|
+
describe '#value_ical' do
|
|
5
|
+
it 'percent-encodes CRLF to prevent content-line injection' do
|
|
6
|
+
value = described_class.new("https://a.example/ok\r\nATTENDEE:mailto:evil@example.com")
|
|
7
|
+
|
|
8
|
+
expect(value.value_ical).to eq('https://a.example/ok%0D%0AATTENDEE:mailto:evil@example.com')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'percent-encodes the full ASCII control range' do
|
|
12
|
+
raw = "https://example.com/a\tb\f#{0.chr}#{127.chr}"
|
|
13
|
+
value = described_class.new(raw)
|
|
14
|
+
|
|
15
|
+
expect(value.value_ical).to eq('https://example.com/a%09b%0C%00%7F')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'leaves valid printable URI characters unchanged' do
|
|
19
|
+
raw = 'https://example.com/a-path?q=one%20two&x=@tag#frag'
|
|
20
|
+
value = described_class.new(raw)
|
|
21
|
+
|
|
22
|
+
expect(value.value_ical).to eq(raw)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '#to_ical' do
|
|
27
|
+
it 'serializes injected CRLF on the same content line' do
|
|
28
|
+
value = described_class.new("https://a.example/ok\r\nATTENDEE:mailto:evil@example.com")
|
|
29
|
+
|
|
30
|
+
expect(value.to_ical(Icalendar::Values::Text)).to eq(
|
|
31
|
+
';VALUE=URI:https://a.example/ok%0D%0AATTENDEE:mailto:evil@example.com'
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe Icalendar::Values::CalAddress do
|
|
38
|
+
it 'inherits URI control-byte encoding' do
|
|
39
|
+
value = described_class.new("mailto:user@example.com\r\nORGANIZER:mailto:evil@example.com")
|
|
40
|
+
|
|
41
|
+
expect(value.value_ical).to eq('mailto:user@example.com%0D%0AORGANIZER:mailto:evil@example.com')
|
|
42
|
+
end
|
|
43
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: icalendar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.12.
|
|
4
|
+
version: 2.12.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Ahearn
|
|
@@ -292,6 +292,7 @@ files:
|
|
|
292
292
|
- spec/values/period_spec.rb
|
|
293
293
|
- spec/values/recur_spec.rb
|
|
294
294
|
- spec/values/text_spec.rb
|
|
295
|
+
- spec/values/uri_spec.rb
|
|
295
296
|
- spec/values/utc_offset_spec.rb
|
|
296
297
|
homepage: https://github.com/icalendar/icalendar
|
|
297
298
|
licenses:
|
|
@@ -361,4 +362,5 @@ test_files:
|
|
|
361
362
|
- spec/values/period_spec.rb
|
|
362
363
|
- spec/values/recur_spec.rb
|
|
363
364
|
- spec/values/text_spec.rb
|
|
365
|
+
- spec/values/uri_spec.rb
|
|
364
366
|
- spec/values/utc_offset_spec.rb
|