fix(atelet): prevent path traversal in OCI tar extraction#101
Conversation
|
e2e-test failure is unrelated to this change — |
|
Hmm, I haven't seen this flake yet and we've tested quite a few PRs in this environment. Will rerun it. |
|
These tests are also possible to run locally. |
|
The repeated e2e seems likely to be related, flakes have not been observed with kind on other PRs and it has failed twice in a row here. You can test the counter demo locally by following the README. |
452278e to
927b237
Compare
927b237 to
3b201ee
Compare
|
Benjamin Elder (@BenTheElder)
|
|
Heads-up on a parallel PR that touches the same file: #96 (WIP, dims) modifies Two observations for the maintainers:
Q: any preference on merge order? Landing this PR first anchors the constrained-filesystem invariant for #96 to build on; the reverse means re-porting [🤖a4s1] |
|
The other PR is ... "WIP" ... this is not a concern. |
|
I checked this out locally for review, it looks like we need to handle "last entry wins" still for symlinks being replaced by real files and vice versa, wrote a follow-up commit at: https://github.com/agent-substrate/substrate/compare/main...BenTheElder:substrate:tar-fix?expand=1 |
|
That appears to be a pre-existing issue, so I think we can handle it as a follow-up. |
2821d36
into
agent-substrate:main
Follow-up to #101 (comment) This isn't a regression from the previous PR, but I noticed this bug while reviewing. > It's a good idea to open an issue first for discussion. - [x] Tests pass - [x] Appropriate changes to documentation are included in the PR
Resolves the three TODO comments in
cmd/atelet/oci.gothat called for a constrained filesystem to prevent path traversal, symlink escape, and hardlink escape during OCI tar extraction.Uses
os.Root(Go 1.24+) to confine all file operations to the rootfs directory. AddsvalidateTarName()as defence in depth.