From 809c54f56b1a4d30d8c2d49e9c005f07c2d6c596 Mon Sep 17 00:00:00 2001 From: mdorf Date: Sun, 10 Dec 2023 12:16:46 -0800 Subject: [PATCH 1/7] Gemfile.lock update --- Gemfile.lock | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3a4a08fa..24a18424 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,28 +32,28 @@ GEM multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ansi (1.5.0) ast (2.4.2) - base64 (0.1.1) - bcrypt (3.1.19) + base64 (0.2.0) + bcrypt (3.1.20) + bigdecimal (3.1.4) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) connection_pool (2.4.1) cube-ruby (0.0.3) daemons (1.4.1) - date (3.3.3) + date (3.3.4) docile (1.4.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + domain_name (0.6.20231109) email_spec (2.2.2) htmlentities (~> 4.3.3) launchy (~> 2.1) mail (~> 2.7) eventmachine (1.2.7) - faraday (2.7.11) + faraday (2.7.12) base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) @@ -66,13 +66,13 @@ GEM domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.6.3) - json_pure (2.6.3) + json (2.7.1) + json_pure (2.7.1) language_server-protocol (3.17.0.3) launchy (2.5.2) addressable (~> 2.8) - libxml-ruby (4.1.1) - logger (1.5.3) + libxml-ruby (4.1.2) + logger (1.6.0) macaddr (1.7.2) systemu (~> 2.6.5) mail (2.8.1) @@ -83,7 +83,7 @@ GEM method_source (1.0.0) mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2023.1003) + mime-types-data (3.2023.1205) mini_mime (1.1.5) minitest (4.7.5) minitest-reporters (0.14.24) @@ -93,17 +93,18 @@ GEM powerbar multi_json (1.15.0) net-http-persistent (2.9.4) - net-imap (0.3.7) + net-imap (0.4.7) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout net-smtp (0.4.0) net-protocol netrc (0.11.0) - oj (3.16.1) + oj (3.16.2) + bigdecimal (~> 3.1) omni_logger (0.1.4) logger parallel (1.23.0) @@ -117,8 +118,8 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.3) - racc (1.7.2) + public_suffix (5.0.4) + racc (1.7.3) rack (2.2.8) rack-test (0.8.3) rack (>= 1.0, < 3) @@ -128,9 +129,9 @@ GEM addressable (>= 2.2) redis (5.0.8) redis-client (>= 0.17.0) - redis-client (0.18.0) + redis-client (0.19.0) connection_pool - regexp_parser (2.8.2) + regexp_parser (2.8.3) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) @@ -140,7 +141,7 @@ GEM rsolr (2.5.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) - rubocop (1.57.2) + rubocop (1.58.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -148,7 +149,7 @@ GEM rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) @@ -171,16 +172,14 @@ GEM eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) thread_safe (0.3.6) - timeout (0.4.0) + timeout (0.4.1) tzinfo (0.3.62) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) unicode-display_width (2.5.0) uuid (2.3.9) macaddr (~> 1.0) PLATFORMS + arm64-darwin-23 x86_64-darwin-18 DEPENDENCIES @@ -212,4 +211,4 @@ DEPENDENCIES thin BUNDLED WITH - 2.3.15 + 2.4.22 From 3884096f3f782ecec3bbf6feee235c28f1008e5d Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Mon, 11 Dec 2023 16:47:24 -0800 Subject: [PATCH 2/7] fail auth if `token` string is missing; fixes #178 --- lib/ontologies_linked_data/security/authorization.rb | 2 ++ test/rack/test_request_authorization.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/ontologies_linked_data/security/authorization.rb b/lib/ontologies_linked_data/security/authorization.rb index e64fe9f9..7e246326 100644 --- a/lib/ontologies_linked_data/security/authorization.rb +++ b/lib/ontologies_linked_data/security/authorization.rb @@ -78,6 +78,8 @@ def find_apikey(env, params) apikey = params["apikey"] elsif apikey.nil? && header_auth token = Rack::Utils.parse_query(header_auth.split(" ")[1]) + return unless token["token"] + # Strip spaces from start and end of string apikey = token["token"].gsub(/\"/, "") # If the user apikey is passed, use that instead diff --git a/test/rack/test_request_authorization.rb b/test/rack/test_request_authorization.rb index 0852a4c1..ff75bb7c 100644 --- a/test/rack/test_request_authorization.rb +++ b/test/rack/test_request_authorization.rb @@ -61,6 +61,8 @@ def _delete_user def test_authorize get "/ontologies" assert last_response.status == 401 + get "/ontologies", {}, {"Authorization" => "bogus auth header"} # W: Space inside } missing. + assert_equal 401, last_response.status get "/ontologies", {}, {"Authorization" => 'apikey token="'+@apikey+''+'"'} assert last_response.status == 200 apikey = MultiJson.load(last_response.body) From ee31d14cc6f67b794482fb03942878318b07963c Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Mon, 11 Dec 2023 17:34:15 -0800 Subject: [PATCH 3/7] minitest style guide: replace assert with assert_equal --- test/rack/test_request_authorization.rb | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/test/rack/test_request_authorization.rb b/test/rack/test_request_authorization.rb index ff75bb7c..c57cebc5 100644 --- a/test/rack/test_request_authorization.rb +++ b/test/rack/test_request_authorization.rb @@ -60,33 +60,32 @@ def _delete_user def test_authorize get "/ontologies" - assert last_response.status == 401 - get "/ontologies", {}, {"Authorization" => "bogus auth header"} # W: Space inside } missing. + assert_equal 401, last_response.status + get "/ontologies", {}, {"Authorization" => "bogus auth header"} assert_equal 401, last_response.status get "/ontologies", {}, {"Authorization" => 'apikey token="'+@apikey+''+'"'} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) assert @apikey.eql?(apikey) get "/ontologies", {}, {"Authorization" => "apikey token=#{@apikey}"} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @apikey.eql?(apikey) + assert_equal @apikey, apikey get "/ontologies?apikey=#{@apikey}" - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @apikey.eql?(apikey) + assert_equal @apikey, apikey get "/ontologies", {}, {"Authorization" => 'apikey token="'+@apikey+'&userapikey='+@userapikey+'"'} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @userapikey.eql?(apikey) + assert_equal @userapikey, apikey get "/ontologies", {}, {"Authorization" => "apikey token=#{@apikey}&userapikey=#{@userapikey}"} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @userapikey.eql?(apikey) + assert_equal @userapikey, apikey get "/ontologies?apikey=#{@apikey}&userapikey=#{@userapikey}" - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @userapikey.eql?(apikey) + assert_equal @userapikey, apikey end - end From 9e02e1dac3c764d6237711637edd90a14eb3cdd8 Mon Sep 17 00:00:00 2001 From: mdorf Date: Wed, 10 Jan 2024 11:40:01 -0800 Subject: [PATCH 4/7] implemented ncbo/ontologies_api#127 - Add API call to trigger ontology pull from remote location --- Gemfile.lock | 38 +++++++++---------- .../models/ontology_submission.rb | 5 +++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3a4a08fa..dec48d80 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,24 +36,23 @@ GEM public_suffix (>= 2.0.2, < 6.0) ansi (1.5.0) ast (2.4.2) - base64 (0.1.1) - bcrypt (3.1.19) + base64 (0.2.0) + bcrypt (3.1.20) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) connection_pool (2.4.1) cube-ruby (0.0.3) daemons (1.4.1) - date (3.3.3) + date (3.3.4) docile (1.4.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + domain_name (0.6.20231109) email_spec (2.2.2) htmlentities (~> 4.3.3) launchy (~> 2.1) mail (~> 2.7) eventmachine (1.2.7) - faraday (2.7.11) + faraday (2.7.12) base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) @@ -66,13 +65,13 @@ GEM domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.6.3) - json_pure (2.6.3) + json (2.7.1) + json_pure (2.7.1) language_server-protocol (3.17.0.3) launchy (2.5.2) addressable (~> 2.8) - libxml-ruby (4.1.1) - logger (1.5.3) + libxml-ruby (4.1.2) + logger (1.6.0) macaddr (1.7.2) systemu (~> 2.6.5) mail (2.8.1) @@ -83,7 +82,7 @@ GEM method_source (1.0.0) mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2023.1003) + mime-types-data (3.2023.1205) mini_mime (1.1.5) minitest (4.7.5) minitest-reporters (0.14.24) @@ -98,7 +97,7 @@ GEM net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout net-smtp (0.4.0) net-protocol @@ -117,8 +116,8 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.3) - racc (1.7.2) + public_suffix (5.0.4) + racc (1.7.3) rack (2.2.8) rack-test (0.8.3) rack (>= 1.0, < 3) @@ -130,7 +129,7 @@ GEM redis-client (>= 0.17.0) redis-client (0.18.0) connection_pool - regexp_parser (2.8.2) + regexp_parser (2.8.3) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) @@ -140,7 +139,7 @@ GEM rsolr (2.5.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) - rubocop (1.57.2) + rubocop (1.58.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -148,7 +147,7 @@ GEM rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) @@ -171,11 +170,8 @@ GEM eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) thread_safe (0.3.6) - timeout (0.4.0) + timeout (0.4.1) tzinfo (0.3.62) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) unicode-display_width (2.5.0) uuid (2.3.9) macaddr (~> 1.0) diff --git a/lib/ontologies_linked_data/models/ontology_submission.rb b/lib/ontologies_linked_data/models/ontology_submission.rb index 48365255..a0146920 100644 --- a/lib/ontologies_linked_data/models/ontology_submission.rb +++ b/lib/ontologies_linked_data/models/ontology_submission.rb @@ -147,6 +147,11 @@ def valid? return valid_result && sc end + def remote_pulled? + self.bring(:pullLocation) if self.bring?(:pullLocation) + self.pullLocation != nil + end + def sanity_check self.bring(:ontology) if self.bring?(:ontology) self.ontology.bring(:summaryOnly) if self.ontology.bring?(:summaryOnly) From 9c572adf87a44d484a81fd7cee617d7027bcf897 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Wed, 10 Jan 2024 16:24:59 -0800 Subject: [PATCH 5/7] set bundler version to be comptatible with ruby 2.7 --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index bbc327ce..ee764b87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,10 @@ COPY Gemfile* /srv/ontoportal/ontologies_linked_data/ WORKDIR /srv/ontoportal/ontologies_linked_data +# set rubygem and bundler to the last version supported by ruby 2.7 +# remove version after ruby v3 upgrade +RUN gem update --system '3.4.22' +RUN gem install bundler -v 2.4.22 RUN gem update --system RUN gem install bundler ENV BUNDLE_PATH=/srv/ontoportal/bundle From a679655311463b277814aff8d07229b46688a643 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 12 Jan 2024 13:15:41 -0800 Subject: [PATCH 6/7] use agraph v8.0.0 --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 912e2ce5..a0138615 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,8 +117,7 @@ services: retries: 5 agraph-ut: - # image: franzinc/agraph:v7.3.1 - image: ontoportal/agraph:v7.3.1-patch1 #in place untill agraph v7.4.0 is released + image: franzinc/agraph:v8.0.0 platform: linux/amd64 environment: - AGRAPH_SUPER_USER=test From 4b6b7f42882b9ad815ff5e90c354212aca085fda Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 12 Jan 2024 13:16:02 -0800 Subject: [PATCH 7/7] Gemfile.lock update --- Gemfile.lock | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fb06ff32..309d1ac5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/ncbo/goo.git - revision: 6db93bb3d5095a5fe0d017e572c5a04caa34ebc6 + revision: db2b330fb6c5fd4ea9ee17d5b58ca997f304a340 branch: develop specs: goo (0.0.2) @@ -93,7 +93,7 @@ GEM powerbar multi_json (1.15.0) net-http-persistent (2.9.4) - net-imap (0.3.7) + net-imap (0.4.9.1) date net-protocol net-pop (0.1.2) @@ -108,7 +108,7 @@ GEM omni_logger (0.1.4) logger parallel (1.24.0) - parser (3.3.0.2) + parser (3.3.0.3) ast (~> 2.4.1) racc pony (1.13.1) @@ -179,6 +179,8 @@ GEM macaddr (~> 1.0) PLATFORMS + aarch64-linux + arm64-darwin-22 x86_64-darwin-18 DEPENDENCIES @@ -210,4 +212,4 @@ DEPENDENCIES thin BUNDLED WITH - 2.3.15 + 2.3.22