@@ -26,31 +26,31 @@ index 0000000..a9c88cc
2626+ echo "Testing: $test_name"
2727+
2828+ # Run command in rbash and capture exit code
29- + rbash -c "$command" 2>/dev/null
29+ + ${THIS_SH} -r -c "$command" 2>/dev/null
3030+ local exit_code=$?
3131+
3232+ # For restricted operations, we expect non-zero exit code
3333+ if [ $exit_code -ne 0 ]; then
34- + echo " â PASS: Command properly restricted (exit code: $exit_code)"
34+ + echo " [ PASS] : Command properly restricted (exit code: $exit_code)"
3535+ ((PASSED++))
3636+ else
37- + echo " â FAIL: Command should have been restricted but succeeded"
37+ + echo " [ FAIL] : Command should have been restricted but succeeded"
3838+ ((FAILED++))
3939+ fi
4040+ echo ""
4141+ }
4242+
4343+ # Test 1: Cannot change directory
44- + test_restriction "cd restriction" "cd /tmp "
44+ + test_restriction "cd restriction" "cd /"
4545+
4646+ # Test 2: Cannot modify PATH
4747+ test_restriction "PATH modification" "PATH=/bin:/usr/bin"
4848+
4949+ # Test 3: Cannot use commands with absolute path
50- + test_restriction "command with /" "/bin/ls "
50+ + test_restriction "command with /" "/usr/ bin/env "
5151+
5252+ # Test 4: Cannot redirect output
53- + test_restriction "output redirection" "echo test > /tmp/ test.txt"
53+ + test_restriction "output redirection" "echo test > test.txt"
5454+
5555+ # Test 5: Cannot use exec builtin
5656+ test_restriction "exec builtin" "exec ls"
@@ -59,19 +59,19 @@ index 0000000..a9c88cc
5959+ test_restriction "SHELL modification" "SHELL=/bin/sh"
6060+
6161+ # Test 7: Cannot modify ENV variable
62- + test_restriction "ENV modification" "ENV=/tmp/env "
62+ + test_restriction "ENV modification" "ENV=/etc/profile "
6363+
6464+ # Test 8: Cannot modify BASH_ENV variable
65- + test_restriction "BASH_ENV modification" "BASH_ENV=/tmp/bashenv "
65+ + test_restriction "BASH_ENV modification" "BASH_ENV=/etc/profile "
6666+
6767+ # Test 9: Allowed operation - simple echo should work
6868+ echo "Testing: allowed operation (echo)"
69- + rbash -c "echo 'Hello from rbash'" >/dev/null 2>&1
69+ + ${THIS_SH} -r -c "echo 'Hello from rbash'" >/dev/null 2>&1
7070+ if [ $? -eq 0 ]; then
71- + echo " â PASS: Allowed command works correctly"
71+ + echo " [ PASS] : Allowed command works correctly"
7272+ ((PASSED++))
7373+ else
74- + echo " â FAIL: Allowed command failed"
74+ + echo " [ FAIL] : Allowed command failed"
7575+ ((FAILED++))
7676+ fi
7777+ echo ""
@@ -84,10 +84,10 @@ index 0000000..a9c88cc
8484+ echo ""
8585+
8686+ if [ $FAILED -eq 0 ]; then
87- + echo "â All rbash restriction tests passed!"
87+ + echo "[PASS] All rbash restriction tests passed!"
8888+ exit 0
8989+ else
90- + echo "â Some rbash restriction tests failed!"
90+ + echo "[FAIL] Some rbash restriction tests failed!"
9191+ exit 1
9292+ fi
9393diff --git a/tests/rbash.right b/tests/rbash.right
@@ -99,38 +99,38 @@ index 0000000..e831f1d
9999+ === Restricted Bash (rbash) Test Suite ===
100100+
101101+ Testing: cd restriction
102- + â PASS: Command properly restricted (exit code: 1)
102+ + [ PASS] : Command properly restricted (exit code: 1)
103103+
104104+ Testing: PATH modification
105- + â PASS: Command properly restricted (exit code: 1)
105+ + [ PASS] : Command properly restricted (exit code: 1)
106106+
107107+ Testing: command with /
108- + â PASS: Command properly restricted (exit code: 127 )
108+ + [ PASS] : Command properly restricted (exit code: 1 )
109109+
110110+ Testing: output redirection
111- + â PASS: Command properly restricted (exit code: 1)
111+ + [ PASS] : Command properly restricted (exit code: 1)
112112+
113113+ Testing: exec builtin
114- + â PASS: Command properly restricted (exit code: 1)
114+ + [ PASS] : Command properly restricted (exit code: 1)
115115+
116116+ Testing: SHELL modification
117- + â PASS: Command properly restricted (exit code: 1)
117+ + [ PASS] : Command properly restricted (exit code: 1)
118118+
119119+ Testing: ENV modification
120- + â PASS: Command properly restricted (exit code: 1)
120+ + [ PASS] : Command properly restricted (exit code: 1)
121121+
122122+ Testing: BASH_ENV modification
123- + â PASS: Command properly restricted (exit code: 1)
123+ + [ PASS] : Command properly restricted (exit code: 1)
124124+
125125+ Testing: allowed operation (echo)
126- + â PASS: Allowed command works correctly
126+ + [ PASS] : Allowed command works correctly
127127+
128128+ === Test Summary ===
129129+ Total tests: 9
130130+ Passed: 9
131131+ Failed: 0
132132+
133- + â All rbash restriction tests passed!
133+ + [PASS] All rbash restriction tests passed!
134134diff --git a/tests/run-rbash b/tests/run-rbash
135135new file mode 100644
136136index 0000000..f80b7f2
0 commit comments