aspera-cli 4.28.0 → 4.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/BUGS.md +5 -10
- data/CHANGELOG.md +143 -2
- data/CODE_OF_CONDUCT.md +18 -0
- data/CONTRIBUTING.md +135 -56
- data/GOVERNANCE.md +30 -0
- data/LICENSE +201 -0
- data/README.md +103 -26
- data/SECURITY.md +70 -0
- data/bin/ascli +8 -5
- data/bin/asession +9 -6
- data/docs/README.md +1633 -609
- data/docs/test-mcp-with-ai.md +8 -8
- data/lib/aspera/agent/base.rb +23 -2
- data/lib/aspera/agent/connect.rb +16 -12
- data/lib/aspera/agent/desktop.rb +10 -7
- data/lib/aspera/agent/direct.rb +20 -19
- data/lib/aspera/agent/factory.rb +6 -3
- data/lib/aspera/agent/httpgw.rb +7 -5
- data/lib/aspera/agent/node.rb +15 -7
- data/lib/aspera/agent/transferd.rb +167 -43
- data/lib/aspera/api/alee.rb +4 -1
- data/lib/aspera/api/aoc.rb +14 -11
- data/lib/aspera/api/ats.rb +4 -2
- data/lib/aspera/api/cos_node.rb +7 -4
- data/lib/aspera/api/faspex.rb +16 -9
- data/lib/aspera/api/httpgw.rb +9 -6
- data/lib/aspera/api/node.rb +20 -20
- data/lib/aspera/ascmd.rb +8 -5
- data/lib/aspera/ascp/installation.rb +71 -65
- data/lib/aspera/ascp/log.schema.yaml +1084 -0
- data/lib/aspera/ascp/log_analyzer/advice.rb +97 -0
- data/lib/aspera/ascp/log_analyzer/diagnostics.rb +344 -0
- data/lib/aspera/ascp/log_analyzer/lines.rb +75 -0
- data/lib/aspera/ascp/log_analyzer/log_file.rb +593 -0
- data/lib/aspera/ascp/log_analyzer/records.rb +379 -0
- data/lib/aspera/ascp/log_analyzer/rules.rb +172 -0
- data/lib/aspera/ascp/log_analyzer/session.rb +782 -0
- data/lib/aspera/ascp/log_analyzer.rb +354 -0
- data/lib/aspera/ascp/management.rb +16 -8
- data/lib/aspera/ascp/session_errors.rb +217 -0
- data/lib/aspera/assert.rb +4 -0
- data/lib/aspera/cli/ascp_actions.rb +12 -19
- data/lib/aspera/cli/ascp_logs_actions.rb +176 -0
- data/lib/aspera/cli/async_transfer_store.rb +7 -4
- data/lib/aspera/cli/bootstrapper.rb +37 -33
- data/lib/aspera/cli/command_line.rb +24 -6
- data/lib/aspera/cli/command_registry.rb +6 -1
- data/lib/aspera/cli/command_spec.rb +34 -7
- data/lib/aspera/cli/completion/ascli.bash +19 -5
- data/lib/aspera/cli/completion/ascli.fish +13 -2
- data/lib/aspera/cli/completion/ascli.ps1 +31 -9
- data/lib/aspera/cli/completion/ascli.zsh +22 -6
- data/lib/aspera/cli/completion_actions.rb +303 -69
- data/lib/aspera/cli/context.rb +9 -4
- data/lib/aspera/cli/deprecation.rb +5 -2
- data/lib/aspera/cli/error.rb +3 -0
- data/lib/aspera/cli/extended_value.rb +61 -27
- data/lib/aspera/cli/formatter.rb +29 -22
- data/lib/aspera/cli/gem_checker.rb +9 -6
- data/lib/aspera/cli/hints.rb +22 -10
- data/lib/aspera/cli/http.rb +12 -9
- data/lib/aspera/cli/info.rb +12 -7
- data/lib/aspera/cli/mailer.rb +6 -3
- data/lib/aspera/cli/mcp/http_servlet.rb +7 -8
- data/lib/aspera/cli/mcp/secrets.rb +8 -5
- data/lib/aspera/cli/mcp/tool.rb +15 -14
- data/lib/aspera/cli/option_declarator.rb +10 -4
- data/lib/aspera/cli/option_registry.rb +6 -3
- data/lib/aspera/cli/option_types.rb +17 -2
- data/lib/aspera/cli/option_value.rb +65 -12
- data/lib/aspera/cli/options.schema.yaml +487 -63
- data/lib/aspera/cli/parser.rb +56 -32
- data/lib/aspera/cli/plugins/alee.rb +7 -4
- data/lib/aspera/cli/plugins/aoc.rb +244 -35
- data/lib/aspera/cli/plugins/ats.rb +9 -8
- data/lib/aspera/cli/plugins/base.rb +17 -12
- data/lib/aspera/cli/plugins/basic_auth.rb +5 -2
- data/lib/aspera/cli/plugins/config.rb +198 -103
- data/lib/aspera/cli/plugins/console.rb +6 -3
- data/lib/aspera/cli/plugins/cos.rb +8 -4
- data/lib/aspera/cli/plugins/factory.rb +21 -7
- data/lib/aspera/cli/plugins/faspex5.rb +28 -25
- data/lib/aspera/cli/plugins/faspio.rb +7 -5
- data/lib/aspera/cli/plugins/httpgw.rb +7 -4
- data/lib/aspera/cli/plugins/mcp.rb +28 -22
- data/lib/aspera/cli/plugins/node.rb +31 -30
- data/lib/aspera/cli/plugins/oauth.rb +5 -1
- data/lib/aspera/cli/plugins/orchestrator.rb +272 -72
- data/lib/aspera/cli/plugins/preview.rb +69 -44
- data/lib/aspera/cli/plugins/server.rb +63 -11
- data/lib/aspera/cli/plugins/shares.rb +86 -16
- data/lib/aspera/cli/plugins/transferd.rb +223 -0
- data/lib/aspera/cli/preset_actions.rb +144 -30
- data/lib/aspera/cli/preset_manager.rb +52 -18
- data/lib/aspera/cli/prompt.rb +4 -1
- data/lib/aspera/cli/result.rb +12 -8
- data/lib/aspera/cli/runner.rb +69 -46
- data/lib/aspera/cli/secret_finder.rb +4 -1
- data/lib/aspera/cli/security.rb +79 -9
- data/lib/aspera/cli/special_values.rb +4 -1
- data/lib/aspera/cli/sync_actions.rb +13 -10
- data/lib/aspera/cli/table_fitter.rb +3 -0
- data/lib/aspera/cli/terminal_formatter.rb +9 -6
- data/lib/aspera/cli/transfer_actions.rb +11 -8
- data/lib/aspera/cli/transfer_agent.rb +29 -20
- data/lib/aspera/cli/transfer_progress.rb +13 -45
- data/lib/aspera/cli/vault_actions.rb +45 -0
- data/lib/aspera/cli/vault_manager.rb +188 -42
- data/lib/aspera/cli/version.rb +4 -1
- data/lib/aspera/cli/web_secret.rb +12 -10
- data/lib/aspera/cli/wizard.rb +42 -39
- data/lib/aspera/command_line_builder.rb +9 -5
- data/lib/aspera/command_line_converter.rb +4 -1
- data/lib/aspera/coverage.rb +103 -33
- data/lib/aspera/data_repository.rb +4 -1
- data/lib/aspera/dot_container.rb +4 -1
- data/lib/aspera/duration.rb +5 -2
- data/lib/aspera/environment.rb +21 -12
- data/lib/aspera/exec_spec.rb +3 -0
- data/lib/aspera/faspex_gw.rb +13 -9
- data/lib/aspera/faspex_postproc.rb +15 -12
- data/lib/aspera/formatter_interface.rb +4 -1
- data/lib/aspera/graphql.rb +5 -1
- data/lib/aspera/hash_ext.rb +3 -0
- data/lib/aspera/id_generator.rb +4 -2
- data/lib/aspera/json_rpc/client.rb +6 -5
- data/lib/aspera/json_rpc/version.rb +3 -0
- data/lib/aspera/line_logger.rb +4 -1
- data/lib/aspera/link_header.rb +4 -1
- data/lib/aspera/log.rb +18 -5
- data/lib/aspera/markdown.rb +5 -2
- data/lib/aspera/mime.rb +3 -0
- data/lib/aspera/nagios.rb +6 -4
- data/lib/aspera/node_emulator.rb +15 -13
- data/lib/aspera/oauth/client/base.rb +91 -70
- data/lib/aspera/oauth/client/boot.rb +7 -4
- data/lib/aspera/oauth/client/factory.rb +6 -3
- data/lib/aspera/oauth/client/generic.rb +5 -1
- data/lib/aspera/oauth/client/json_credentials.rb +4 -1
- data/lib/aspera/oauth/client/jwt.rb +6 -3
- data/lib/aspera/oauth/client/shares_web.rb +85 -0
- data/lib/aspera/oauth/client/url_json.rb +4 -1
- data/lib/aspera/oauth/client/web.rb +39 -12
- data/lib/aspera/oauth/server/pkce.rb +6 -5
- data/lib/aspera/orchestrator_workflow_checker.rb +119 -1
- data/lib/aspera/persistency_action_once.rb +5 -3
- data/lib/aspera/persistency_folder.rb +6 -3
- data/lib/aspera/preview/file_types.rb +6 -3
- data/lib/aspera/preview/generator.rb +9 -5
- data/lib/aspera/preview/options.schema.yaml +3 -3
- data/lib/aspera/preview/terminal.rb +8 -4
- data/lib/aspera/preview/utils.rb +6 -4
- data/lib/aspera/products/connect.rb +5 -2
- data/lib/aspera/products/desktop.rb +4 -1
- data/lib/aspera/products/other.rb +4 -2
- data/lib/aspera/products/transferd.rb +6 -2
- data/lib/aspera/products/transferd_service.rb +610 -0
- data/lib/aspera/proxy_auto_config.js +2 -2
- data/lib/aspera/proxy_auto_config.rb +5 -2
- data/lib/aspera/rainbow.rb +3 -0
- data/lib/aspera/rest/aspera_errors.rb +4 -1
- data/lib/aspera/rest/call_error.rb +3 -0
- data/lib/aspera/rest/client.rb +22 -29
- data/lib/aspera/rest/error_analyzer.rb +5 -2
- data/lib/aspera/rest/list.rb +8 -4
- data/lib/aspera/rest/parameters.rb +3 -0
- data/lib/aspera/rest/util.rb +8 -5
- data/lib/aspera/rest.rb +9 -6
- data/lib/aspera/schema/IBM Aspera Faspex API-5.0-enhanced.yaml +9 -9
- data/lib/aspera/schema/IBM Aspera Orchestrator API-v1-enhanced.yaml +118 -30
- data/lib/aspera/schema/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +11 -11
- data/lib/aspera/schema/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +2437 -1437
- data/lib/aspera/schema/async_tables.yaml +11 -10
- data/lib/aspera/schema/documentation.rb +8 -2
- data/lib/aspera/schema/reader.rb +7 -0
- data/lib/aspera/schema/registry.rb +43 -28
- data/lib/aspera/schema/transferd-config.schema.json +333 -0
- data/lib/aspera/schema/validator.rb +4 -1
- data/lib/aspera/sealed_hash.rb +166 -0
- data/lib/aspera/secret/hider.rb +201 -0
- data/lib/aspera/secret/reference.rb +150 -0
- data/lib/aspera/secret/resolver.rb +212 -0
- data/lib/aspera/secret/store/base.rb +153 -0
- data/lib/aspera/secret/store/encrypted_hash.rb +329 -0
- data/lib/aspera/secret/store/factory.rb +103 -0
- data/lib/aspera/secret/store/hashicorp_vault.rb +390 -0
- data/lib/aspera/secret/store/keeper.rb +141 -0
- data/lib/aspera/secret/store/macos_security.rb +284 -0
- data/lib/aspera/secret/store/one_password_api.rb +99 -0
- data/lib/aspera/secret/store/one_password_base.rb +42 -0
- data/lib/aspera/secret/store/one_password_cli.rb +110 -0
- data/lib/aspera/secret/store/secret_service.rb +125 -0
- data/lib/aspera/secret/strength.rb +119 -0
- data/lib/aspera/servlet_helpers.rb +5 -2
- data/lib/aspera/ssh.rb +10 -7
- data/lib/aspera/ssl.rb +5 -2
- data/lib/aspera/string_ext.rb +3 -0
- data/lib/aspera/sync/args.schema.yaml +3 -0
- data/lib/aspera/sync/conf.schema.yaml +9 -4
- data/lib/aspera/sync/database.rb +3 -0
- data/lib/aspera/sync/operations.rb +16 -14
- data/lib/aspera/temp_file_manager.rb +8 -4
- data/lib/aspera/timer_limiter.rb +3 -0
- data/lib/aspera/transfer/error.rb +4 -1
- data/lib/aspera/transfer/faux_file.rb +4 -1
- data/lib/aspera/transfer/parameters.rb +17 -14
- data/lib/aspera/transfer/result.rb +3 -0
- data/lib/aspera/transfer/resumer.rb +6 -4
- data/lib/aspera/transfer/spec.rb +9 -22
- data/lib/aspera/transfer/units.rb +75 -0
- data/lib/aspera/uri_reader.rb +57 -7
- data/lib/aspera/web_auth/index.html.erb +6 -2
- data/lib/aspera/web_auth/paste.rb +109 -0
- data/lib/aspera/web_auth/receiver.rb +50 -0
- data/lib/aspera/web_auth/relay.rb +76 -0
- data/lib/aspera/web_auth/reply.html.erb +150 -0
- data/lib/aspera/web_auth/server.rb +47 -10
- data/lib/aspera/web_page.rb +7 -2
- data/lib/aspera/web_server_simple.rb +6 -3
- data/lib/aspera/yaml.rb +5 -1
- data/llms.txt +81 -0
- data/skills/ascli/SKILL.md +88 -0
- data.tar.gz.sig +0 -0
- metadata +72 -19
- metadata.gz.sig +0 -0
- data/lib/aspera/keychain/base.rb +0 -30
- data/lib/aspera/keychain/encrypted_hash.rb +0 -192
- data/lib/aspera/keychain/factory.rb +0 -58
- data/lib/aspera/keychain/hashicorp_vault.rb +0 -77
- data/lib/aspera/keychain/macos_security.rb +0 -277
- data/lib/aspera/keychain/one_password_api.rb +0 -91
- data/lib/aspera/keychain/one_password_base.rb +0 -39
- data/lib/aspera/keychain/one_password_cli.rb +0 -100
- data/lib/aspera/secret_hider.rb +0 -196
- data/lib/aspera/secret_strength.rb +0 -114
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative 'base'
|
|
7
|
+
require_relative 'node'
|
|
8
|
+
require_relative '../error'
|
|
9
|
+
require_relative '../../api/cos_node'
|
|
10
|
+
require_relative '../../assert'
|
|
7
11
|
|
|
8
12
|
module Aspera
|
|
9
13
|
module Cli
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative '../../assert'
|
|
7
|
+
require_relative '../error'
|
|
8
|
+
require_relative '../security'
|
|
9
|
+
require_relative '../../environment'
|
|
10
|
+
require_relative '../../string_ext'
|
|
3
11
|
require 'singleton'
|
|
4
|
-
require 'aspera/assert'
|
|
5
|
-
require 'aspera/cli/error'
|
|
6
|
-
require 'aspera/environment'
|
|
7
|
-
require 'aspera/string_ext'
|
|
8
12
|
|
|
9
13
|
module Aspera
|
|
10
14
|
module Cli
|
|
@@ -20,6 +24,8 @@ module Aspera
|
|
|
20
24
|
|
|
21
25
|
def initialize
|
|
22
26
|
@lookup_folders = []
|
|
27
|
+
# Security level (see `Security`) of each folder: a plugin is code
|
|
28
|
+
@folder_security = {}
|
|
23
29
|
# information on plugins
|
|
24
30
|
@plugins = {}
|
|
25
31
|
end
|
|
@@ -31,8 +37,12 @@ module Aspera
|
|
|
31
37
|
|
|
32
38
|
# add a folder to the list of folders to look for plugins
|
|
33
39
|
# (absolute, as `require` resolves a relative path against $LOAD_PATH)
|
|
34
|
-
|
|
40
|
+
# @param folder [String] Folder
|
|
41
|
+
# @param security [Symbol, nil] Most restrictive security level at which plugins of this folder are used, `nil` for all levels (folder of the gem).
|
|
42
|
+
# A folder that a user or a client can write is `:low`: a file written there would be loaded as code.
|
|
43
|
+
def add_lookup_folder(folder, security: nil)
|
|
35
44
|
folder = File.expand_path(folder)
|
|
45
|
+
@folder_security[folder] = security
|
|
36
46
|
@lookup_folders.unshift(folder) unless @lookup_folders.include?(folder)
|
|
37
47
|
end
|
|
38
48
|
|
|
@@ -40,6 +50,8 @@ module Aspera
|
|
|
40
50
|
def add_plugins_from_lookup_folders
|
|
41
51
|
@lookup_folders.each do |folder|
|
|
42
52
|
next unless File.directory?(folder)
|
|
53
|
+
# Plugins registered at start (level low) stay, but files that appear later are not
|
|
54
|
+
next unless Security.instance.allowed?(@folder_security[folder])
|
|
43
55
|
# TODO: add gem root to load path ? and require short folder ?
|
|
44
56
|
# $LOAD_PATH.push(folder) if i[:add_path]
|
|
45
57
|
Dir.children(folder).each do |source|
|
|
@@ -49,7 +61,7 @@ module Aspera
|
|
|
49
61
|
next if IGNORE_PLUGINS.include?(plugin_symbol)
|
|
50
62
|
req = path.sub(/#{Environment::RB_EXT}$/o, '')
|
|
51
63
|
next if @plugins.key?(plugin_symbol)
|
|
52
|
-
@plugins[plugin_symbol] = {source: path, require_stanza: req}
|
|
64
|
+
@plugins[plugin_symbol] = {source: path, require_stanza: req, security: @folder_security[folder]}
|
|
53
65
|
end
|
|
54
66
|
end
|
|
55
67
|
end
|
|
@@ -63,6 +75,8 @@ module Aspera
|
|
|
63
75
|
# @return [Class] class object for plugin
|
|
64
76
|
def plugin_class(plugin_name_sym)
|
|
65
77
|
Aspera.assert(@plugins.key?(plugin_name_sym), type: NoSuchElement) { "plugin not found: #{plugin_name_sym}" }
|
|
78
|
+
# A plugin registered at start can be replaced by a file written since: it is code
|
|
79
|
+
Security.instance.check_level(@plugins[plugin_name_sym][:security], "plugin #{plugin_name_sym}")
|
|
66
80
|
require @plugins[plugin_name_sym][:require_stanza]
|
|
67
81
|
# Module.nesting[1] is Aspera::Cli::Plugins
|
|
68
82
|
return Object.const_get("#{Module.nesting[1]}::#{plugin_name_sym.to_s.snake_to_capital}")
|
|
@@ -76,7 +90,7 @@ module Aspera
|
|
|
76
90
|
plugin_class(plugin_name_sym).new(**args)
|
|
77
91
|
end
|
|
78
92
|
|
|
79
|
-
IGNORE_PLUGINS = %i[factory base basic_auth oauth]
|
|
93
|
+
IGNORE_PLUGINS = %i[factory base basic_auth oauth].freeze
|
|
80
94
|
private_constant :IGNORE_PLUGINS
|
|
81
95
|
end
|
|
82
96
|
end
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
3
6
|
# spellchecker: ignore workgroups mypackages passcode
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
require_relative '../../schema/registry'
|
|
9
|
+
require_relative 'oauth'
|
|
10
|
+
require_relative '../extended_value'
|
|
11
|
+
require_relative '../formatter'
|
|
12
|
+
require_relative '../../transfer/result'
|
|
13
|
+
require_relative '../special_values'
|
|
14
|
+
require_relative '../wizard'
|
|
15
|
+
require_relative '../../api/faspex'
|
|
16
|
+
require_relative '../../persistency_action_once'
|
|
17
|
+
require_relative '../../id_generator'
|
|
18
|
+
require_relative '../../nagios'
|
|
19
|
+
require_relative '../../environment'
|
|
20
|
+
require_relative '../../assert'
|
|
21
|
+
require_relative '../../rainbow'
|
|
18
22
|
require 'securerandom'
|
|
19
23
|
require 'digest'
|
|
20
24
|
require 'json'
|
|
21
|
-
require 'aspera/rainbow'
|
|
22
25
|
using Rainbow
|
|
23
26
|
|
|
24
27
|
module Aspera
|
|
@@ -79,7 +82,7 @@ module Aspera
|
|
|
79
82
|
end
|
|
80
83
|
wiz_username = options.get_option(:username, mandatory: true)
|
|
81
84
|
wizard.check_email(wiz_username)
|
|
82
|
-
|
|
85
|
+
private_key = wizard.ask_private_key(
|
|
83
86
|
user: wiz_username,
|
|
84
87
|
url: app_url,
|
|
85
88
|
page: [Environment.char('👤'), 'Account Settings', 'Preferences', 'Public Key in PEM']
|
|
@@ -90,7 +93,7 @@ module Aspera
|
|
|
90
93
|
url: app_url,
|
|
91
94
|
username: wiz_username,
|
|
92
95
|
auth: :jwt.to_s,
|
|
93
|
-
private_key:
|
|
96
|
+
private_key: private_key,
|
|
94
97
|
client_id: client_id,
|
|
95
98
|
client_secret: client_secret
|
|
96
99
|
},
|
|
@@ -109,9 +112,8 @@ module Aspera
|
|
|
109
112
|
Aspera.assert_type(parameters[type], Array) { type }
|
|
110
113
|
recipient_types = Api::Faspex::RECIPIENT_TYPES
|
|
111
114
|
if parameters.key?('recipient_types')
|
|
112
|
-
recipient_types = parameters
|
|
113
|
-
|
|
114
|
-
recipient_types = [recipient_types] unless recipient_types.is_a?(Array)
|
|
115
|
+
recipient_types = Array(parameters.delete('recipient_types'))
|
|
116
|
+
Aspera.assert_array_all(recipient_types, String) { 'recipient_types' }
|
|
115
117
|
end
|
|
116
118
|
parameters[type].map! do |recipient_data|
|
|
117
119
|
# If just a string, make a general lookup and build expected name/type hash
|
|
@@ -251,7 +253,7 @@ module Aspera
|
|
|
251
253
|
Log.dump(:package_ids, level: :trace1) { packages.map { |p| p['id'] } }
|
|
252
254
|
else
|
|
253
255
|
# a single id was provided, or a list of ids
|
|
254
|
-
package_ids =
|
|
256
|
+
package_ids = Array(package_ids)
|
|
255
257
|
Aspera.assert_array_all(package_ids, String) { 'Package id(s)' }
|
|
256
258
|
# packages = package_ids.map{|pkg_id|api_v5.read("packages/#{pkg_id}")}
|
|
257
259
|
packages = package_ids.map { |pkg_id| {'id'=>pkg_id} }
|
|
@@ -530,7 +532,7 @@ module Aspera
|
|
|
530
532
|
command :shared_folders, description: 'Browse shared folders'
|
|
531
533
|
command :gateway, description: 'Start Faspex 4 gateway emulation',
|
|
532
534
|
arguments: [{name: :parameters, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::GATEWAY_OPTIONS}]
|
|
533
|
-
command :postprocessing, description: 'Start Faspex 4 post-processing server',
|
|
535
|
+
command :postprocessing, description: 'Start Faspex 4 post-processing server', security: :low,
|
|
534
536
|
arguments: [{name: :parameters, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::POSTPROC_OPTIONS}]
|
|
535
537
|
command :invitations, description: 'Manage invitations'
|
|
536
538
|
|
|
@@ -833,7 +835,8 @@ module Aspera
|
|
|
833
835
|
# @param users [Array] raw user ids or percent-selector strings
|
|
834
836
|
# @return [Array<String>] resolved user ids
|
|
835
837
|
def resolve_member_user_ids(users)
|
|
836
|
-
users =
|
|
838
|
+
users = Array(users)
|
|
839
|
+
Aspera.assert_array_all(users, String) { 'users' }
|
|
837
840
|
users.map do |user|
|
|
838
841
|
if (m = Parser.percent_selector(user))
|
|
839
842
|
api_v5.lookup_entity_by_field(entity: 'accounts', field: m[:field], value: m[:value], query: Rest.php_style({type: ACCOUNT_TYPES}))['id']
|
|
@@ -977,20 +980,20 @@ module Aspera
|
|
|
977
980
|
end
|
|
978
981
|
|
|
979
982
|
def action_gateway(parameters: {}, **)
|
|
980
|
-
|
|
983
|
+
require_relative '../../faspex_gw'
|
|
981
984
|
Faspex4GWServlet.serve(parameters.symbolize_keys, type: Cli::BadArgument) { [api_v5, nil] }
|
|
982
985
|
Result::Status.new('Gateway terminated')
|
|
983
986
|
end
|
|
984
987
|
|
|
985
988
|
def action_postprocessing(parameters: {}, **)
|
|
986
|
-
|
|
989
|
+
require_relative '../../faspex_postproc'
|
|
987
990
|
Faspex4PostProcServlet.serve(parameters.symbolize_keys, type: Cli::BadArgument)
|
|
988
991
|
Result::Status.new('Post-processing terminated')
|
|
989
992
|
end
|
|
990
993
|
ACCOUNT_TYPES = %w{local_user saml_user self_registered_user external_user}.freeze
|
|
991
994
|
WORKGROUP_TYPES = %w{workgroup shared_inbox}.freeze
|
|
992
995
|
CONTACT_TYPES = (WORKGROUP_TYPES + %w{distribution_list user external_user}).freeze
|
|
993
|
-
PACKAGE_RECIPIENT_TYPES = %i{recipients private_recipients notified_on_upload notified_on_download notified_on_receipt}
|
|
996
|
+
PACKAGE_RECIPIENT_TYPES = %i{recipients private_recipients notified_on_upload notified_on_download notified_on_receipt}.freeze
|
|
994
997
|
private_constant :ACCOUNT_TYPES, :CONTACT_TYPES, :PACKAGE_RECIPIENT_TYPES,
|
|
995
998
|
:CRUD_NO_SHOW, :CRUD_NO_LIST
|
|
996
999
|
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative '../../rest'
|
|
7
|
+
require_relative '../../nagios'
|
|
8
|
+
require_relative 'basic_auth'
|
|
6
9
|
|
|
7
10
|
module Aspera
|
|
8
11
|
module Cli
|
|
@@ -46,8 +49,7 @@ module Aspera
|
|
|
46
49
|
when :jwt
|
|
47
50
|
client_id = options.get_option(:client_id, mandatory: true)
|
|
48
51
|
preset_value[:client_id] = client_id
|
|
49
|
-
|
|
50
|
-
preset_value[:private_key] = key_path ? "@file:#{key_path}" : options.get_option(:private_key, mandatory: true)
|
|
52
|
+
preset_value[:private_key] = options.get_option(:private_key, mandatory: true)
|
|
51
53
|
passphrase = options.get_option(:passphrase)
|
|
52
54
|
preset_value[:passphrase] = passphrase unless passphrase.nil?
|
|
53
55
|
preset_ids.push(client_id)
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative 'base'
|
|
7
|
+
require_relative '../../rest'
|
|
8
|
+
require_relative '../../api/httpgw'
|
|
9
|
+
require_relative '../../nagios'
|
|
7
10
|
|
|
8
11
|
module Aspera
|
|
9
12
|
module Cli
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
require_relative 'base'
|
|
7
|
+
require_relative '../info'
|
|
8
|
+
require_relative '../version'
|
|
9
|
+
require_relative '../../oauth/server/pkce'
|
|
10
|
+
require_relative '../security'
|
|
11
|
+
require_relative '../deprecation'
|
|
12
|
+
require_relative '../../secret/strength'
|
|
12
13
|
require 'securerandom'
|
|
13
14
|
|
|
14
15
|
module Aspera
|
|
@@ -96,17 +97,22 @@ module Aspera
|
|
|
96
97
|
cleanup → ["config", "transfer", "cleanup"]
|
|
97
98
|
|
|
98
99
|
ORCHESTRATOR WORKFLOW DEVELOPMENT
|
|
99
|
-
Before writing or modifying an Orchestrator workflow, read the
|
|
100
|
-
|
|
101
|
-
["orchestrator", "workflows", "development", "authoring"]
|
|
100
|
+
Before writing or modifying an Orchestrator workflow, read the development guide (large: read
|
|
101
|
+
sections, not the whole document). Start with the sections "quick-start" and "authoring-checklist":
|
|
102
|
+
["orchestrator", "workflows", "development", "guide", "section", "authoring-checklist"]
|
|
103
|
+
then the sections you need (file format, graph, inputs of steps, execution, recipes, known issues):
|
|
104
|
+
"workflow-file", "graph-xml", "inputs-of-a-step", "execution", "recipes", "known-issues".
|
|
105
|
+
Command "toc" lists the anchors of the sections of a document, up to a default level, or the level
|
|
106
|
+
given after it:
|
|
107
|
+
["orchestrator", "workflows", "development", "guide", "toc"]
|
|
102
108
|
For the template attributes (allowed values), inputs and outputs of an action plugin, and the
|
|
103
109
|
template settings they depend on, read its specification (fields: section "plugin-specifications"
|
|
104
|
-
of the
|
|
105
|
-
["orchestrator", "plugins", "spec", "<PluginClass>"]
|
|
110
|
+
of the development guide); the list of plugins is given by ["orchestrator", "plugins", "spec", "toc"]:
|
|
111
|
+
["orchestrator", "plugins", "spec", "show", "<PluginClass>"]
|
|
106
112
|
For the functional description and the setup of a plugin (for example the API client of Faspex),
|
|
107
|
-
read its section of the Plugin Manual (large: read one section)
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
read its section of the Plugin Manual (large: read one section only). The anchor of the section is
|
|
114
|
+
field "manual_anchor" of the specification of the plugin (also in the list of plugins):
|
|
115
|
+
["orchestrator", "workflows", "development", "manual", "section", "<manual_anchor>"]
|
|
110
116
|
Before importing a workflow file, check it (graph, templates, inputs of steps) and fix all errors:
|
|
111
117
|
["orchestrator", "workflows", "check_import", "<file>"]
|
|
112
118
|
INST
|
|
@@ -136,8 +142,8 @@ module Aspera
|
|
|
136
142
|
arguments: [{name: :mcp_options, type: [Hash], mandatory: false, schema: 'opts:components.schemas.McpServerOptions'}]
|
|
137
143
|
|
|
138
144
|
def action_server(mcp_options: nil, **)
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
require_relative '../mcp/tool'
|
|
146
|
+
require_relative '../extended_value'
|
|
141
147
|
mcp_options = (mcp_options || {}).transform_keys(&:to_sym)
|
|
142
148
|
unknown = mcp_options.keys - SERVER_KEYS - CONFIG_KEYS - STDIO_KEYS - HTTP_KEYS - HTTP_SERVER_KEYS - TOOL_KEYS - %i[transport]
|
|
143
149
|
Aspera.assert(unknown.empty?, type: Cli::BadArgument) { "Unknown MCP option(s): #{unknown.join(', ')}" }
|
|
@@ -241,16 +247,16 @@ module Aspera
|
|
|
241
247
|
# On an address that is not loopback, `auth_token` is mandatory, also with OAuth:
|
|
242
248
|
# it is the secret asked on the consent page, else anyone could approve its own client.
|
|
243
249
|
def start_http_transport(server, mcp_options)
|
|
244
|
-
|
|
245
|
-
|
|
250
|
+
require_relative '../mcp/http_servlet'
|
|
251
|
+
require_relative '../../web_server_simple'
|
|
246
252
|
parameters = http_server_parameters(mcp_options)
|
|
247
253
|
uri = WebServerSimple.url(parameters)
|
|
248
254
|
auth_token = mcp_options[:auth_token]
|
|
249
255
|
oauth_enabled = mcp_options.fetch(:oauth, false)
|
|
250
256
|
access_token_ttl = mcp_options.fetch(:oauth_access_token_ttl, OAuth::Server::Pkce.default_access_token_ttl)
|
|
251
257
|
refresh_token_ttl = mcp_options.fetch(:oauth_refresh_token_ttl, OAuth::Server::Pkce.default_refresh_token_ttl)
|
|
252
|
-
min_bits = mcp_options.fetch(:auth_token_min_bits,
|
|
253
|
-
|
|
258
|
+
min_bits = mcp_options.fetch(:auth_token_min_bits, Secret::Strength::DEFAULT_MIN_BITS)
|
|
259
|
+
Secret::Strength.assert_strong(auth_token, name: 'auth_token', min_bits: min_bits, type: Cli::BadArgument) unless auth_token.nil?
|
|
254
260
|
base_url = http_base_url(uri, mcp_options[:public_url], oauth_enabled)
|
|
255
261
|
what = "auth_token#{' (asked on the consent page)' if oauth_enabled}"
|
|
256
262
|
# Clients reach the server at public_url (e.g. through a reverse proxy), whatever the address it listens on
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
# cspell:ignore asperabrowserurl
|
|
7
|
+
require_relative '../../schema/registry'
|
|
8
|
+
require_relative '../../sealed_hash'
|
|
9
|
+
require_relative 'basic_auth'
|
|
10
|
+
require_relative '../sync_actions'
|
|
11
|
+
require_relative '../special_values'
|
|
12
|
+
require_relative '../../transfer/spec'
|
|
13
|
+
require_relative '../../nagios'
|
|
14
|
+
require_relative '../../hash_ext'
|
|
15
|
+
require_relative '../../id_generator'
|
|
16
|
+
require_relative '../../api/node'
|
|
17
|
+
require_relative '../../oauth/client/factory'
|
|
18
|
+
require_relative '../../rest/list'
|
|
19
|
+
require_relative '../../assert'
|
|
16
20
|
require 'base64'
|
|
17
|
-
require 'zlib'
|
|
18
21
|
|
|
19
22
|
module Aspera
|
|
20
23
|
module Cli
|
|
@@ -73,7 +76,7 @@ module Aspera
|
|
|
73
76
|
# DSL option declarations - at class level, picked up by Base#initialize via ancestor chain.
|
|
74
77
|
# Included by other plugins (Ats, Cos, Aoc) via `use_options Node`.
|
|
75
78
|
option :validator, description: 'Identifier of validator (optional for central)'
|
|
76
|
-
option :asperabrowserurl, description: 'URL
|
|
79
|
+
option :asperabrowserurl, description: 'URL of Aspera Browser, web application to browse the node', default: 'https://laurent-martin.github.io/aspera-browser-react/'
|
|
77
80
|
option :node_api, description: 'Gen4: standard_ports: Use standard FASP ports (true) or get from node API (false). cache: Set to false to force actual file system read',
|
|
78
81
|
allowed: Hash, on_set: Api::Node.method(:api_options=)
|
|
79
82
|
option :root_id, description: 'Gen4: File id of top folder when using access key (override AK root id)'
|
|
@@ -579,7 +582,7 @@ module Aspera
|
|
|
579
582
|
arguments: [{name: :file, type: Hash, mandatory: false, default: nil}]
|
|
580
583
|
end
|
|
581
584
|
# Standalone leaf commands
|
|
582
|
-
command :asperabrowser, description: 'Open Aspera
|
|
585
|
+
command :asperabrowser, description: 'Open Aspera Browser on this node (the password is optional: it is then entered in the application)'
|
|
583
586
|
command :basic_token, description: 'Generate basic auth token', action: ->(**) { Result::Text.new(Rest.basic_authorization(options.get_option(:username, mandatory: true), options.get_option(:password, mandatory: true))) }
|
|
584
587
|
command(
|
|
585
588
|
:bearer_token, description: 'Generate bearer token',
|
|
@@ -777,7 +780,7 @@ module Aspera
|
|
|
777
780
|
# access_keys > do > show
|
|
778
781
|
def action_access_keys_do_show(path:, do_root_file_id:, **)
|
|
779
782
|
apifid = apifid_from_path(do_root_file_id, path)
|
|
780
|
-
Result::SingleObject.new(apifid.node_api.read("files/#{apifid.file_id}"))
|
|
783
|
+
Result::SingleObject.new(apifid.node_api.read("files/#{apifid.file_id}", headers: Api::Node.add_cache_control))
|
|
781
784
|
end
|
|
782
785
|
|
|
783
786
|
# access_keys > do > modify
|
|
@@ -790,7 +793,7 @@ module Aspera
|
|
|
790
793
|
# access_keys > do > thumbnail
|
|
791
794
|
def action_access_keys_do_thumbnail(path:, do_root_file_id:, **)
|
|
792
795
|
apifid = apifid_from_path(do_root_file_id, path)
|
|
793
|
-
Result::Image.new(apifid.node_api.read("files/#{apifid.file_id}/preview", headers: {'Accept' => 'image/png'}, ret: :resp).body)
|
|
796
|
+
Result::Image.new(apifid.node_api.read("files/#{apifid.file_id}/preview", headers: Api::Node.add_cache_control({'Accept' => 'image/png'}), ret: :resp).body)
|
|
794
797
|
end
|
|
795
798
|
|
|
796
799
|
# access_keys > do > rename
|
|
@@ -1122,19 +1125,19 @@ module Aspera
|
|
|
1122
1125
|
def action_asperabrowser(**)
|
|
1123
1126
|
browse_params = {
|
|
1124
1127
|
'nodeUser' => options.get_option(:username, mandatory: true),
|
|
1125
|
-
'nodePW' => options.get_option(:password
|
|
1128
|
+
'nodePW' => options.get_option(:password),
|
|
1126
1129
|
'nodeURL' => options.get_option(:url, mandatory: true)
|
|
1127
|
-
}
|
|
1128
|
-
#
|
|
1129
|
-
encoded_params =
|
|
1130
|
-
Environment.instance.open_uri("#{options.get_option(:asperabrowserurl)}
|
|
1130
|
+
}.reject { |_key, value| value.to_s.empty? }
|
|
1131
|
+
# Not encrypted (decoded by the web application), in the fragment: it is not sent to the web server
|
|
1132
|
+
encoded_params = SealedHash.seal(browse_params, encrypt: false, reverse: true)
|
|
1133
|
+
Environment.instance.open_uri("#{options.get_option(:asperabrowserurl)}##{URI.encode_www_form(goto: encoded_params)}")
|
|
1131
1134
|
return Result::Status.new('done')
|
|
1132
1135
|
end
|
|
1133
1136
|
|
|
1134
1137
|
def action_emulator(parameters: {}, **)
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
+
require_relative '../../secret/strength'
|
|
1139
|
+
require_relative '../../web_server_simple'
|
|
1140
|
+
require_relative '../../node_emulator'
|
|
1138
1141
|
# missing parameters take the default of the schema
|
|
1139
1142
|
defaults = Schema::Registry.instance.reader(Schema::Registry::NODE_EMULATOR_OPTIONS).current['properties'].each_with_object({}) do |(name, property), result|
|
|
1140
1143
|
result[name.to_sym] = property['default'] if property.key?('default')
|
|
@@ -1145,7 +1148,7 @@ module Aspera
|
|
|
1145
1148
|
retention_sec = config.delete(:retention_sec)
|
|
1146
1149
|
password_min_bits = config.delete(:password_min_bits)
|
|
1147
1150
|
Aspera.assert(config[:username].nil? == config[:password].nil?, type: Cli::BadArgument) { 'Parameters username and password must be set together' }
|
|
1148
|
-
|
|
1151
|
+
Secret::Strength.assert_strong(config[:password], name: 'password', min_bits: password_min_bits, type: Cli::BadArgument) unless config[:password].nil?
|
|
1149
1152
|
# Files of the docroot can be sent to, or received from, any host by anyone who can reach the server
|
|
1150
1153
|
WebServerSimple.serve(parameters, NodeEmulatorServlet, protected: !config[:username].nil?, what: 'username and password', type: Cli::BadArgument) do
|
|
1151
1154
|
Log.log.warn('No username and password: emulator accepts requests without authentication') if config[:username].nil?
|
|
@@ -1155,10 +1158,8 @@ module Aspera
|
|
|
1155
1158
|
end
|
|
1156
1159
|
|
|
1157
1160
|
def action_telemetry(parameters: {}, **)
|
|
1161
|
+
# `url` and `key` are required by the schema
|
|
1158
1162
|
parameters = parameters.symbolize_keys
|
|
1159
|
-
%i[url key].each do |psym|
|
|
1160
|
-
Aspera.assert(parameters.key?(psym), type: Cli::BadArgument) { "Missing parameter: #{psym}" }
|
|
1161
|
-
end
|
|
1162
1163
|
require 'socket'
|
|
1163
1164
|
parameters[:interval] = 10 unless parameters.key?(:interval)
|
|
1164
1165
|
parameters[:hostname] = Socket.gethostname unless parameters.key?(:hostname)
|