feat(565): update dir and file input to support working dir#557
Conversation
f4a2d4a to
aad1cd3
Compare
dir and file input to support working dir
92983b8 to
a53e69d
Compare
|
Would it make sense to put the |
76d04c4 to
f2ee3a0
Compare
f2ee3a0 to
7857bf7
Compare
I askes @jakobmoellerdev where this place would be - maybe you can give me a pointer :D |
|
for reuse of your function consider something like in the blob/filesystem bindings |
After pr #572 557 is merged, I will update this one |
928deaf to
f94b2fa
Compare
ddfa7a9 to
a681242
Compare
fabianburth
left a comment
There was a problem hiding this comment.
I know this was like this before you touched it already, but since the tests make a lot of asserts (require.NoError(t,...)), we might want to think about introducing an r := require.New(t) and to be able to subsequently call r.NoError(...) without having to pass the testing environment.
You can check other tests for reference.
a681242 to
23f61df
Compare
c2f4751 to
2e57c0d
Compare
Signed-off-by: Matthias Bruns <git@matthiasbruns.com> On-behalf-of: SAP <matthias.bruns@sap.com> # Conflicts: # bindings/go/input/dir/go.mod # bindings/go/input/dir/go.sum # bindings/go/input/file/go.mod # bindings/go/input/file/go.sum
2e57c0d to
c18300e
Compare
c18300e to
bc28b91
Compare
Signed-off-by: Matthias Bruns <git@matthiasbruns.com> On-behalf-of: SAP <matthias.bruns@sap.com>
bc28b91 to
63b83af
Compare
Signed-off-by: Matthias Bruns <git@matthiasbruns.com> On-behalf-of: SAP <matthias.bruns@sap.com> Co-authored-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com> On-behalf-of: SAP <matthias.bruns@sap.com>
779935d to
f545bc8
Compare
|
I hope I covered all requests now and we can merge this thing :D @fabianburth |
There was a problem hiding this comment.
Pull Request Overview
This PR adds working directory support to file and directory input methods, allowing path resolution relative to a constructor file while preventing path traversal attacks. The changes enable secure file/directory handling with configurable working directory settings.
- Added
WorkingDirectoryfield toInputMethodstructs in both file and dir packages - Introduced
NewInputMethodconstructors that accept a working directory parameter - Updated blob processing functions to accept and use working directory for path resolution
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| bindings/go/input/file/method.go | Added WorkingDirectory field and NewInputMethod constructor; updated ProcessResource to use working directory |
| bindings/go/input/file/blob_test.go | Updated test calls to GetV1FileBlob to include working directory parameter |
| bindings/go/input/file/blob.go | Modified GetV1FileBlob to accept working directory and use filesystem.GetBlobInWorkingDirectory |
| bindings/go/input/dir/method.go | Added WorkingDirectory field and NewInputMethod constructor; updated ProcessResource to use working directory |
| bindings/go/input/dir/blob_test.go | Updated test calls to GetV1DirBlob to include working directory parameter |
| bindings/go/input/dir/blob.go | Modified GetV1DirBlob to accept working directory and added path validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com> On-behalf-of: SAP <matthias.bruns@sap.com>
40711b6 to
d07f5e1
Compare
Cherry picking constructor changes from #540
What this PR does / why we need it
Resolve file/dir inputs relative to the constructor file by wiring a filesystem working directory through input methods; default-deny path escapes with an explicit opt-out.
Changes (high level):
Which issue(s) this PR fixes
Fixes #565