core: restrict allowed Oracle callbacks
This commit is contained in:
parent
f2365e2392
commit
31b06907c9
2 changed files with 16 additions and 9 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/dao"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||
|
@ -275,6 +276,9 @@ func (o *Oracle) RequestInternal(ic *interop.Context, url string, filter *string
|
|||
if len(url) > maxURLLength || (filter != nil && len(*filter) > maxFilterLength) || len(cb) > maxCallbackLength || gas.Uint64() < 1000_0000 {
|
||||
return ErrBigArgument
|
||||
}
|
||||
if strings.HasPrefix(cb, "_") {
|
||||
return errors.New("disallowed callback method (starts with '_')")
|
||||
}
|
||||
|
||||
if !ic.VM.AddGas(gas.Int64()) {
|
||||
return ErrNotEnoughGas
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue