test(iso4-path): Add path confinement tests - #1338
Conversation
b4630fe to
39c3444
Compare
End-to-End Test ReportTest Previewgrate harnessGrate Test Report
Cases
static harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-math harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-filesystem harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-memory harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-process harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-signals harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-networking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-dynamic-linking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Also, this PR does check the path confinement to a virtual root. Just wondering if the chroot to lindfs/ filesystem should also be tested here. @Yaxuan-w
|
|
||
| unlink("evil_link"); | ||
|
|
||
| printf("symlink_confinement test: PASS\n"); |
There was a problem hiding this comment.
This test asserts that opening via evil_link behaves identically to opening /etc/passwd directly. if confinement were totally broken and both opens hit the host's real /etc/passwd, the two would still match each other and the test would still PASS.
End-to-End Test ReportTest Previewgrate harnessGrate Test Report
Cases
static harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-math harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-filesystem harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-memory harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-process harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-signals harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-networking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-dynamic-linking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0834063 to
da684a3
Compare
End-to-End Test ReportTest Previewgrate harnessGrate Test Report
Cases
static harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-math harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-filesystem harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-memory harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-process harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-signals harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-networking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-dynamic-linking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NOTE: /lind/README.md is specific to this dev-conatainer's mount | ||
| layout(repo checked out at /lind, matching LINDFS_ROOT's hardcoded | ||
| assumption in sysdefs). If this runs somewhere that mounts the repo | ||
| differently, this path may not exist at all, in which case this | ||
| check would accidentally pass via ENOENT. | ||
| Re-verify this path is valid if test is run in a new environment. |
There was a problem hiding this comment.
The solution could be to pin the expected output instead of deriving it from an unconfined run. Adding:
tests/unit-tests/file_tests/deterministic/expected/symlink_confinement.outputmakes get_expected_output() return early and skip the native compile+run entirely. Failure detection is preserved: the lind run's return code still goes through handle_return_code(), so a real escape is still reported as a Runtime Failure regardless of the expected text.
| secure = [] | ||
|
|
||
| [dev-dependencies] | ||
| dashmap = "5.1" |
There was a problem hiding this comment.
Could you make this import in Cage lib public so that we don't need to re-dependent here? This can help us avoid version mismatch between typemap and cage.
bee83cf to
a8f675b
Compare
End-to-End Test ReportTest Previewgrate harnessGrate Test Report
Cases
static harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-math harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-filesystem harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-memory harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-process harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-signals harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-networking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-dynamic-linking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||
| errno = 0; | ||
| /* | ||
| NOTE: /lind/README.md is specific to this dev-conatainer's mount |
|
|
||
| errno = 0; | ||
| /* | ||
| NOTE: /lind/README.md is specific to this dev-conatainer's mount |
There was a problem hiding this comment.
Opening /lind/README.md from inside the cage resolves to <LINDFS_ROOT>/lind/README.md, which doesn't exist. This would result in a return value of ENOENT which would pass this test, but that doesn't necessarily test policy enforcement. All it says is that name did not resolve to anything inside the virtual filesystem. Also, doing a generic test here would be problematic when the test is run natively.
A suggested solution is to have a file within the virtual filesystem and outside either.
File /tmp/lind/sentinel.txt will contain the text "LIND_HOST_ONLY"
and File $LINDFS_ROOT/tmp/lind/sentinel will contain the text "LIND_CAGE_ONLY".
So when you run it within lind-wasm, the following three conditions can hold,
- Reads LIND_CAGE_ONLY means confinement works, and test passes
- Reads LIND_HOST_ONLY means there is an escape and test fails
- If open fails, then failure
|
Posting review comments here again.. Opening A suggested solution is to have a file within the virtual filesystem and outside either. File and File So when you run it within lind-wasm, the following three conditions can hold,
@Yaxuan-w Are these tests also compared against native execution? If so, I wonder if we really need to do it. Because testing confinement only applies to sandboxed execution and not native, so there is no behavior to compare against. |
End-to-End Test ReportTest Previewgrate harnessGrate Test Report
Cases
static harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-math harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-filesystem harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-memory harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-process harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-signals harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
wasm-networking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
wasm-dynamic-linking harnessTest ReportDeterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Adds ISO-004 test coverage to verify that cage paths remain confined to the virtual root
Changes:
Added 3
normpath()unit tests covering:Absolute paths being resolved from the virtual root
Excess
..components being clamped at the rootNormal
..path resolution working correctlyAdded test-only
dashmapandparking_lotdependencies to support the test cage setupAdded
symlink_confinement.cend-to-end test to verify that symlinks cannot be used to escape path confinement