mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-27 13:37:09 +00:00
Lua: Sandbox by default (whitelisted functions); Disable inline scripts for now; Add more checks for security reasons (#7136)
https://github.com/XTLS/Xray-core/pull/7136#issuecomment-6158632073 https://github.com/XTLS/Xray-core/pull/7136#issuecomment-6170831601 https://github.com/XTLS/Xray-core/pull/7136#issuecomment-6184362904
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// DO NOT EDIT. Regression test for app/geodata's luaGuardHeader.
|
||||
|
||||
package lua
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/yuin/gopher-lua/parse"
|
||||
)
|
||||
|
||||
func TestGeodataLuaGuard(t *testing.T) {
|
||||
_, err := parse.Parse(strings.NewReader("\x12\x01\x00function HandleRoute() end"), "geodata")
|
||||
var syntaxErr *parse.Error
|
||||
if !errors.As(err, &syntaxErr) || syntaxErr.Pos.Line != 1 || syntaxErr.Pos.Column != 1 {
|
||||
t.Fatalf("want Lua rejection at the first byte, got %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user