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

Support wildcards in json:// and yaml:// so that values can be retrieved with slice #545

Merged
merged 7 commits into from
Oct 31, 2023

Conversation

k1LoW
Copy link
Owner

@k1LoW k1LoW commented Jun 12, 2023

ref: #534

Proposal

Support wildcards in json:// and yaml:// so that values can be retrieved with slice.

Only when a wildcard ( * ) is used, the expanded values become a slice.

…ved with slice

Only when wildcard is used, the expanded values become slice.
@k1LoW k1LoW added the enhancement New feature or request label Jun 12, 2023
@k1LoW k1LoW self-assigned this Jun 12, 2023
@k1LoW k1LoW requested a review from k2tzumi June 12, 2023 01:35
@@ -63,6 +63,13 @@ func TestEvaluateSchema(t *testing.T) {
"",
true,
},
{"json://testdata/vars*.json", nil, []any{
Copy link
Owner Author

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

@github-actions

This comment has been minimized.

@k1LoW
Copy link
Owner Author

k1LoW commented Jun 12, 2023

@k2tzumi If you don't mind, I'd like to hear your opinion.

@k2tzumi
Copy link
Collaborator

k2tzumi commented Jun 12, 2023

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.

  • Solution to prevent vars from being fat
  • Better Data Management Methods for Data Driven Testing

@k1LoW
Copy link
Owner Author

k1LoW commented Jun 12, 2023

Thank you for your advice!

If pattern matching with wildcards and . / (dot-dot-slash), there is a concern that directory traversal vulnerabilities may occur.

Since we already allow dot-dot-slash, I thought it would be on the same level if wildcard was allowed?

because the order of appearance on the slice would be indefinite.

https://github.com/k1LoW/runn/pull/545/files#diff-29e5d1896212c61371d2eb62885b72355eb956d2b92da55ae85b11bcaa5212cfR66

It sorts the matched files. I think that this correspondence will at least fix the order.

It seems to me that the goal of this PR should be more clearly defined.

You are absolutely right.

Looking at #534,
I thought there was a request for one JSON file per application/json HTTP request, and one JSON file per application/json HTTP response.

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.

@k2tzumi
Copy link
Collaborator

k2tzumi commented Jun 13, 2023

Since we already allow dot-dot-slash, I thought it would be on the same level if wildcard was allowed?

Yes.
We believe that additional support for wildcards will increase the risk of vulnerability even more.

It sorts the matched files. I think that this correspondence will at least fix the order.

I think it's good.

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.

I was personally concerned about the potential security issues and the complexity that would be involved.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@k1LoW k1LoW mentioned this pull request Oct 30, 2023
Copy link
Contributor

Code Metrics Report

main (249c950) #545 (cf17537) +/-
Coverage 70.1% 70.2% +0.1%
Code to Test Ratio 1:0.7 1:0.7 -0.0
Test Execution Time 3m2s 3m54s +52s
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%)

Files Coverage +/-
vars.go 89.5% -2.2%

Reported by octocov

@k1LoW
Copy link
Owner Author

k1LoW commented Oct 31, 2023

Some of the security concerns can now be suppressed by the scope.

Therefore, we are merging this feature.

@k1LoW k1LoW merged commit 4a5b6cd into main Oct 31, 2023
7 checks passed
@k1LoW k1LoW deleted the multiple-json-yaml branch October 31, 2023 14:22
@github-actions github-actions bot mentioned this pull request Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants