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,7 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative 'error'
|
|
7
|
+
require_relative '../assert'
|
|
5
8
|
|
|
6
9
|
module Aspera
|
|
7
10
|
module Cli
|
|
@@ -77,6 +80,18 @@ module Aspera
|
|
|
77
80
|
STRING = [String].freeze
|
|
78
81
|
end
|
|
79
82
|
|
|
83
|
+
# Values proposed by shell completion for an option, an argument or a schema key (`complete:`, `x-cli-complete`),
|
|
84
|
+
# when they are not a list of allowed values:
|
|
85
|
+
# - `file`: local file or folder
|
|
86
|
+
# - `folder`: local folder
|
|
87
|
+
# - `destination_folder`: local folder, unless the command sends files (the destination is then remote)
|
|
88
|
+
# - `preset`: name of option preset
|
|
89
|
+
# - `preset_parameter`: parameter of the option preset given as first argument of the command
|
|
90
|
+
# - `transfer_job`: identifier of an asynchronous transfer job
|
|
91
|
+
module Complete
|
|
92
|
+
KINDS = %i[file folder destination_folder preset preset_parameter transfer_job].freeze
|
|
93
|
+
end
|
|
94
|
+
|
|
80
95
|
# Sources of option values.
|
|
81
96
|
# A value is ignored if the option was already set from a source with higher priority.
|
|
82
97
|
module OptionSource
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative 'option_types'
|
|
7
|
+
require_relative 'extended_value'
|
|
8
|
+
require_relative 'security'
|
|
9
|
+
require_relative 'deprecation'
|
|
10
|
+
require_relative '../secret/hider'
|
|
11
|
+
require_relative '../schema/registry'
|
|
12
|
+
require_relative '../schema/validator'
|
|
13
|
+
require_relative '../log'
|
|
14
|
+
require_relative '../assert'
|
|
11
15
|
|
|
12
16
|
module Aspera
|
|
13
17
|
module Cli
|
|
@@ -22,6 +26,12 @@ module Aspera
|
|
|
22
26
|
# [Symbol, nil] `OptionSource` of current value, `nil` if never set
|
|
23
27
|
attr_reader :source
|
|
24
28
|
attr_reader :sensitive, :schema, :deprecation
|
|
29
|
+
# [Symbol, nil] Most restrictive security level at which the option is available, `nil`: all levels, see `Security`
|
|
30
|
+
attr_reader :security
|
|
31
|
+
# [String, nil] For a `Hash` option: key of a `String` value
|
|
32
|
+
attr_reader :shorthand
|
|
33
|
+
# [Symbol, nil] Values proposed by shell completion, one of `Complete::KINDS`
|
|
34
|
+
attr_reader :complete
|
|
25
35
|
# [Array] List of allowed values (Symbols and specific values)
|
|
26
36
|
attr_accessor :values
|
|
27
37
|
# [String] Help section group name (set by OptionRegistry)
|
|
@@ -36,14 +46,17 @@ module Aspera
|
|
|
36
46
|
# @param allowed [nil,Class,Array<Class>,Array<Symbol>] Allowed values
|
|
37
47
|
# @param on_set [#call, nil] Called with the new value each time the value is set
|
|
38
48
|
# @param shorthand [String, nil] For a `Hash` option: a `String` value is stored as `{shorthand => value}`
|
|
49
|
+
# @param convert [#call, nil] For a `Hash` option: called with a new `Hash` value, returns the value to store, before merge (e.g. conversion of a deprecated form)
|
|
39
50
|
# @param deprecation [Hash, Deprecation, nil] Deprecation: `{last:, message:}`, see `Deprecation`
|
|
40
51
|
# @param schema [String] Declaration of schema
|
|
52
|
+
# @param complete [Symbol, nil] Values proposed by shell completion, one of `Complete::KINDS`
|
|
53
|
+
# @param security [Symbol, nil] Most restrictive security level at which the option is available (e.g. `:low`: executes code), see `Security`
|
|
41
54
|
# `allowed`:
|
|
42
55
|
# - `nil` No validation, so just a string
|
|
43
56
|
# - `Class` The single allowed Class
|
|
44
57
|
# - `Array<Class>` Multiple allowed classes
|
|
45
58
|
# - `Array<Symbol>` List of allowed values
|
|
46
|
-
def initialize(option:, description: nil, allowed: Type::STRING, on_set: nil, shorthand: nil, deprecation: nil, schema: nil)
|
|
59
|
+
def initialize(option:, description: nil, allowed: Type::STRING, on_set: nil, shorthand: nil, convert: nil, deprecation: nil, schema: nil, complete: nil, security: nil)
|
|
47
60
|
Log.log.trace1 { "option: #{option}, allowed: #{allowed}" }
|
|
48
61
|
@option = option
|
|
49
62
|
@description = description
|
|
@@ -51,10 +64,16 @@ module Aspera
|
|
|
51
64
|
@short = nil
|
|
52
65
|
@block = nil
|
|
53
66
|
# by default passwords and secrets are sensitive, else specify when declaring the option
|
|
54
|
-
@sensitive =
|
|
67
|
+
@sensitive = Secret::Hider.instance.secret?(@option, '')
|
|
55
68
|
@deprecation = Deprecation.create(deprecation)
|
|
56
69
|
@schema = schema
|
|
57
70
|
@shorthand = shorthand
|
|
71
|
+
Aspera.assert(convert.nil? || convert.respond_to?(:call)) { "#{@option}: convert must respond to call" }
|
|
72
|
+
@convert = convert
|
|
73
|
+
Aspera.assert_values(complete, Complete::KINDS + [nil]) { "#{@option}: complete" }
|
|
74
|
+
@complete = complete
|
|
75
|
+
Aspera.assert_values(security, Security::LEVELS + [nil]) { "#{@option}: security" }
|
|
76
|
+
@security = security
|
|
58
77
|
@source = nil
|
|
59
78
|
@value = nil
|
|
60
79
|
Aspera.assert(on_set.nil? || on_set.respond_to?(:call)) { "#{@option}: on_set callback must respond to call" }
|
|
@@ -121,6 +140,8 @@ module Aspera
|
|
|
121
140
|
return
|
|
122
141
|
end
|
|
123
142
|
Aspera.assert(!@deprecation, type: :warn) { "Option #{@option} is #{@deprecation}" } if warn_deprecation
|
|
143
|
+
# Values set by the program itself are not restricted: those from command line, preset, environment are
|
|
144
|
+
Security.instance.check_level(@security, "option #{@option}") if restricted_source?(source)
|
|
124
145
|
if schema_request?(value)
|
|
125
146
|
return if lower
|
|
126
147
|
raise SchemaRequest.new(:option, @option, @schema) unless @schema.nil?
|
|
@@ -129,9 +150,11 @@ module Aspera
|
|
|
129
150
|
return
|
|
130
151
|
end
|
|
131
152
|
new_value = coerce(ExtendedValue.instance.evaluate(value, context: "option: #{@option}", allowed: @types))
|
|
153
|
+
check_sub_options_security(new_value) if restricted_source?(source)
|
|
132
154
|
new_value = {@shorthand => new_value} if @shorthand && new_value.is_a?(String)
|
|
133
155
|
Log.log.trace1 { "#{source}: #{@option} <- (#{new_value.class})#{new_value}" }
|
|
134
156
|
Aspera.assert_type(new_value, *@types, type: BadArgument) { "Option #{@option}" } if @types
|
|
157
|
+
new_value = @convert.call(new_value) if @convert && new_value.is_a?(Hash)
|
|
135
158
|
if merge && (new_value.is_a?(Hash) || new_value.is_a?(Array))
|
|
136
159
|
current_value = @value
|
|
137
160
|
# An `Array` default value is replaced, not appended to
|
|
@@ -150,8 +173,38 @@ module Aspera
|
|
|
150
173
|
nil
|
|
151
174
|
end
|
|
152
175
|
|
|
176
|
+
# Check that the option, and the sub-options present in a `Hash` value (`x-security` in schema), are available at current security level.
|
|
177
|
+
# Used for a value that is not assigned yet, e.g. to store in a preset.
|
|
178
|
+
# @param value [Object] Value of the option
|
|
179
|
+
# @raise [BadArgument] If refused at current level
|
|
180
|
+
def check_security(value)
|
|
181
|
+
Security.instance.check_level(@security, "option #{@option}")
|
|
182
|
+
check_sub_options_security(value)
|
|
183
|
+
end
|
|
184
|
+
|
|
153
185
|
private
|
|
154
186
|
|
|
187
|
+
# Values set by the program, or by the environment of the process (under control of the one who starts it), are not restricted:
|
|
188
|
+
# those from command line, presets (that a client can modify) and interactive input are.
|
|
189
|
+
# @param source [Symbol] `OptionSource`
|
|
190
|
+
# @return [Boolean] `true` if a value from this source is checked against security level
|
|
191
|
+
def restricted_source?(source)
|
|
192
|
+
!%i[default code env].include?(source)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# @param value [Object] Value of the option
|
|
196
|
+
# @raise [BadArgument] If a sub-option with `x-security` in the schema is present and refused at current level
|
|
197
|
+
def check_sub_options_security(value)
|
|
198
|
+
return unless @schema && value.is_a?(Hash)
|
|
199
|
+
Schema::Registry.instance.reader(@schema).each_property do |property, _name, full_name, _required|
|
|
200
|
+
level = property['x-security']
|
|
201
|
+
next if level.nil?
|
|
202
|
+
# Value of the sub-option, if given (a `nil` value clears it)
|
|
203
|
+
given = full_name.split('.').reduce(value) { |node, key| node.is_a?(Hash) ? node.find { |k, _| k.to_s.eql?(key) }&.last : nil }
|
|
204
|
+
Security.instance.check_level(level.to_sym, "option #{@option}.#{full_name}") unless given.nil?
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
155
208
|
# Validate a structured value against the schema of the option.
|
|
156
209
|
# Value may be partial: completed by other sources or defaults, so `required` is not enforced.
|
|
157
210
|
# @param value [Object] value to validate
|
|
@@ -273,9 +326,9 @@ module Aspera
|
|
|
273
326
|
def store(new_value, source)
|
|
274
327
|
# Secret values are hidden wherever they appear: logs, results
|
|
275
328
|
if @sensitive
|
|
276
|
-
|
|
329
|
+
Secret::Hider.instance.add_secret_values(new_value)
|
|
277
330
|
else
|
|
278
|
-
|
|
331
|
+
Secret::Hider.instance.add_secrets_in(new_value)
|
|
279
332
|
end
|
|
280
333
|
@value = new_value
|
|
281
334
|
@source = source
|