password_blacklist 0.1.0.pre → 0.1.0

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
  SHA1:
3
- metadata.gz: 8d74390348d89b51e90729e34cf15e6fd3a2abfb
4
- data.tar.gz: ccc14c0242edfd5e606d847b5c7cff9cd6949345
3
+ metadata.gz: 7cbc24007a130de4700e9a13e8b87142830ac604
4
+ data.tar.gz: b5d7a449fa973a9d7abbf4f72b55df37f2bc8196
5
5
  SHA512:
6
- metadata.gz: cad900b9af3114d1470533bb64eb4f852d9760a508d4fc86998c3d49d4b4bbca40425b531dde5fffa13938db24f1de9147bf2b68bb2fe41d36eb5dcdc40b4a3e
7
- data.tar.gz: 93368324f2b37db450d741c4fadd1cbb4e3bfafd6dca60c34900102a6694d4cab75d1b51e49d596d42ea9adf543d87d809e9f2948ac97f4147b38dde97e9a4f1
6
+ metadata.gz: '0499da091e425f0cfd8bebf651b2b780146420575cd9030a9cddd22f48b95e13af402447dd2b087600c67b2160b3e67666c4265326233e2d860551c611c37473'
7
+ data.tar.gz: 379f316e74f556756689f7c58562ae901789e9c3400c129ff01106455ccb5fcc00809cf516d647ca07c97e364a20aa14859a83fbd31a4ca6baa448efb52c9661
data/CHANGELOG.md CHANGED
@@ -1,7 +1,10 @@
1
- Unreleased
1
+ 0.1.0 / 2017-02-01
2
2
  ------
3
- No changes
3
+ Rename `test` methods to `blacklisted?`.
4
+ Rename `PasswordBlacklist::Tester` to `PasswordBlacklist::Checker`.
5
+ Update README.
6
+ Minor changes to resolve Rubcop violations.
4
7
 
5
- 0.1.0 / 2017-01-20
8
+ 0.1.0.pre / 2017-01-20
6
9
  ------
