-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Support wildcards in json://
and yaml://
so that values can be retrieved with slice
#545
Conversation
…ved with slice Only when wildcard is used, the expanded values become slice.
@@ -63,6 +63,13 @@ func TestEvaluateSchema(t *testing.T) { | |||
"", | |||
true, | |||
}, | |||
{"json://testdata/vars*.json", nil, []any{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vars.json and vars_array.json
This comment has been minimized.
This comment has been minimized.
@k2tzumi If you don't mind, I'd like to hear your opinion. |
If pattern matching with wildcards and . / (dot-dot-slash), there is a concern that directory traversal vulnerabilities may occur. I have the impression that it would be difficult to use wild card matching because the order of appearance on the slice would be indefinite. It seems to me that the goal of this PR should be more clearly defined.
|
Thank you for your advice!
Since we already allow dot-dot-slash, I thought it would be on the same level if wildcard was allowed?
It sorts the matched files. I think that this correspondence will at least fix the order.
You are absolutely right. Looking at #534, I thought this PR might be a good idea since it is a feature enhancement and I can confirm that the modification will not affect existing implementations. However, I have not thought deeply about this PR yet, so there may be other problems. |
Yes.
I think it's good.
I was personally concerned about the potential security issues and the complexity that would be involved. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Code Metrics Report
Details | | main (249c950) | #545 (cf17537) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 70.1% | 70.2% | +0.1% |
| Files | 54 | 54 | 0 |
| Lines | 5867 | 5888 | +21 |
+ | Covered | 4115 | 4133 | +18 |
- | Code to Test Ratio | 1:0.7 | 1:0.7 | -0.0 |
| Code | 11726 | 11759 | +33 |
+ | Test | 8275 | 8282 | +7 |
- | Test Execution Time | 3m2s | 3m54s | +52s | Code coverage of files in pull request scope (91.7% → 89.5%)
Reported by octocov |
Some of the security concerns can now be suppressed by the scope. Therefore, we are merging this feature. |
ref: #534
Proposal
Support wildcards in
json://
andyaml://
so that values can be retrieved with slice.Only when a wildcard (
*
) is used, the expanded values become a slice.