sbsm 1.5.9 → 1.6.1

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
- SHA1:
3
- metadata.gz: 6f2ae1755e50072d0307ecbe9c57c67c1b4a891a
4
- data.tar.gz: 1b2e7d58d1b60cc487248e1123a8422cf051fd4a
2
+ SHA256:
3
+ metadata.gz: 5c49aade69c54b5d99fabe38bb3896307a2a5d726629bbb14764c4bcbcee46ce
4
+ data.tar.gz: 76a61fc0932cfd6dd8bfb065e573c0c0b8b62b079235008620f82b2e76f7b4ac
5
5
  SHA512:
6
- metadata.gz: 1e092d40cc433c228137788cbc01e79a2e31cb03d3c84ae51d6ad0c3c686241aead506e2baeabe841c58dc0b226616ab444324961e7607ab8e5034eb66157924
7
- data.tar.gz: a430f249b35eed0d1b7514f352a8b4dfe27cd7f1d60efec3d4ca856884eb8756f7e28b81184b392707247f156923431d9b9a6d671935b60453cef4cba4591383
6
+ metadata.gz: 547e0cb68e3454ba50f7a2058fef10c482fdd1cee0454cb3ef6c00e5150718241f6d312464dd88ab1ea6738f1532f2cffc661ef65b2ab8f3c9aabb665c2fe460
7
+ data.tar.gz: 73c7c87eff58a13e476d0222d56b54ee57904e8b7757fe94cc4ca5fc0097828c3c2b88b6ce783cd5163a1886fc09701b83e457d3fe5bd56eaf7619b0b0214be0
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ # Using a matrix fails, because /setup-ruby always invokes bundle install without any additional args
20
+ # Fixed by adding not defining the debugger group in the Gemfile
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os: [ ubuntu]
25
+ ruby: [2.5, 2.6, 2.7, 3.0, 3.1, head]
26
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+
34
+ - name: Run tests via rake
35
+ run: bundle exec rake
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source "https://rubygems.org"
2
+ gem 'net-smtp', require: false
2
3
 
3
4
  gemspec
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ === 1.6.1 / 09.12.2022
2
+
3
+ * Fix Mime-Bug for Davaz.com
4
+
5
+ === 1.6.0 / 13.06.2020
6
+
7
+ * Remove calls to obsolete taint/untaint methods
8
+
1
9
  === 1.5.9 / 30.08.2017
2
10
 
3
11
  * Fix recognition whether we are using HTTPS or not
File without changes
data/lib/sbsm/app.rb CHANGED
@@ -93,6 +93,14 @@ module SBSM
93
93
  @@last_session
94
94
  end
95
95
 
96
+ def fix_html_content_type(content_type)
97
+ # davaz.com#50
98
+ if content_type == 'application/xhtml+xml'
99
+ return 'text/html; charset=utf-8'
100
+ end
101
+ return content_type
102
+ end
103
+
96
104
  def call(env) ## mimick sbsm/lib/app.rb
97
105
  request = Rack::Request.new(env)
98
106
  response = Rack::Response.new
@@ -106,7 +114,6 @@ module SBSM
106
114
  else
107
115
  file_name = File.expand_path(File.join('doc', request.path))
108
116
  end
109
-
110
117
  if File.file?(file_name)
111
118
  if File.extname(file_name).length > 0 && (mime_info = MimeMagic.by_extension(File.extname(file_name)))
112
119
  mime_type = mime_info.type
@@ -114,10 +121,11 @@ module SBSM
114
121
  mime_type = MimeMagic.by_path(file_name)
115
122
  end
116
123
  mime_type ||= 'text/plain'
124
+ mime_type = fix_html_content_type(mime_type)
117
125
  SBSM.debug "file_name is #{file_name} checkin base #{File.basename(file_name)} MIME #{mime_type}"
118
126
  response.set_header('Content-Type', mime_type)
119
127
  response.write(File.open(file_name, File::RDONLY){|file| file.read})
120
- return response
128
+ return response.finish
121
129
  end
122
130
 
123
131
  return [400, {}, []] if /favicon.ico/i.match(request.path)
@@ -128,9 +136,9 @@ module SBSM
128
136
  thru = session.get_passthru
129
137
  if thru.size > 0
130
138
  begin
131
- file_name = thru.first.untaint
139
+ file_name = thru.first
132
140
  raise Errno::ENOENT unless File.exist?(file_name)
133
- response.set_header('Content-Type', MimeMagic.by_extension(File.extname(file_name)).type)
141
+ response.set_header('Content-Type', fix_html_content_type(MimeMagic.by_extension(File.extname(file_name)).type))
134
142
  response.headers['Content-Disposition'] = "#{thru.last}; filename=#{File.basename(file_name)}"
135
143
  response.headers['Content-Length'] = File.size(file_name).to_s
136
144
  response.write(File.open(file_name, File::RDONLY){|file| file.read})