7
10
  First release
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Check the presence of a string in a blacklist of the top 100,000 commonly used passwords (sourced from Mark Burnett's [ten million password release](https://xato.net/today-i-am-releasing-ten-million-passwords-b6278bbe7495)).
7
7
 
8
- This very simple Ruby library that can be integrated into your registration/authentication system to prevent users from setting commonly used (and easy to guess) passwords.
8
+ This very simple Ruby library can be integrated into your registration/authentication system to prevent users from setting commonly used (and easy to guess) passwords.
9
9
 
10
10
  This gem has an insignificant memory footprint with an execution cost of approximately 1 ms. A memory persistence option is available to further reduce execution time.
11
11
 
@@ -31,33 +31,33 @@ Or install it yourself:
31
31
  $ irb
32
32
  require 'password_blacklist'
33
33
 
34
- PasswordBlacklist.test("pokemon")
34
+ PasswordBlacklist.blacklisted?("pokemon")
35
35
  => true
36
36
 
37
- PasswordBlacklist.test("AccurateUnicornCoalPaperclip")
37
+ PasswordBlacklist.blacklisted?("AccurateUnicornCoalPaperclip")
38
38
  => false
39
39
  ```
40
40
 
41
41
  ### Test multiple passwords
42
42
 
43
- The blacklist file is loaded on every call to `PasswordBlacklist.test`. Use `PasswordBlacklist::Tester` to persist the blacklist in memory (approximately 0.8MB) if you would like to perform lots of password tests in quick succession.
43
+ The blacklist file is loaded on every call to `PasswordBlacklist.blacklisted?`. Use `PasswordBlacklist::Checker` to persist the blacklist in memory (approximately 0.8MB) if you would like to perform lots of password tests in quick succession.
44
44
 
45
45
  ```ruby
46
46
  require 'password_blacklist'
47
47
 
48
- tester = PasswordBlacklist::Tester.new
49
- => #<PasswordBlacklist::Tester:0x3ff979c41758>
48
+ checker = PasswordBlacklist::Checker.new
49
+ => #<PasswordBlacklist::Checker:0x3ff979c41758>
50
50
 
51
- tester.test("pokemon")
51
+ checker.blacklisted?("pokemon")
52
52
  => true
53
53
 
54
- tester.test("AccurateUnicornCoalPaperclip")
54
+ checker.blacklisted?("AccurateUnicornCoalPaperclip")
55
55
  => false
56
56
  ```
57
57
 
58
58
  ## Supported Ruby versions
59
59
 
60
- password_blacklist supports MRI Ruby 1.9+ and the JRuby equivalent. The specific Ruby versions we build and test on can be found at [TravisCI](https://travis-ci.org/gchan/password_blacklist).
60
+ password_blacklist supports MRI Ruby 2.x. The specific Ruby versions we build and test on can be found at [TravisCI](https://travis-ci.org/gchan/password_blacklist).
61
61
 
62
62
  ## Development
63
63
 
@@ -0,0 +1,17 @@
1
+ module PasswordBlacklist
2
+ class Checker
3
+ def initialize
4
+ file_path = File.expand_path('../../../data/100k_passwords.txt', __FILE__)
5
+
6
+ @data = File.read(file_path)
7
+ end
8
+
9
+ def blacklisted?(password)
10
+ !@data.match(/#{password}/).nil?
11
+ end
12
+
13
+ def inspect
14
+ "#<#{self.class}:0x#{__id__.to_s(16)}>"
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module PasswordBlacklist
2
- VERSION = "0.1.0.pre"
2
+ VERSION = '0.1.0'.freeze
3
3
  end
@@ -1,10 +1,10 @@
1
- require "password_blacklist/version"
2
- require "password_blacklist/tester"
1
+ require 'password_blacklist/version'
2
+ require 'password_blacklist/checker'
3
3
 
4
4
  module PasswordBlacklist
5
- extend self
5
+ module_function
6
6
 
7
- def test(password)
8
- Tester.new.test(password)
7
+ def blacklisted?(password)
8
+ Checker.new.blacklisted?(password)
9
9
  end
10
10
  end
@@ -4,27 +4,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'password_blacklist/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "password_blacklist"
7
+ spec.name = 'password_blacklist'
8
8
  spec.version = PasswordBlacklist::VERSION
9
- spec.authors = ["Gordon Chan"]
10
- spec.email = ["developer.gordon+github@gmail.com"]
9
+ spec.authors = ['Gordon Chan']
10
+ spec.email = ['developer.gordon+github@gmail.com']
11
11
 
12
12
  spec.summary = 'Checks a password against a 100k blacklist.'
13
13
  spec.description = 'A simple Ruby library to check if a given string is
14
14
  present in a blacklist of 100,000 common passwords'
15
- spec.homepage = "https://www.github.com/gchan/password_blacklist"
16
- spec.license = "MIT"
15
+ spec.homepage = 'https://www.github.com/gchan/password_blacklist'
16
+ spec.license = 'MIT'
17
17
 
18
- spec.files = Dir['lib/**/*.rb'] + Dir['data/*']
19
- spec.files += %w(CHANGELOG.md LICENSE.txt README.md password_blacklist.gemspec)
20
- spec.bindir = "bin"
21
- spec.require_paths = ["lib"]
18
+ spec.files = Dir['lib/**/*.rb'] + Dir['data/*'] +
19
+ %w(password_blacklist.gemspec CHANGELOG.md LICENSE.txt README.md)
20
+
21
+ spec.bindir = 'bin'
22
+ spec.require_paths = ['lib']
22
23
  spec.platform = Gem::Platform::RUBY
23
24
 
24
- spec.add_development_dependency "bundler", "~> 1.13"
25
- spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.required_ruby_version = '~> 2.0'
26
+
27
+ spec.add_development_dependency 'bundler', '~> 1.13'
28
+ spec.add_development_dependency 'rake', '~> 12.0.0'
26
29
 
27
- spec.add_development_dependency "rspec", "~> 3.5"
30
+ spec.add_development_dependency 'rspec', '~> 3.5'
28
31
  spec.add_development_dependency 'simplecov', '~> 0.12.0'
29
32
  spec.add_development_dependency 'rubocop', '~> 0.47.1'
30
33
  spec.add_development_dependency 'coveralls', '~> 0.8.18'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_blacklist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gordon Chan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-19 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.0.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +136,7 @@ files:
136
136
  - README.md
137
137
  - data/100k_passwords.txt
138
138
  - lib/password_blacklist.rb
139
- - lib/password_blacklist/tester.rb
139
+ - lib/password_blacklist/checker.rb
140
140
  - lib/password_blacklist/version.rb
141
141
  - password_blacklist.gemspec
142
142
  homepage: https://www.github.com/gchan/password_blacklist
@@ -149,14 +149,14 @@ require_paths:
149
149
  - lib
150
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - ">="
152
+ - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: '2.0'
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 1.3.1
159
+ version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
162
  rubygems_version: 2.6.8
@@ -1,17 +0,0 @@
1
- module PasswordBlacklist
2
- class Tester
3
- def initialize
4
- file_path = File.expand_path("../../../data/100k_passwords.txt", __FILE__)
5
-
6
- @data = File.read(file_path)
7
- end
8
-
9
- def test(password)
10
- !!@data.match(/#{password}/)
11
- end
12
-
13
- def inspect
14
- "#<#{self.class}:0x#{self.__id__.to_s(16)}>"
15
- end
16
- end
17
- end