From f27d66b0aedc446f1622a1214b7aba74605ee33e Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Mon, 8 Oct 2018 23:55:42 -0300 Subject: [PATCH 1/3] refactor: use C libcbor instead of msgpack cbor --- Gemfile | 3 +++ lib/webauthn/authenticator_attestation_response.rb | 2 +- lib/webauthn/fake_authenticator.rb | 2 +- spec/spec_helper.rb | 2 +- webauthn.gemspec | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 8eea8c7f..098bd22b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,3 +6,6 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } # Specify your gem's dependencies in webauthn.gemspec gemspec + +# TODO: Remove this after cose is released +gem "cose", github: "cedarcode/cose-ruby", branch: "libcbor" diff --git a/lib/webauthn/authenticator_attestation_response.rb b/lib/webauthn/authenticator_attestation_response.rb index d7be1185..bb367547 100644 --- a/lib/webauthn/authenticator_attestation_response.rb +++ b/lib/webauthn/authenticator_attestation_response.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "cbor" +require "libcbor/all" require "uri" require "openssl" diff --git a/lib/webauthn/fake_authenticator.rb b/lib/webauthn/fake_authenticator.rb index 618051f8..5132f02a 100644 --- a/lib/webauthn/fake_authenticator.rb +++ b/lib/webauthn/fake_authenticator.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "cbor" +require "libcbor/all" require "openssl" require "securerandom" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 922248d7..d8f39688 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ require "bundler/setup" require "webauthn" -require "cbor" +require "libcbor/all" require "byebug" require "webauthn/fake_authenticator" diff --git a/webauthn.gemspec b/webauthn.gemspec index 60dce0cd..2e274503 100644 --- a/webauthn.gemspec +++ b/webauthn.gemspec @@ -29,9 +29,9 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.3" - spec.add_dependency "cbor", "~> 0.5.9.2" spec.add_dependency "cose", "~> 0.1.0" spec.add_dependency "jwt", [">= 1.5", "< 3.0"] + spec.add_dependency "libcbor", "~> 0.1.0" spec.add_dependency "openssl", "~> 2.0" spec.add_development_dependency "bundler", ">= 1.17", "< 3.0" From e55880c664cc742738be16fd5c0e08fd9df29c1f Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Tue, 9 Oct 2018 00:05:13 -0300 Subject: [PATCH 2/3] ci: add setup script --- .travis.yml | 2 ++ script/setup-linux | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100755 script/setup-linux diff --git a/.travis.yml b/.travis.yml index a565efc3..1c28d541 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ rvm: - 2.5.3 - 2.4.5 - 2.3.8 + matrix: fast_finish: true allow_failures: @@ -15,3 +16,4 @@ matrix: before_install: - gem install bundler -v "~> 2.0" + - sudo ./script/setup-linux diff --git a/script/setup-linux b/script/setup-linux new file mode 100755 index 00000000..1b7e1500 --- /dev/null +++ b/script/setup-linux @@ -0,0 +1,10 @@ +#!/bin/sh + +set -x + +if ! apt-cache show libcbor-dev >> /dev/null; then + add-apt-repository ppa:yubico/stable -y + apt-get update -q +fi + +apt-get install libcbor-dev -y From 8da19464b5a511a43ef4c156ee2973471092b8ef Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Tue, 9 Oct 2018 00:09:43 -0300 Subject: [PATCH 3/3] ci: test on osx to see if we get the same failures --- .travis.yml | 7 ++++++- script/setup-osx | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 script/setup-osx diff --git a/.travis.yml b/.travis.yml index 1c28d541..35ca186f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,11 @@ dist: xenial sudo: false language: ruby cache: bundler + +os: + - linux + - osx + rvm: - ruby-head - 2.6.0 @@ -16,4 +21,4 @@ matrix: before_install: - gem install bundler -v "~> 2.0" - - sudo ./script/setup-linux + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/setup-osx; else sudo ./script/setup-linux; fi diff --git a/script/setup-osx b/script/setup-osx new file mode 100755 index 00000000..e49e177b --- /dev/null +++ b/script/setup-osx @@ -0,0 +1,6 @@ +#!/bin/sh + +set -x + +brew tap pjk/libcbor +brew install libcbor