data/lib/sbsm/logger.rb CHANGED
File without changes
data/lib/sbsm/session.rb CHANGED
@@ -479,7 +479,7 @@ module SBSM
479
479
  end
480
480
  def passthru(path, disposition='attachment')
481
481
  # the variable @passthru is set by a trusted source
482
- @passthru = path.untaint
482
+ @passthru = path
483
483
  @disposition = disposition
484
484
  ''
485
485
  end
File without changes
@@ -44,13 +44,13 @@ module SBSM
44
44
  def initialize(name: nil, config_file: nil, handler_uri: nil)
45
45
  @handler_uri = handler_uri ||= '/index.rbx'
46
46
  config_file ||= 'etc/trans_handler.yml'
47
- @config_file = File.expand_path(config_file).untaint
47
+ @config_file = File.expand_path(config_file)
48
48
  @parser_name = name ||= 'uri'
49
49
  @parser_method = "_#{name}_parser"
50
50
  @grammar_path = File.expand_path("../../data/#{name}.grammar",
51
- File.dirname(__FILE__).untaint)
51
+ File.dirname(__FILE__))
52
52
  @parser_path = File.expand_path("#{name}_parser.rb",
53
- File.dirname(__FILE__).untaint)
53
+ File.dirname(__FILE__))
54
54
  end
55
55
  def config(request)
56
56
  config = Hash.new { {} }
@@ -150,12 +150,12 @@ module SBSM
150
150
  end
151
151
  def uri_parser(grammar_path=@grammar_path, parser_path=@parser_path)
152
152
  if(File.exist?(grammar_path))
