mauth-client 4.2.0 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -5
- data/CHANGELOG.md +3 -0
- data/lib/mauth/client.rb +34 -34
- data/lib/mauth/version.rb +1 -1
- data/mauth-client.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4124d677e7aee9626ea7e796bd5f92c695146cdadc125c2f05f3138d471758
|
4
|
+
data.tar.gz: 4eda569778ce91ced2cedfd14a231281e35ec068b86d2e551d52541d05b3f795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6118dc54acd81a9dc16d1364fab960dee75c5a5e055fc79bb2517d6eb48e3dbf033078b913b231f430fc9ae953be5f56ab727664bc147b0e90f0f71203ec9f14
|
7
|
+
data.tar.gz: fa8e3328ef7e779322e8ad0c7f4a3520f53370838a10e4cf1d0b8710ee0031fc37f4d5d31f080d39d7134c0dfa2a263a131c1323269e988a79978bcf21efd775
|
data/.travis.yml
CHANGED
@@ -13,19 +13,23 @@ before_install:
|
|
13
13
|
|
14
14
|
install:
|
15
15
|
- bundle install --jobs=3 --retry=3
|
16
|
-
-
|
17
|
-
curl -H 'Cache-Control: no-cache'
|
16
|
+
- >-
|
17
|
+
curl -H 'Cache-Control: no-cache'
|
18
|
+
https://raw.githubusercontent.com/mdsol/fossa_ci_scripts/main/travis_ci/fossa_install.sh |
|
19
|
+
bash -s -- -b $TRAVIS_BUILD_DIR
|
18
20
|
|
19
21
|
script:
|
20
22
|
- bundle exec rspec
|
21
|
-
-
|
22
|
-
curl -H 'Cache-Control: no-cache'
|
23
|
+
- >-
|
24
|
+
curl -H 'Cache-Control: no-cache'
|
25
|
+
https://raw.githubusercontent.com/mdsol/fossa_ci_scripts/main/travis_ci/fossa_run.sh |
|
26
|
+
bash -s -- -b $TRAVIS_BUILD_DIR
|
23
27
|
|
24
28
|
deploy:
|
25
29
|
provider: rubygems
|
26
30
|
gem: mauth-client
|
27
31
|
api_key:
|
28
|
-
secure:
|
32
|
+
secure: QDp0P/lMGLYc4+A3M6VD9y551X6GrGwOSBE6xSG4lE6mPXoSISK5Yj18vNWQRQuQ4BsE6CdfZ/xsPjSRDda6b+yUQbgisjJ+Ry6jUVE1v9UKTZ0VHgHyXcsaJFC29tBKBeuGCj0AD5qhbTO1+ybeZSUfdSeVVoidD4W/bSnvzlT1Lht7IE8jbHbR57LsJKoEaDxKu33dg4CYV96xrlYGxHAS2UgEgi5Ve3ohzBWkX9RWF/wWoGCzIYhJBzXgCEEFw8iWkspjTePgv9yjD2HIMtF44aiSTHM5iqBBsYJ7A8+kUwoq7+srsashHZ1wZz1YulsCSkjwM9AXZ4E0f9AnERw/RQ5gG7bCuHZtSG9g/0SWBQeNfkAF3An6eTSS24KVfnarGdH2bk0G28k2oP26MWiDKz8nlQxNAY4rH+dITael18bgf45H4KccQqiooBEGnuYpUAuIPB+1l+BsIcRQnrU3LDtmtZn0KrCHHJ7EHOdogOG+/Pxof8ht1xF7V+HYhhzSRJs2JkvmZsp4q2T7W6b6kfi59Cz3LpqA1HHYcL5/OFZeLA/TlCNke0CRMxG8k3udDKj50jqFATXEa8lNyGLjmWh7tL9Bb/uy+CU47qUdx+V4K+kheAvNFtHfpxmyUGJSY0FH02H1VBPWm10DZ7kH+6jgCKyXuql+yWDw62s=
|
29
33
|
on:
|
30
34
|
tags: true
|
31
35
|
repo: mdsol/mauth-client-ruby
|
data/CHANGELOG.md
CHANGED
data/lib/mauth/client.rb
CHANGED
@@ -8,7 +8,7 @@ require 'mauth/autoload'
|
|
8
8
|
require 'mauth/dice_bag/mauth_templates'
|
9
9
|
require 'mauth/version'
|
10
10
|
require 'faraday-http-cache'
|
11
|
-
require '
|
11
|
+
require 'mauth/faraday'
|
12
12
|
|
13
13
|
module MAuth
|
14
14
|
class Client
|
@@ -411,35 +411,32 @@ module MAuth
|
|
411
411
|
def initialize(mauth_client)
|
412
412
|
@mauth_client = mauth_client
|
413
413
|
# TODO: should this be UnableToSignError?
|
414
|
-
@mauth_client.assert_private_key(
|
415
|
-
|
416
|
-
|
417
|
-
@cache_write_lock = Mutex.new
|
414
|
+
@mauth_client.assert_private_key(
|
415
|
+
UnableToAuthenticateError.new("Cannot fetch public keys from mAuth service without a private key!")
|
416
|
+
)
|
418
417
|
end
|
419
418
|
|
420
419
|
def get(app_uuid)
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
# signing with a key mAuth doesn't know about is considered inauthentic
|
437
|
-
raise InauthenticError, "mAuth service responded with 404 looking up public key for #{app_uuid}"
|
438
|
-
else
|
439
|
-
@mauth_client.send(:mauth_service_response_error, response)
|
440
|
-
end
|
420
|
+
# url-encode the app_uuid to prevent trickery like escaping upward with ../../ in a malicious
|
421
|
+
# app_uuid - probably not exploitable, but this is the right way to do it anyway.
|
422
|
+
# use UNRESERVED instead of UNSAFE (the default) as UNSAFE doesn't include /
|
423
|
+
url_encoded_app_uuid = URI.escape(app_uuid, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
424
|
+
path = "/mauth/#{@mauth_client.mauth_api_version}/security_tokens/#{url_encoded_app_uuid}.json"
|
425
|
+
response = signed_mauth_connection.get(path)
|
426
|
+
|
427
|
+
case response.status
|
428
|
+
when 200
|
429
|
+
security_token_from(response.body)
|
430
|
+
when 404
|
431
|
+
# signing with a key mAuth doesn't know about is considered inauthentic
|
432
|
+
raise InauthenticError, "mAuth service responded with 404 looking up public key for #{app_uuid}"
|
433
|
+
else
|
434
|
+
@mauth_client.send(:mauth_service_response_error, response)
|
441
435
|
end
|
442
|
-
|
436
|
+
rescue ::Faraday::ConnectionFailed, ::Faraday::TimeoutError => e
|
437
|
+
msg = "mAuth service did not respond; received #{e.class}: #{e.message}"
|
438
|
+
@mauth_client.logger.error("Unable to authenticate with MAuth. Exception #{msg}")
|
439
|
+
raise UnableToAuthenticateError, msg
|
443
440
|
end
|
444
441
|
|
445
442
|
private
|
@@ -453,14 +450,17 @@ module MAuth
|
|
453
450
|
end
|
454
451
|
|
455
452
|
def signed_mauth_connection
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
453
|
+
@signed_mauth_connection ||= begin
|
454
|
+
if @mauth_client.ssl_certs_path
|
455
|
+
@mauth_client.faraday_options[:ssl] = { ca_path: @mauth_client.ssl_certs_path }
|
456
|
+
end
|
457
|
+
|
458
|
+
::Faraday.new(@mauth_client.mauth_baseurl, @mauth_client.faraday_options) do |builder|
|
459
|
+
builder.use MAuth::Faraday::MAuthClientUserAgent
|
460
|
+
builder.use MAuth::Faraday::RequestSigner, 'mauth_client' => @mauth_client
|
461
|
+
builder.use :http_cache, logger: MAuth::Client.new.logger, shared_cache: false
|
462
|
+
builder.adapter ::Faraday.default_adapter
|
463
|
+
end
|
464
464
|
end
|
465
465
|
end
|
466
466
|
end
|
data/lib/mauth/version.rb
CHANGED
data/mauth-client.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'faraday', '>= 0.17', '< 1.0'
|
22
22
|
spec.add_dependency 'faraday_middleware', '>= 0.9', '< 2.0'
|
23
23
|
spec.add_dependency 'faraday-http-cache', '>= 2.0', '< 3.0'
|
24
|
-
spec.add_dependency 'oj', '~> 3.0'
|
25
24
|
spec.add_dependency 'term-ansicolor', '~> 1.0'
|
26
25
|
spec.add_dependency 'coderay', '~> 1.0'
|
27
26
|
spec.add_dependency 'rack'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mauth-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Szenher
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-
|
14
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -73,20 +73,6 @@ dependencies:
|
|
73
73
|
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.0'
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: oj
|
78
|
-
requirement: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.0'
|
83
|
-
type: :runtime
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.0'
|
90
76
|
- !ruby/object:Gem::Dependency
|
91
77
|
name: term-ansicolor
|
92
78
|
requirement: !ruby/object:Gem::Requirement
|