re2 2.5.0-x86-linux → 2.6.0-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -5
- data/Rakefile +1 -1
- data/ext/re2/re2.cc +4 -4
- data/lib/2.6/re2.so +0 -0
- data/lib/2.7/re2.so +0 -0
- data/lib/3.0/re2.so +0 -0
- data/lib/3.1/re2.so +0 -0
- data/lib/3.2/re2.so +0 -0
- data/lib/3.3/re2.so +0 -0
- data/lib/re2/regexp.rb +1 -0
- data/lib/re2/scanner.rb +1 -0
- data/lib/re2/string.rb +1 -0
- data/lib/re2/version.rb +2 -1
- data/re2.gemspec +2 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d221dce2a4803ccffbede68f63fa66d6d58d9619f0ea164c06a86af7db1e4b
|
4
|
+
data.tar.gz: bc960e9de6bcf5ef7659dfd961082bbf7a54fb227929b4e3e861804f2a657dee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e64b999321f4b2593abbefe190de85c799cb321cf65605b61b1171ad1d4577d4311ad61699d1828824be0f7cd1f64a9cb2a88012836d8a325dd34b15bad80ff
|
7
|
+
data.tar.gz: 53814c52baf7a6e28ed94551352b16e894518a518dce72a918fba3543e3df81d182f6a16740ac43380d312213af22ad14e8e3baa40f6e79c1a50ae44d9a90e3a
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
# re2
|
1
|
+
# re2 - safer regular expressions in Ruby
|
2
2
|
|
3
3
|
Ruby bindings to [RE2][], a "fast, safe, thread-friendly alternative to
|
4
4
|
backtracking regular expression engines like those used in PCRE, Perl, and
|
5
5
|
Python".
|
6
6
|
|
7
|
-
|
7
|
+
[![Build Status](https://github.com/mudge/re2/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mudge/re2/actions)
|
8
|
+
|
9
|
+
**Current version:** 2.6.0
|
8
10
|
**Bundled RE2 version:** libre2.11 (2023-11-01)
|
9
11
|
|
10
12
|
```ruby
|
@@ -28,6 +30,7 @@ RE2('(\w+):(\d+)').full_match("ruby:1234")
|
|
28
30
|
* [Encoding](#encoding)
|
29
31
|
* [Requirements](#requirements)
|
30
32
|
* [Native gems](#native-gems)
|
33
|
+
* [Verifying the gems](#verifying-the-gems)
|
31
34
|
* [Installing the `ruby` platform gem](#installing-the-ruby-platform-gem)
|
32
35
|
* [Using system libraries](#using-system-libraries)
|
33
36
|
* [Thanks](#thanks)
|
@@ -37,6 +40,17 @@ RE2('(\w+):(\d+)').full_match("ruby:1234")
|
|
37
40
|
|
38
41
|
## Why RE2?
|
39
42
|
|
43
|
+
While [recent
|
44
|
+
versions](https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/) of
|
45
|
+
Ruby have improved defences against [regular expression denial of service
|
46
|
+
(ReDoS) attacks](https://en.wikipedia.org/wiki/ReDoS), it is still possible for
|
47
|
+
users to craft malicious patterns that take a long time to process by using
|
48
|
+
syntactic features such as [back-references, lookaheads and possessive
|
49
|
+
quantifiers](https://bugs.ruby-lang.org/issues/19104#note-3). RE2 aims to
|
50
|
+
eliminate ReDoS by design:
|
51
|
+
|
52
|
+
> **_Safety is RE2's raison d'être._**
|
53
|
+
>
|
40
54
|
> RE2 was designed and implemented with an explicit goal of being able to
|
41
55
|
> handle regular expressions from untrusted users without risk. One of its
|
42
56
|
> primary guarantees is that the match time is linear in the length of the
|
@@ -110,7 +124,7 @@ See the API documentation for [`RE2::Regexp#initialize`](https://mudge.name/re2/
|
|
110
124
|
|
111
125
|
### Matching interface
|
112
126
|
|
113
|
-
There are two main methods for matching: [`RE2::Regexp#full_match?`](https://mudge.name/re2/RE2/Regexp.html#full_match%3F-instance_method) requires the regular expression to match the entire input text, and [`RE2::Regexp#partial_match?`](https://mudge.name/re2/RE2/Regexp.html#
|
127
|
+
There are two main methods for matching: [`RE2::Regexp#full_match?`](https://mudge.name/re2/RE2/Regexp.html#full_match%3F-instance_method) requires the regular expression to match the entire input text, and [`RE2::Regexp#partial_match?`](https://mudge.name/re2/RE2/Regexp.html#partial_match%3F-instance_method) looks for a match for a substring of the input text, returning a boolean to indicate whether a match was successful or not.
|
114
128
|
|
115
129
|
```ruby
|
116
130
|
RE2('h.*o').full_match?("hello") #=> true
|
@@ -253,11 +267,40 @@ It supports the following RE2 ABI versions:
|
|
253
267
|
|
254
268
|
Where possible, a pre-compiled native gem will be provided for the following platforms:
|
255
269
|
|
256
|
-
* Linux
|
257
|
-
*
|
270
|
+
* Linux
|
271
|
+
* `aarch64-linux` and `arm-linux` (requires [glibc](https://www.gnu.org/software/libc/) 2.29+)
|
272
|
+
* `x86-linux` and `x86_64-linux` (requires [glibc](https://www.gnu.org/software/libc/) 2.17+)
|
273
|
+
* [musl](https://musl.libc.org/)-based systems such as [Alpine](https://alpinelinux.org) are supported as long as a [glibc-compatible library is installed](https://wiki.alpinelinux.org/wiki/Running_glibc_programs)
|
258
274
|
* macOS `x86_64-darwin` and `arm64-darwin`
|
259
275
|
* Windows `x64-mingw32` and `x64-mingw-ucrt`
|
260
276
|
|
277
|
+
### Verifying the gems
|
278
|
+
|
279
|
+
SHA256 checksums are included in the [release notes](https://github.com/mudge/re2/releases) for each version and can be checked with `sha256sum`, e.g.
|
280
|
+
|
281
|
+
```console
|
282
|
+
$ gem fetch re2 -v 2.5.0
|
283
|
+
Fetching re2-2.5.0-arm64-darwin.gem
|
284
|
+
Downloaded re2-2.5.0-arm64-darwin
|
285
|
+
$ sha256sum re2-2.5.0-arm64-darwin.gem
|
286
|
+
4b20c4539a12787102b22012e678968af23f87e35f88843744835bd13ac9f6bc re2-2.5.0-arm64-darwin.gem
|
287
|
+
```
|
288
|
+
|
289
|
+
[GPG](https://www.gnupg.org/) signatures are attached to each release (the assets ending in `.sig`) and can be verified if you import [our signing key `0x39AC3530070E0F75`](https://mudge.name/39AC3530070E0F75.asc) (or fetch it from a public keyserver, e.g. `gpg --keyserver keyserver.ubuntu.com --recv-key 0x39AC3530070E0F75`):
|
290
|
+
|
291
|
+
```console
|
292
|
+
$ gpg --verify re2-2.5.0-arm64-darwin.gem.sig re2-2.5.0-arm64-darwin.gem
|
293
|
+
gpg: Signature made Fri 15 Dec 2023 12:58:58 GMT
|
294
|
+
gpg: using RSA key 702609D9C790F45B577D7BEC39AC3530070E0F75
|
295
|
+
gpg: Good signature from "Paul Mucur <mudge@mudge.name>" [unknown]
|
296
|
+
gpg: aka "Paul Mucur <paul@ghostcassette.com>" [unknown]
|
297
|
+
gpg: WARNING: This key is not certified with a trusted signature!
|
298
|
+
gpg: There is no indication that the signature belongs to the owner.
|
299
|
+
Primary key fingerprint: 7026 09D9 C790 F45B 577D 7BEC 39AC 3530 070E 0F75
|
300
|
+
```
|
301
|
+
|
302
|
+
The fingerprint should be as shown above or you can independently verify it with the ones shown in the footer of https://mudge.name.
|
303
|
+
|
261
304
|
### Installing the `ruby` platform gem
|
262
305
|
|
263
306
|
> [!WARNING]
|
data/Rakefile
CHANGED
@@ -33,7 +33,7 @@ Gem::PackageTask.new(RE2_GEM_SPEC) do |p|
|
|
33
33
|
p.need_tar = false
|
34
34
|
end
|
35
35
|
|
36
|
-
CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':')
|
36
|
+
CROSS_RUBY_VERSIONS = %w[3.3.0 3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':')
|
37
37
|
CROSS_RUBY_PLATFORMS = %w[
|
38
38
|
aarch64-linux
|
39
39
|
arm-linux
|
data/ext/re2/re2.cc
CHANGED
@@ -1588,7 +1588,7 @@ static VALUE re2_regexp_full_match_p(const VALUE self, VALUE text) {
|
|
1588
1588
|
*
|
1589
1589
|
* @param [text] text the text to scan incrementally
|
1590
1590
|
* @return [RE2::Scanner] an `Enumerable` {RE2::Scanner} object
|
1591
|
-
* @
|
1591
|
+
* @raise [TypeError] if `text` cannot be coerced to a `String`
|
1592
1592
|
* @example
|
1593
1593
|
* c = RE2::Regexp.new('(\w+)').scan("Foo bar baz")
|
1594
1594
|
* #=> #<RE2::Scanner:0x0000000000000001>
|
@@ -1652,7 +1652,7 @@ static VALUE re2_regexp_match_has_endpos_argument_p(VALUE) {
|
|
1652
1652
|
* @param [String, RE2::Regexp] pattern a regexp matching text to be replaced
|
1653
1653
|
* @param [String] rewrite the string to replace with
|
1654
1654
|
* @return [String] the resulting string
|
1655
|
-
* @
|
1655
|
+
* @raise [TypeError] if the given rewrite or pattern (if not provided as a
|
1656
1656
|
* {RE2::Regexp}) cannot be coerced to `String`s
|
1657
1657
|
* @example
|
1658
1658
|
* RE2.Replace("hello there", "hello", "howdy") #=> "howdy there"
|
@@ -1700,7 +1700,7 @@ static VALUE re2_Replace(VALUE, VALUE str, VALUE pattern,
|
|
1700
1700
|
* @param [String] str the string to modify
|
1701
1701
|
* @param [String, RE2::Regexp] pattern a regexp matching text to be replaced
|
1702
1702
|
* @param [String] rewrite the string to replace with
|
1703
|
-
* @
|
1703
|
+
* @raise [TypeError] if the given rewrite or pattern (if not provided as a
|
1704
1704
|
* {RE2::Regexp}) cannot be coerced to `String`s
|
1705
1705
|
* @return [String] the resulting string
|
1706
1706
|
* @example
|
@@ -1745,7 +1745,7 @@ static VALUE re2_GlobalReplace(VALUE, VALUE str, VALUE pattern,
|
|
1745
1745
|
* exactly match the original string.
|
1746
1746
|
*
|
1747
1747
|
* @param [String] unquoted the unquoted string
|
1748
|
-
* @
|
1748
|
+
* @raise [TypeError] if the given unquoted string cannot be coerced to a `String`
|
1749
1749
|
* @return [String] the escaped string
|
1750
1750
|
* @example
|
1751
1751
|
* RE2::Regexp.escape("1.5-2.0?") #=> "1\.5\-2\.0\?"
|
data/lib/2.6/re2.so
CHANGED
Binary file
|
data/lib/2.7/re2.so
CHANGED
Binary file
|
data/lib/3.0/re2.so
CHANGED
Binary file
|
data/lib/3.1/re2.so
CHANGED
Binary file
|
data/lib/3.2/re2.so
CHANGED
Binary file
|
data/lib/3.3/re2.so
ADDED
Binary file
|
data/lib/re2/regexp.rb
CHANGED
data/lib/re2/scanner.rb
CHANGED
data/lib/re2/string.rb
CHANGED
data/lib/re2/version.rb
CHANGED
data/re2.gemspec
CHANGED
@@ -38,8 +38,8 @@ Gem::Specification.new do |s|
|
|
38
38
|
"spec/re2/set_spec.rb",
|
39
39
|
"spec/re2/scanner_spec.rb"
|
40
40
|
]
|
41
|
-
s.add_development_dependency("rake-compiler", "~> 1.2.
|
42
|
-
s.add_development_dependency("rake-compiler-dock", "~> 1.
|
41
|
+
s.add_development_dependency("rake-compiler", "~> 1.2.5")
|
42
|
+
s.add_development_dependency("rake-compiler-dock", "~> 1.4.0")
|
43
43
|
s.add_development_dependency("rspec", "~> 3.2")
|
44
44
|
s.add_runtime_dependency("mini_portile2", "~> 2.8.5") # keep version in sync with extconf.rb
|
45
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: re2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-12-
|
12
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.2.
|
20
|
+
version: 1.2.5
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.2.
|
27
|
+
version: 1.2.5
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake-compiler-dock
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.4.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: 1.4.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/3.0/re2.so
|
76
76
|
- lib/3.1/re2.so
|
77
77
|
- lib/3.2/re2.so
|
78
|
+
- lib/3.3/re2.so
|
78
79
|
- lib/re2.rb
|
79
80
|
- lib/re2/regexp.rb
|
80
81
|
- lib/re2/scanner.rb
|
@@ -104,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
105
|
version: '2.6'
|
105
106
|
- - "<"
|
106
107
|
- !ruby/object:Gem::Version
|
107
|
-
version: 3.
|
108
|
+
version: 3.4.dev
|
108
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
111
|
- - ">="
|