api_warner 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/warner +4 -0
  3. data/lib/warner.rb +17 -0
  4. metadata +62 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ca22f915c83e7b8fa0660d47b87083c0bc4ef995
4
+ data.tar.gz: fff56815767902b79c9b41e118e1f425912b33ae
5
+ SHA512:
6
+ metadata.gz: ebb0b3908bac321092351ee0fcd35e601198037a0cc8ba12b90f0938bcbe8fc115d2788311043294cc1fcee654549f938feac9b48038adca176413111c57f44e
7
+ data.tar.gz: 91c8c740cfab678a83d4d8edbe427c9854df02a35379fb8e7f93e8da74917cf80d65299dae85edaf73c34d06588ecab60f94f0775ddb80da18c3aaf65ab54e99
data/bin/warner ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'warner'
4
+ Warner.check_apikey
data/lib/warner.rb ADDED
@@ -0,0 +1,17 @@
1
+ require "ptools"
2
+
3
+ class Warner
4
+
5
+ def self.track_files
6
+ tracked_files = Dir['**/*'].reject{|file| File.directory?(file)}
7
+ nonbinary_files = tracked_files.select{|file| !File.binary?(file)}
8
+ end
9
+
10
+ def self.check_apikey
11
+ tracked_files = self.track_files
12
+ suspicious_files = tracked_files.select{|file_path| File.readlines(file_path).grep(/[0-9a-zA-Z+\/]{28,}/).any?}
13
+ if suspicious_files.any? then puts "Warning! There seems to be a string similar to an API key in one of your files!"
14
+ else puts "There does not seem to be anything similar to an API key in your files, carry on!"
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: api_warner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Ortiz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ptools
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.3
27
+ description: A simple gem to warn you if there is a string similar to an API key in
28
+ any of your ruby files. As of now, it cannot read binary files and it gives trouble
29
+ when dealing with files written in other languages.
30
+ email: dan@test.not
31
+ executables:
32
+ - warner
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - bin/warner
37
+ - lib/warner.rb
38
+ homepage: http://rubygems.org/gems/api_warner
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.4.6
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Api Warner!
62
+ test_files: []