firebug 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -21
- data/Rakefile +13 -1
- data/firebug.gemspec +12 -9
- data/lib/action_dispatch/session/code_igniter_store.rb +45 -6
- data/lib/firebug.rb +68 -53
- data/lib/firebug/configuration.rb +23 -6
- data/lib/firebug/crypto.rb +9 -2
- data/lib/firebug/serializer.rb +1 -0
- data/lib/firebug/session.rb +4 -1
- data/lib/firebug/unserializer.rb +7 -2
- data/lib/firebug/version.rb +2 -1
- metadata +62 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d962e0889d934d02bb7ddd704dc36551f1e93782
|
4
|
+
data.tar.gz: 6fd8c6ee90d2427015b20d377a138811762ec0a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6335042903d1bfdbf55ad9033151b3650f4d2d88a3e80cd91e267f2d5995de9fd3df006fd822dd2af50b4391e8a4c9c450a63d145ec8a95a0f54119964cc635
|
7
|
+
data.tar.gz: 3867412bef819d66ab7eee5d523d0a783a5295b2b19b75d40ad4b5fe780c0636af04dff260f78671eecf286d61ddf5de3b774c4fa24df6b907a050179f26bb4f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
firebug (0.
|
4
|
+
firebug (0.2.0)
|
5
5
|
actionpack (~> 5.0)
|
6
6
|
activerecord (~> 5.0)
|
7
7
|
ruby-mcrypt (~> 0.2)
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
minitest (~> 5.1)
|
35
35
|
tzinfo (~> 1.1)
|
36
36
|
arel (8.0.0)
|
37
|
-
ast (2.
|
37
|
+
ast (2.4.0)
|
38
38
|
builder (3.2.3)
|
39
39
|
coderay (1.1.2)
|
40
40
|
concurrent-ruby (1.0.5)
|
@@ -53,9 +53,9 @@ GEM
|
|
53
53
|
minitest (5.11.3)
|
54
54
|
nokogiri (1.8.2)
|
55
55
|
mini_portile2 (~> 2.3.0)
|
56
|
-
parallel (1.12.
|
57
|
-
parser (2.
|
58
|
-
ast (~> 2.
|
56
|
+
parallel (1.12.1)
|
57
|
+
parser (2.5.0.1)
|
58
|
+
ast (~> 2.4.0)
|
59
59
|
powerpack (0.1.1)
|
60
60
|
pry (0.11.3)
|
61
61
|
coderay (~> 1.1.0)
|
@@ -68,8 +68,7 @@ GEM
|
|
68
68
|
nokogiri (>= 1.6)
|
69
69
|
rails-html-sanitizer (1.0.3)
|
70
70
|
loofah (~> 2.0)
|
71
|
-
rainbow (
|
72
|
-
rake
|
71
|
+
rainbow (3.0.0)
|
73
72
|
rake (12.3.0)
|
74
73
|
rspec (3.7.0)
|
75
74
|
rspec-core (~> 3.7.0)
|
@@ -86,15 +85,15 @@ GEM
|
|
86
85
|
rspec-support (3.7.0)
|
87
86
|
rspec_junit_formatter (0.3.0)
|
88
87
|
rspec-core (>= 2, < 4, != 2.12.0)
|
89
|
-
rubocop (0.
|
88
|
+
rubocop (0.52.1)
|
90
89
|
parallel (~> 1.10)
|
91
|
-
parser (>= 2.
|
90
|
+
parser (>= 2.4.0.2, < 3.0)
|
92
91
|
powerpack (~> 0.1)
|
93
|
-
rainbow (>= 2.2.2, <
|
92
|
+
rainbow (>= 2.2.2, < 4.0)
|
94
93
|
ruby-progressbar (~> 1.7)
|
95
94
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
96
|
-
rubocop-rspec (1.
|
97
|
-
rubocop (>= 0.
|
95
|
+
rubocop-rspec (1.22.2)
|
96
|
+
rubocop (>= 0.52.1)
|
98
97
|
ruby-mcrypt (0.2.0)
|
99
98
|
ruby-progressbar (1.9.0)
|
100
99
|
simplecov (0.15.1)
|
@@ -107,21 +106,23 @@ GEM
|
|
107
106
|
tzinfo (1.2.5)
|
108
107
|
thread_safe (~> 0.1)
|
109
108
|
unicode-display_width (1.3.0)
|
109
|
+
yard (0.9.12)
|
110
110
|
|
111
111
|
PLATFORMS
|
112
112
|
ruby
|
113
113
|
|
114
114
|
DEPENDENCIES
|
115
|
-
bundler
|
115
|
+
bundler (~> 1.16)
|
116
116
|
firebug!
|
117
|
-
pry
|
118
|
-
rake
|
119
|
-
rspec
|
120
|
-
rspec_junit_formatter
|
121
|
-
rubocop
|
122
|
-
rubocop-rspec
|
123
|
-
simplecov
|
124
|
-
sqlite3
|
117
|
+
pry (~> 0.11.3)
|
118
|
+
rake (~> 12.3)
|
119
|
+
rspec (~> 3.7)
|
120
|
+
rspec_junit_formatter (~> 0.3.0)
|
121
|
+
rubocop (~> 0.52.1)
|
122
|
+
rubocop-rspec (~> 1.22, >= 1.22.2)
|
123
|
+
simplecov (~> 0.15.1)
|
124
|
+
sqlite3 (~> 1.3, >= 1.3.13)
|
125
|
+
yard (~> 0.9.12)
|
125
126
|
|
126
127
|
BUNDLED WITH
|
127
128
|
1.16.0
|
data/Rakefile
CHANGED
@@ -3,11 +3,23 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
require 'rubocop/rake_task'
|
6
|
+
require 'yard'
|
7
|
+
require 'firebug/version'
|
6
8
|
|
7
9
|
RSpec::Core::RakeTask.new(:spec)
|
8
10
|
|
11
|
+
YARD::Rake::YardocTask.new do |task|
|
12
|
+
task.options += ['--title', "Firebug #{Firebug::VERSION} Documentation"]
|
13
|
+
task.options += ['--protected']
|
14
|
+
task.options += ['--no-private']
|
15
|
+
|
16
|
+
# has to be last
|
17
|
+
extra_files = %w[CODE_OF_CONDUCT.md LICENSE.txt]
|
18
|
+
task.options += ['-'] + extra_files
|
19
|
+
end
|
20
|
+
|
9
21
|
RuboCop::RakeTask.new do |task|
|
10
22
|
task.requires << 'rubocop-rspec'
|
11
23
|
end
|
12
24
|
|
13
|
-
task default:
|
25
|
+
task default: %i[rubocop spec]
|
data/firebug.gemspec
CHANGED
@@ -22,17 +22,20 @@ Gem::Specification.new do |spec| # rubocop:disable BlockLength
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
+
spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
|
26
|
+
|
25
27
|
spec.add_dependency 'actionpack', '~> 5.0'
|
26
28
|
spec.add_dependency 'activerecord', '~> 5.0'
|
27
29
|
spec.add_dependency 'ruby-mcrypt', '~> 0.2'
|
28
30
|
|
29
|
-
spec.add_development_dependency 'bundler'
|
30
|
-
spec.add_development_dependency 'pry'
|
31
|
-
spec.add_development_dependency 'rake'
|
32
|
-
spec.add_development_dependency 'rspec'
|
33
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
34
|
-
spec.add_development_dependency 'rubocop'
|
35
|
-
spec.add_development_dependency 'rubocop-rspec'
|
36
|
-
spec.add_development_dependency 'simplecov'
|
37
|
-
spec.add_development_dependency 'sqlite3'
|
31
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
32
|
+
spec.add_development_dependency 'pry', '~> 0.11.3'
|
33
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.3.0'
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0.52.1'
|
37
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.22', '>= 1.22.2'
|
38
|
+
spec.add_development_dependency 'simplecov', '~> 0.15.1'
|
39
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3', '>= 1.3.13'
|
40
|
+
spec.add_development_dependency 'yard', '~> 0.9.12'
|
38
41
|
end
|
@@ -5,16 +5,26 @@ require_relative '../../firebug/session'
|
|
5
5
|
|
6
6
|
module ActionDispatch
|
7
7
|
module Session
|
8
|
+
# A session store for Rails to handle Pyro sessions.
|
8
9
|
class CodeIgniterStore < AbstractStore
|
10
|
+
# @param [Object] app
|
11
|
+
# @param [Hash] options
|
12
|
+
# @option options [String] :key ('default_pyrocms') The session cookie name.
|
9
13
|
def initialize(app, options={})
|
10
14
|
super(app, { key: 'default_pyrocms' }.merge(options))
|
11
15
|
end
|
12
16
|
|
17
|
+
private
|
18
|
+
|
13
19
|
# Finds an existing session or creates a new one.
|
14
20
|
#
|
21
|
+
# @!visibility public
|
22
|
+
#
|
23
|
+
# @see http://api.rubyonrails.org/classes/ActionDispatch/Request.html ActionDispatch::Request
|
24
|
+
#
|
15
25
|
# @param [ActionDispatch::Request] req
|
16
26
|
# @param [String] sid
|
17
|
-
# @return [Array<String,
|
27
|
+
# @return [Array<String, Hash>]
|
18
28
|
def find_session(req, sid)
|
19
29
|
model = find_session_model(req, sid)
|
20
30
|
# +Rack::Session::Abstract::Persisted#load_session+ expects this to return an Array with the first value being
|
@@ -22,8 +32,31 @@ module ActionDispatch
|
|
22
32
|
[model.session_id, model.user_data]
|
23
33
|
end
|
24
34
|
|
35
|
+
# Should the session be persisted?
|
36
|
+
#
|
37
|
+
# @note This is called from +Rack::Session::Abstract::Persisted#commit_session+.
|
38
|
+
#
|
39
|
+
# @!visibility public
|
40
|
+
#
|
41
|
+
# @see http://www.rubydoc.info/gems/rack/Rack/Session/Abstract/Persisted#commit_session-instance_method
|
42
|
+
# Rack::Session::Abstract::Persisted#commit_session
|
43
|
+
# @see http://api.rubyonrails.org/classes/ActionDispatch/Request.html ActionDispatch::Request
|
44
|
+
#
|
45
|
+
# @param [ActionDispatch::Request] req
|
46
|
+
# @param [Hash] session
|
47
|
+
# @param [Hash] options
|
48
|
+
# @return [Boolean] when true #write_session will be called
|
49
|
+
def commit_session?(req, session, options)
|
50
|
+
# If session_filter returns true then let super decide if we commit the session.
|
51
|
+
Firebug.config.session_filter.call(req) ? super : false
|
52
|
+
end
|
53
|
+
|
25
54
|
# Writes the session information to the database.
|
26
55
|
#
|
56
|
+
# @!visibility public
|
57
|
+
#
|
58
|
+
# @see http://api.rubyonrails.org/classes/ActionDispatch/Request.html ActionDispatch::Request
|
59
|
+
#
|
27
60
|
# @param [ActionDispatch::Request] req
|
28
61
|
# @param [String] sid
|
29
62
|
# @param [Hash] session
|
@@ -45,6 +78,10 @@ module ActionDispatch
|
|
45
78
|
|
46
79
|
# Deletes then creates a new session in the database.
|
47
80
|
#
|
81
|
+
# @!visibility public
|
82
|
+
#
|
83
|
+
# @see http://api.rubyonrails.org/classes/ActionDispatch/Request.html ActionDispatch::Request
|
84
|
+
#
|
48
85
|
# @param [ActionDispatch::Request] req
|
49
86
|
# @param [String] sid
|
50
87
|
# @param [Hash] _options
|
@@ -58,6 +95,10 @@ module ActionDispatch
|
|
58
95
|
|
59
96
|
# Tries to find the session ID in the requests cookies.
|
60
97
|
#
|
98
|
+
# @!visibility public
|
99
|
+
#
|
100
|
+
# @see http://api.rubyonrails.org/classes/ActionDispatch/Request.html ActionDispatch::Request
|
101
|
+
#
|
61
102
|
# @param [ActionDispatch::Request] req
|
62
103
|
# @return [String, nil]
|
63
104
|
def extract_session_id(req)
|
@@ -69,8 +110,6 @@ module ActionDispatch
|
|
69
110
|
Firebug.decrypt_cookie(sid)[:session_id]
|
70
111
|
end
|
71
112
|
|
72
|
-
private
|
73
|
-
|
74
113
|
# @param [ActionDispatch::Request] req
|
75
114
|
# @param [String] sid
|
76
115
|
# @return [Firebug::Session]
|
@@ -96,9 +135,9 @@ module ActionDispatch
|
|
96
135
|
# @return [Hash]
|
97
136
|
def find_by_params(req, sid)
|
98
137
|
params = { session_id: sid }
|
99
|
-
params[:ip_address] = req.remote_ip if Firebug.
|
100
|
-
if Firebug.
|
101
|
-
params[:user_agent] = Firebug.
|
138
|
+
params[:ip_address] = req.remote_ip if Firebug.config.match_ip_address
|
139
|
+
if Firebug.config.match_user_agent
|
140
|
+
params[:user_agent] = Firebug.config.truncate_user_agent ? req.user_agent&.slice(0...120) : req.user_agent
|
102
141
|
end
|
103
142
|
params
|
104
143
|
end
|
data/lib/firebug.rb
CHANGED
@@ -10,66 +10,81 @@ require_relative 'action_dispatch/session/code_igniter_store'
|
|
10
10
|
module Firebug
|
11
11
|
class << self
|
12
12
|
attr_writer :configuration
|
13
|
-
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
@
|
18
|
-
|
14
|
+
# Firebug configuration
|
15
|
+
#
|
16
|
+
# @return [Firebug::Configuration]
|
17
|
+
def configuration
|
18
|
+
@configuration ||= Configuration.new
|
19
|
+
end
|
20
|
+
alias config configuration
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
# Configure Firebug inside a block.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Firebug.configure do |config|
|
26
|
+
# config.key = 'password'
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# @yieldparam [Firebug::Configuration] config
|
30
|
+
def configure
|
31
|
+
yield configuration
|
32
|
+
end
|
24
33
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
# Serialize a ruby object into a PHP serialized string.
|
35
|
+
#
|
36
|
+
# @see Firebug::Serializer.parse
|
37
|
+
#
|
38
|
+
# @param [Object] value
|
39
|
+
# @return [String]
|
40
|
+
def serialize(value)
|
41
|
+
Serializer.parse(value)
|
42
|
+
end
|
32
43
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
44
|
+
# Unserialize a PHP serialized string into a ruby object.
|
45
|
+
#
|
46
|
+
# @see Firebug::Unserializer.parse
|
47
|
+
#
|
48
|
+
# @param [String] value
|
49
|
+
# @return [Object]
|
50
|
+
def unserialize(value)
|
51
|
+
Unserializer.parse(value)
|
52
|
+
end
|
40
53
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
54
|
+
# Encrypt data the way CodeIgniter does.
|
55
|
+
#
|
56
|
+
# @see Firebug::Crypto#encrypt
|
57
|
+
#
|
58
|
+
# @param [Object] data
|
59
|
+
# @param [String] key if `nil` use +Firebug::Configuration.key+
|
60
|
+
def encrypt(data, key=nil)
|
61
|
+
Crypto.new(key.nil? ? config.key : key).encrypt(data)
|
62
|
+
end
|
49
63
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
64
|
+
# Decrypt data encrypted using CodeIgniters encryption.
|
65
|
+
#
|
66
|
+
# @see Firebug::Crypto#decrypt
|
67
|
+
#
|
68
|
+
# @param [Object] data
|
69
|
+
# @param [String] key If `nil` use +Firebug::Configuration.key+
|
70
|
+
def decrypt(data, key=nil)
|
71
|
+
Crypto.new(key.nil? ? config.key : key).decrypt(data)
|
72
|
+
end
|
58
73
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
74
|
+
# Serializes, encrypts, and base64 encodes the data.
|
75
|
+
#
|
76
|
+
# @param [Object] data
|
77
|
+
# @return [String] A base64 encoded string.
|
78
|
+
def encrypt_cookie(data)
|
79
|
+
Base64.strict_encode64(Firebug.encrypt(Firebug.serialize(data)))
|
80
|
+
end
|
66
81
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
82
|
+
# Decodes the base64 encoded string, decrypts, and unserializes.
|
83
|
+
#
|
84
|
+
# @param [String] data A base64 encoded encrypted string.
|
85
|
+
# @return [Object] The unserialized data.
|
86
|
+
def decrypt_cookie(data)
|
87
|
+
data.nil? ? {} : Firebug.unserialize(Firebug.decrypt(Base64.strict_decode64(data)))
|
88
|
+
end
|
74
89
|
end
|
75
90
|
end
|
@@ -3,11 +3,19 @@
|
|
3
3
|
module Firebug
|
4
4
|
# A configuration object.
|
5
5
|
#
|
6
|
-
# @attr [String] key
|
7
|
-
#
|
8
|
-
# @attr [
|
9
|
-
#
|
10
|
-
# @attr [Boolean]
|
6
|
+
# @attr [String] key
|
7
|
+
# The encryption key used to encrypt and decrypt cookies.
|
8
|
+
# @attr [String] table_name
|
9
|
+
# The name of the sessions table.
|
10
|
+
# @attr [Boolean] truncate_user_agent
|
11
|
+
# Truncate the user-agent to 120 characters.
|
12
|
+
# @attr [Boolean] match_user_agent
|
13
|
+
# Use the user-agent in addition to the session ID.
|
14
|
+
# @attr [Boolean] match_ip_address
|
15
|
+
# Use the remote ip address in addition to the session ID.
|
16
|
+
# @attr [Proc] session_filter
|
17
|
+
# Return true if this request should have it's session written.
|
18
|
+
# @see ActionDispatch::Session::CodeIgniterStore#commit_session?
|
11
19
|
class Configuration
|
12
20
|
attr_reader :table_name
|
13
21
|
|
@@ -15,8 +23,17 @@ module Firebug
|
|
15
23
|
attr_accessor :truncate_user_agent
|
16
24
|
attr_accessor :match_user_agent
|
17
25
|
attr_accessor :match_ip_address
|
26
|
+
attr_accessor :session_filter
|
18
27
|
|
19
|
-
|
28
|
+
def initialize
|
29
|
+
self.truncate_user_agent = false
|
30
|
+
self.match_user_agent = false
|
31
|
+
self.match_ip_address = false
|
32
|
+
# default to always writing the session
|
33
|
+
self.session_filter = ->(_) { true }
|
34
|
+
end
|
35
|
+
|
36
|
+
# Sets the table name for (see Firebug::Session)
|
20
37
|
#
|
21
38
|
# @param [String] value
|
22
39
|
def table_name=(value)
|
data/lib/firebug/crypto.rb
CHANGED
@@ -5,22 +5,27 @@ module Firebug
|
|
5
5
|
require 'securerandom'
|
6
6
|
require 'mcrypt'
|
7
7
|
|
8
|
+
# Class for encrypting and decrypting Pyro cookies.
|
8
9
|
class Crypto
|
9
10
|
# @param [String] key
|
10
11
|
def initialize(key)
|
11
12
|
@key = Digest::MD5.hexdigest(key)
|
12
13
|
end
|
13
14
|
|
15
|
+
# Encrypts +data+ using the Rijndael 256 cipher.
|
16
|
+
#
|
14
17
|
# @param [String] data
|
15
18
|
# @return [String]
|
16
19
|
def encrypt(data)
|
17
20
|
# Create a random 32 byte string to act as the initialization vector.
|
18
21
|
iv = SecureRandom.random_bytes(32)
|
19
|
-
#
|
22
|
+
# Pyro pads the data with zeros
|
20
23
|
cipher = Mcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)
|
21
24
|
add_noise(iv + cipher.encrypt(data))
|
22
25
|
end
|
23
26
|
|
27
|
+
# Decrypts +data+ using the Rijndael 256 cipher.
|
28
|
+
#
|
24
29
|
# @param [String] data
|
25
30
|
# @return [String]
|
26
31
|
def decrypt(data)
|
@@ -31,7 +36,7 @@ module Firebug
|
|
31
36
|
cipher.decrypt(data[32..-1])
|
32
37
|
end
|
33
38
|
|
34
|
-
#
|
39
|
+
# Pyro adds "noise" to the results of the encryption by adding the ordinal value of each character with a
|
35
40
|
# value in the key. The plaintext key is hashed with MD5 then SHA1.
|
36
41
|
#
|
37
42
|
# @param [String] data
|
@@ -41,6 +46,8 @@ module Firebug
|
|
41
46
|
|
42
47
|
# The "noise" is removed by subtracting the ordinals.
|
43
48
|
#
|
49
|
+
# @see #add_noise
|
50
|
+
#
|
44
51
|
# @param [String] data
|
45
52
|
# @return [String]
|
46
53
|
def remove_noise(data)
|
data/lib/firebug/serializer.rb
CHANGED
data/lib/firebug/session.rb
CHANGED
@@ -21,7 +21,7 @@ module Firebug
|
|
21
21
|
def user_agent=(value)
|
22
22
|
# Pyro seems to truncate the value and since it also uses this value when finding the session, it's important
|
23
23
|
# we do the same.
|
24
|
-
super(Firebug.
|
24
|
+
super(Firebug.config.truncate_user_agent ? value&.slice(0...120) : value)
|
25
25
|
end
|
26
26
|
|
27
27
|
# @return [String]
|
@@ -32,6 +32,9 @@ module Firebug
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
+
# Replace the default timestamp column name.
|
36
|
+
#
|
37
|
+
# @return [Array<String>]
|
35
38
|
def timestamp_attributes_for_update
|
36
39
|
['last_activity']
|
37
40
|
end
|
data/lib/firebug/unserializer.rb
CHANGED
@@ -5,8 +5,6 @@ module Firebug
|
|
5
5
|
|
6
6
|
# This class will unserialize a PHP serialized string into a ruby object.
|
7
7
|
#
|
8
|
-
# @note Hashes will be returned with symbolized keys.
|
9
|
-
#
|
10
8
|
# @attr [StringScanner] str
|
11
9
|
class Unserializer
|
12
10
|
attr_accessor :str
|
@@ -18,13 +16,20 @@ module Firebug
|
|
18
16
|
|
19
17
|
# Convenience method for unserializing a PHP serialized string.
|
20
18
|
#
|
19
|
+
# @see #parse
|
20
|
+
#
|
21
21
|
# @param [String] value
|
22
22
|
# @return [Object]
|
23
23
|
def self.parse(value)
|
24
24
|
new(value).parse
|
25
25
|
end
|
26
26
|
|
27
|
+
# Parse a PHP serialized string into a Ruby object.
|
28
|
+
#
|
29
|
+
# @note Hashes will be returned with symbolized keys.
|
30
|
+
#
|
27
31
|
# @raise [ParserError]
|
32
|
+
# @return [Hash, Array, String, Integer, Float, nil]
|
28
33
|
def parse # rubocop:disable AbcSize,CyclomaticComplexity
|
29
34
|
ch = str.getch
|
30
35
|
return if ch.nil?
|
data/lib/firebug/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firebug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Frase
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -56,128 +56,154 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.16'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.16'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.11.3
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.11.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '12.3'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '12.3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.7'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.7'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec_junit_formatter
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.3.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 0.3.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.52.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.52.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rubocop-rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.22'
|
143
146
|
- - ">="
|
144
147
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
148
|
+
version: 1.22.2
|
146
149
|
type: :development
|
147
150
|
prerelease: false
|
148
151
|
version_requirements: !ruby/object:Gem::Requirement
|
149
152
|
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '1.22'
|
150
156
|
- - ">="
|
151
157
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
158
|
+
version: 1.22.2
|
153
159
|
- !ruby/object:Gem::Dependency
|
154
160
|
name: simplecov
|
155
161
|
requirement: !ruby/object:Gem::Requirement
|
156
162
|
requirements:
|
157
|
-
- - "
|
163
|
+
- - "~>"
|
158
164
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
165
|
+
version: 0.15.1
|
160
166
|
type: :development
|
161
167
|
prerelease: false
|
162
168
|
version_requirements: !ruby/object:Gem::Requirement
|
163
169
|
requirements:
|
164
|
-
- - "
|
170
|
+
- - "~>"
|
165
171
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
172
|
+
version: 0.15.1
|
167
173
|
- !ruby/object:Gem::Dependency
|
168
174
|
name: sqlite3
|
169
175
|
requirement: !ruby/object:Gem::Requirement
|
170
176
|
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '1.3'
|
171
180
|
- - ">="
|
172
181
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
182
|
+
version: 1.3.13
|
174
183
|
type: :development
|
175
184
|
prerelease: false
|
176
185
|
version_requirements: !ruby/object:Gem::Requirement
|
177
186
|
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '1.3'
|
178
190
|
- - ">="
|
179
191
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
192
|
+
version: 1.3.13
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: yard
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 0.9.12
|
200
|
+
type: :development
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - "~>"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.9.12
|
181
207
|
description: Gem for working with CodeIgniter sessions
|
182
208
|
email:
|
183
209
|
- aaron@rvshare.com
|
@@ -215,7 +241,8 @@ files:
|
|
215
241
|
homepage: https://github.com/rvshare/firebug
|
216
242
|
licenses:
|
217
243
|
- MIT
|
218
|
-
metadata:
|
244
|
+
metadata:
|
245
|
+
yard.run: yri
|
219
246
|
post_install_message:
|
220
247
|
rdoc_options: []
|
221
248
|
require_paths:
|