153
- oldpath = File.expand_path("_" << File.basename(grammar_path),
153
+ oldpath = File.expand_path("_" << File.basename(grammar_path),
154
154
  File.dirname(grammar_path))
155
155
  src = File.read(grammar_path)
156
- unless(File.exists?(oldpath) && File.read(oldpath)==src)
157
- File.delete(oldpath) if File.exists?(oldpath)
158
- Parse.generate_parser_from_file_to_file(grammar_path,
156
+ unless(File.exist?(oldpath) && File.read(oldpath)==src)
157
+ File.delete(oldpath) if File.exist?(oldpath)
158
+ Parse.generate_parser_from_file_to_file(grammar_path,
159
159
  parser_path, @parser_method, 'SBSM')
160
160
  File.open(oldpath, 'w') { |f| f << src }
161
161
  end
data/lib/sbsm/user.rb CHANGED
File without changes
data/lib/sbsm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SBSM
2
- VERSION = '1.5.9'
2
+ VERSION = '1.6.1'
3
3
  end
data/sbsm.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "rspec"
32
32
  spec.add_development_dependency "flexmock"
33
33
  spec.add_development_dependency "minitest"
34
- spec.add_development_dependency "rdoc"
34
+ spec.add_development_dependency "rdoc", '< 6.0.0'
35
35
  spec.add_development_dependency "simplecov"
36
36
  spec.add_development_dependency "watir"
37
37
  spec.add_development_dependency "watir-webdriver"
@@ -54,7 +54,7 @@ class AppVariantTest < Minitest::Test
54
54
  head '/fr/page/about'
55
55
  assert last_response.ok?
56
56
  assert last_response.body.empty?
57
- assert last_response.headers.keys.index('Content-Type')
57
+ assert last_response.headers.keys.index('content-type')
58
58
  end
59
59
  def test_request_file
60
60
  session_id_mock = '1234'
@@ -72,8 +72,8 @@ class AppVariantTest < Minitest::Test
72
72
  assert_equal(false, last_response.ok?)
73
73
  assert_equal(404, last_response.status)
74
74
  assert (last_response.body.to_s.index(invalid_path))
75
- assert last_response.headers.keys.index('Content-Type')
76
- assert_equal('text/html', last_response.headers['Content-Type'])
75
+ assert last_response.headers.keys.index('content-type')
76
+ assert_equal('text/html', last_response.headers['content-type'])
77
77
  end
78
78
  def test_request_file_with_no_mime_info
79
79
  session_id_mock = '1234'
@@ -92,8 +92,8 @@ class AppVariantTest < Minitest::Test
92
92
  result = get invalid_path, {}, env
93
93
 
94
94
  assert_equal(true, last_response.ok?)
95
- assert last_response.headers.keys.index('Content-Type')
96
- assert_equal('text/plain', last_response.headers['Content-Type'])
95
+ assert last_response.headers.keys.index('content-type')
96
+ assert_equal('text/plain', last_response.headers['content-type'])
97
97
  FileUtils.rm(file_name)
98
98
  end
99
99
  def test_request_file_with_mime_info
@@ -113,8 +113,8 @@ class AppVariantTest < Minitest::Test
113
113
  result = get invalid_path, {}, env
114
114
 
115
115
  assert_equal(true, last_response.ok?)
116
- assert last_response.headers.keys.index('Content-Type')
117
- assert_equal('image/png', last_response.headers['Content-Type'])
116
+ assert last_response.headers.keys.index('content-type')
117
+ assert_equal('image/png', last_response.headers['content-type'])
118
118
  FileUtils.rm(file_name)
119
119
  end
120
120
  end
@@ -72,12 +72,12 @@ module Demo
72
72
  PERSISTENT_COOKIE_NAME = 'CustomizedSession-cookie'
73
73
  LOOKANDFEEL = CustomLookandfeel
74
74
 
75
- def initialize(args)
75
+ def initialize(*args, **keyword_args)
76
76
  SBSM.debug "session args #{args}"
77
77
  @@active_stated_visited = false
78
78
  @@login_visited = false
79
79
  @@visited_init = true
80
- super(args)
80
+ super(*args, **keyword_args)
81
81
  end
82
82
 
83
83
  def flavor
@@ -231,7 +231,7 @@ class CustomizedAppSessionValidatorLnf < Minitest::Test
231
231
  end
232
232
  assert last_response.ok?
233
233
  # TEST_COOKIE_NAME set via param to app
234
- cookie = last_response.get_header('Set-Cookie').split("\n").find_all{|x| x.index(my_cookey_name)}
234
+ cookie = last_response.get_header('Set-Cookie')[0].split("\n").find_all{|x| x.index(my_cookey_name)}
235
235
  skip ('TODO: We should test test_customized_cookie_name')
236
236
  assert_equal 1, cookie.size
237
237
  assert_match my_cookey_name, cookie.first
@@ -249,7 +249,7 @@ class CustomizedAppCookieName < Minitest::Test
249
249
  get '/' do
250
250
  end
251
251
  assert last_response.ok?
252
- cookie = last_response.get_header('Set-Cookie').split("\n").find_all{|x| x.index(Demo::DEMO_PERSISTENT_COOKIE_NAME)}
252
+ cookie = last_response.get_header('Set-Cookie')[0].split("\n").find_all{|x| x.index(Demo::DEMO_PERSISTENT_COOKIE_NAME)}
253
253
  skip ('TODO: We should test test_customized_cookie_name')
254
254
  assert_equal 1, cookie.size
255
255
  assert_match Demo::DEMO_PERSISTENT_COOKIE_NAME, cookie.first
@@ -115,10 +115,10 @@ class StubSessionWithView < SBSM::Session
115
115
  attr_writer :lookandfeel, :persistent_user_input
116
116
  attr_writer :active_state
117
117
  public :active_state
118
- def initialize(args)
119
- args[:app] ||= StubSessionApp.new
120
- args[:validator] ||= StubSessionValidator.new
121
- super(args)
118
+ def initialize(*args, **kwargs)
119
+ kwargs[:app] ||= StubSessionApp.new
120
+ kwargs[:validator] ||= StubSessionValidator.new
121
+ super(*args, **kwargs)
122
122
  persistent_user_input = {}
123
123
  end
124
124
  end
@@ -117,7 +117,7 @@ EOS
117
117
  request = fake_request_for_path '/shortcut'
118
118
  # run in safe-mode
119
119
  Thread.new {
120
- $SAFE = 1
120
+ # $SAFE = 1
121
121
  TransHandler.instance.translate_uri(request)
122
122
  }.join
123
123
  assert_equal({'shortcut' => 'variables'}, request.params)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2022-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: rdoc
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "<"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: 6.0.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "<"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: 6.0.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -254,8 +254,8 @@ executables: []
254
254
  extensions: []
255
255
  extra_rdoc_files: []
256
256
  files:
257
+ - ".github/workflows/ruby.yml"
257
258
  - ".gitignore"
258
- - ".travis.yml"
259
259
  - Gemfile
260
260
  - History.txt
261
261
  - LICENCE.txt
@@ -331,8 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
331
  - !ruby/object:Gem::Version
332
332
  version: '0'
333
333
  requirements: []
334
- rubyforge_project:
335
- rubygems_version: 2.6.8
334
+ rubygems_version: 3.2.3
336
335
  signing_key:
337
336
  specification_version: 4
338
337
  summary: Application framework for state based session management from ywesee
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- language: ruby
3
-
4
- notifications:
5
- email:
6
- - ngiger@ywesee.com
7
-
8
- cache: bundler
9
-
10
- sudo: false
11
-
12
- before_install:
13
- - gem --version
14
-
15
- bundler_args: --without debugger
16
-
17
- rvm:
18
- - ruby-head
19
- - 2.2.3
20
- - 2.4.0
21
- - 2.3.0
22
- matrix:
23
- allow_failures:
24
- # On november 1 had failure compiling the child_processes
25
- - rvm: ruby-head
26
- - rvm: 2.2.3 # Test for LogLevel does not work
27
- - rvm: 2.3.0 # Test for LogLevel does not work