passweird 0.1.1 → 0.1.3
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/Gemfile +1 -1
- data/Gemfile.lock +27 -13
- data/lib/passweird/checker.rb +15 -3
- data/lib/passweird/version.rb +1 -1
- data/passweird.gemspec +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19a3653441105d1e3b9a361e8164673754157f373c06d140e3c309045044412d
|
4
|
+
data.tar.gz: '0594f7b975f7946301c6fddc90e056ce44110e91f126c7a6757676903ffe9c6b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff7560b5ba0c011db5c5a92d2e700542e43c17fe0f8f2865b407057288454d4b35a152f4b7966409ce7deb95bb91bd55f2db7fb24b6d64a587ef18df42d29180
|
7
|
+
data.tar.gz: 2693ae2624679e4381a2f93e0f310cf756882658ae5aa415b205231e7c477b5d97c172023a31b6f6604d0d0cddf085256123acfc3a6e1b55a8240c025dd3151d
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
passweird (0.1.
|
5
|
-
activerecord (
|
4
|
+
passweird (0.1.3)
|
5
|
+
activerecord (>= 7.0, < 8.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
|
16
|
-
|
10
|
+
activemodel (7.2.2.1)
|
11
|
+
activesupport (= 7.2.2.1)
|
12
|
+
activerecord (7.2.2.1)
|
13
|
+
activemodel (= 7.2.2.1)
|
14
|
+
activesupport (= 7.2.2.1)
|
15
|
+
timeout (>= 0.4.0)
|
16
|
+
activesupport (7.2.2.1)
|
17
|
+
base64
|
18
|
+
benchmark (>= 0.3)
|
19
|
+
bigdecimal
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
21
|
+
connection_pool (>= 2.2.5)
|
22
|
+
drb
|
17
23
|
i18n (>= 1.6, < 2)
|
24
|
+
logger (>= 1.4.2)
|
18
25
|
minitest (>= 5.1)
|
19
|
-
|
20
|
-
|
26
|
+
securerandom (>= 0.3)
|
27
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
21
28
|
ast (2.4.2)
|
29
|
+
base64 (0.2.0)
|
30
|
+
benchmark (0.4.0)
|
31
|
+
bigdecimal (3.1.9)
|
22
32
|
concurrent-ruby (1.3.5)
|
33
|
+
connection_pool (2.5.0)
|
23
34
|
database_cleaner (2.1.0)
|
24
35
|
database_cleaner-active_record (>= 2, < 3)
|
25
36
|
database_cleaner-active_record (2.2.0)
|
@@ -27,10 +38,12 @@ GEM
|
|
27
38
|
database_cleaner-core (~> 2.0.0)
|
28
39
|
database_cleaner-core (2.0.1)
|
29
40
|
diff-lcs (1.5.1)
|
41
|
+
drb (2.2.1)
|
30
42
|
i18n (1.14.7)
|
31
43
|
concurrent-ruby (~> 1.0)
|
32
44
|
json (2.9.1)
|
33
45
|
language_server-protocol (3.17.0.3)
|
46
|
+
logger (1.6.5)
|
34
47
|
minitest (5.25.4)
|
35
48
|
parallel (1.26.3)
|
36
49
|
parser (3.3.7.0)
|
@@ -66,21 +79,22 @@ GEM
|
|
66
79
|
rubocop-ast (1.37.0)
|
67
80
|
parser (>= 3.3.1.0)
|
68
81
|
ruby-progressbar (1.13.0)
|
82
|
+
securerandom (0.4.1)
|
69
83
|
sqlite3 (1.7.3-arm64-darwin)
|
70
84
|
sqlite3 (1.7.3-x86_64-linux)
|
85
|
+
timeout (0.4.3)
|
71
86
|
tzinfo (2.0.6)
|
72
87
|
concurrent-ruby (~> 1.0)
|
73
88
|
unicode-display_width (3.1.4)
|
74
89
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
75
90
|
unicode-emoji (4.0.4)
|
76
|
-
zeitwerk (2.6.18)
|
77
91
|
|
78
92
|
PLATFORMS
|
79
93
|
arm64-darwin-24
|
80
94
|
x86_64-linux
|
81
95
|
|
82
96
|
DEPENDENCIES
|
83
|
-
activerecord (
|
97
|
+
activerecord (>= 7.0, < 8.0)
|
84
98
|
database_cleaner (~> 2.1)
|
85
99
|
passweird!
|
86
100
|
rake (~> 13.0)
|
data/lib/passweird/checker.rb
CHANGED
@@ -24,25 +24,29 @@ module Passweird
|
|
24
24
|
#
|
25
25
|
# @return [Boolean] true if the password is blacklisted, false otherwise
|
26
26
|
def blacklisted?
|
27
|
-
@blacklisted ||= BlacklistedTerm.where(
|
27
|
+
@blacklisted ||= BlacklistedTerm.where(term: possible_terms).exists?
|
28
28
|
end
|
29
29
|
|
30
30
|
# Retrieves the blacklisted terms that match the possible terms
|
31
31
|
#
|
32
32
|
# @return [ActiveRecord::Relation] a collection of blacklisted terms
|
33
33
|
def blacklisted_terms
|
34
|
-
@blacklisted_terms ||= BlacklistedTerm.where(
|
34
|
+
@blacklisted_terms ||= BlacklistedTerm.where(term: possible_terms)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Generates all possible terms from substrings and leet speak equivalents
|
38
38
|
#
|
39
39
|
# @return [Array<String>] an array of unique possible terms
|
40
40
|
def possible_terms
|
41
|
-
@possible_terms ||=
|
41
|
+
@possible_terms ||= all_substring_case_permutations.uniq
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
+
def all_substring_case_permutations
|
47
|
+
@all_substring_case_permutations ||= substrings + unleeted_substrings + downcased_substrings + upcased_substrings
|
48
|
+
end
|
49
|
+
|
46
50
|
def unleeted_substrings
|
47
51
|
@unleeted_substrings ||= LeetSpeak.unleet_all(substrings)
|
48
52
|
end
|
@@ -50,5 +54,13 @@ module Passweird
|
|
50
54
|
def substrings
|
51
55
|
@substrings ||= Substringer.substrings(password)
|
52
56
|
end
|
57
|
+
|
58
|
+
def downcased_substrings
|
59
|
+
@downcased_substrings ||= substrings.map(&:downcase)
|
60
|
+
end
|
61
|
+
|
62
|
+
def upcased_substrings
|
63
|
+
@upcased_substrings ||= substrings.map(&:upcase)
|
64
|
+
end
|
53
65
|
end
|
54
66
|
end
|
data/lib/passweird/version.rb
CHANGED
data/passweird.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_dependency "activerecord", "
|
31
|
+
spec.add_dependency "activerecord", ">= 7.0", "< 8.0"
|
32
32
|
|
33
33
|
# For more information and examples about making a new gem, check out our
|
34
34
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passweird
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rupert Señga
|
@@ -14,16 +14,22 @@ dependencies:
|
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '7.0'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '8.0'
|
27
33
|
description:
|
28
34
|
email:
|
29
35
|
- pertsenga@gmail.com
|