You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As documented, configuration attributes accepting empty objects as values, when set with command line args and --set, should translate null values into an empty object.
Actual Behavior
Setting object attributes to null assigns them an actual null value.
Steps to Reproduce the Problem
Set any value that accepts and empty object to null.
Note how headers is of type object and should not be "nullable".
A more serious problem is how this essentially breaks the AWS metadata credentials options when not using a config file:
opa run -s
--set "services.local.url=http://localhost"
--set "services.local.credentials.s3_signing.environment_credentials=null"
--set "bundles.authz.service=local"
Results in:
"Bundle load failed: request failed: a AWS credential service must be specified when S3 signing is enabled
Which is a consequence of null being treated literally as nil:
ifap.AWSEnvironmentCredentials==nil&&ap.AWSWebIdentityCredentials==nil&&ap.AWSMetadataCredentials==nil {
returnnil, errors.New("a AWS credential service must be specified when S3 signing is enabled")
}
This commit updates the parser for --set options
to return empty struct as return value when null
is specified. This is needed to set an empty object
with the CLI overrides for a null typed value.
Fixes: open-policy-agent#3846
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
This commit updates the parser for --set options
to return empty struct as return value when null
is specified. This is needed to set an empty object
with the CLI overrides for a null typed value.
Fixes: #3846
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
dolevf
pushed a commit
to dolevf/opa
that referenced
this issue
Nov 4, 2021
This commit updates the parser for --set options
to return empty struct as return value when null
is specified. This is needed to set an empty object
with the CLI overrides for a null typed value.
Fixes: open-policy-agent#3846
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Signed-off-by: Dolev Farhi <farhi.dolev@gmail.com>
Expected Behavior
As documented, configuration attributes accepting empty objects as values, when set with command line args and
--set
, should translatenull
values into an empty object.Actual Behavior
Setting object attributes to
null
assigns them an actual null value.Steps to Reproduce the Problem
Set any value that accepts and empty object to null.
opa run -s --set "services.test.headers=null"
Note how
headers
is of typeobject
and should not be "nullable".A more serious problem is how this essentially breaks the AWS metadata credentials options when not using a config file:
Results in:
Which is a consequence of null being treated literally as nil:
Additional Info
Reported by @Sulbigar here.
The text was updated successfully, but these errors were encountered: