Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error validation code in attr parsing #2353

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
([PR](https://github.com/hashicorp/boundary/pull/2351)).
* Managed Groups: Fix an issue where the `filter` field is not sent by
admin UI ([PR](https://github.com/hashicorp/boundary-ui/pull/1238)).

* Plugins: Fixes regression from 0.9.0 causing a failure to start when using
multiple KMS blocks of the same type
([PR1](https://github.com/hashicorp/go-secure-stdlib/pull/43),
[PR2](https://github.com/hashicorp/boundary/pull/2346))
* CLI: Fixed errors related to URL detection when passing in `-attr` or
`-secret` values that contained colons
([PR](https://github.com/hashicorp/boundary/pull/2353))

## 0.10.0 (2022/08/10)

Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/flags.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package base

import (
"errors"
"flag"
"fmt"
"os"
Expand Down Expand Up @@ -854,7 +855,7 @@ func (c *combinedSliceValue) Set(val string) error {
}

var err error
if ret.Value, err = parseutil.ParsePath(ret.Value); err != nil && err != parseutil.ErrNotAUrl {
if ret.Value, err = parseutil.ParsePath(ret.Value); err != nil && !errors.Is(err, parseutil.ErrNotAUrl) {
return fmt.Errorf("error checking if value is a path: %w", err)
}

Expand Down
11 changes: 11 additions & 0 deletions internal/cmd/common/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ func TestPopulateAttrFlags(t *testing.T) {
args: []string{"-num-attr", "fo.oo-o.o=5"},
expectedErr: "invalid value",
},
{
name: "colon-in-segment",
args: []string{"-attr", "filter=tagName eq 'application:south-seas'"},
expected: []base.CombinedSliceFlagValue{
{
Name: "attr",
Keys: []string{"filter"},
Value: "tagName eq 'application:south-seas'",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down