internet_security_event 1.0.1 → 1.0.2

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: 6028e31de34aca5377e011e84066b8ce6532cf406464edf4a8a67eb4e2230bec
4
- data.tar.gz: 61198576708f2460fb9a21c682676b038917b150be82bcf36f1cc7c4888c4a42
3
+ metadata.gz: c45d13b633f75d73835bc5df4366f4c7dc778637124b04dfcca841d170062bb8
4
+ data.tar.gz: 51012612ff7d23ae2019471663f7c16b50d04665f467efad9a13abd377662cbc
5
5
  SHA512:
6
- metadata.gz: c3949507e6194312a786461c1e335493d2f34f57d63546850164ae5305966743ca4a7637daf66fd4c9084351069f97f35a9f81e53dd1f6fe2d78b84c01b74409
7
- data.tar.gz: ecfb68fb113d7846cb0e3278a000a12531f327661e933d09644174f7758ff2efed7ac088ef166446ae3dfe28b8db3851f8588ed34dec1318725813fef5ffb991
6
+ metadata.gz: ba96b78855a50ce723f9f26c869d9b65a4f0261d79730139c16bac20c56ffd9bfd01921f3152cd94c10648d7ae262474cadda190f5c433e48913a00f9a6b62ab
7
+ data.tar.gz: c77cf433031d25d2c61089e098db1a097853432449060bd1600e66ef5d2a6c37a0a3065182ffb2dcb623222da708898dfe6ffb5b5ccc5a59301adbc1308a7446
@@ -37,18 +37,30 @@ module InternetSecurityEvent
37
37
  end
38
38
 
39
39
  def hostname_match_subject?
40
- common_name == hostname
40
+ name_match_patern(hostname, common_name)
41
41
  end
42
42
 
43
43
  def hostname_match_subject_alternative_name?
44
44
  return false unless certificate
45
45
 
46
46
  san = certificate.extensions.select { |ext| ext.oid == 'subjectAltName' }.first
47
- return san.value.split(', ').map { |name| name.sub(/\ADNS:/, '') }.include?(hostname) if san
47
+
48
+ if san
49
+ alt_names = san.value.split(', ').map { |name| name.sub(/\ADNS:/, '') }
50
+ return true if alt_names.any? { |alt_name| name_match_patern(hostname, alt_name) }
51
+ end
48
52
 
49
53
  false
50
54
  end
51
55
 
56
+ def name_match_patern(hostname, pattern)
57
+ re = Regexp.new('\A' + pattern.split('*').map do |st|
58
+ Regexp.escape(st)
59
+ end.join('[^.]*') + '\z')
60
+
61
+ re.match(hostname)
62
+ end
63
+
52
64
  def common_name
53
65
  certificate.subject.to_a.select { |data| data[0] == 'CN' }.map { |data| data[1] }.first if certificate
54
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InternetSecurityEvent
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internet_security_event
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-18 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview