Skip to content

Commit

Permalink
expand disallow list
Browse files Browse the repository at this point in the history
  • Loading branch information
lostella committed May 23, 2024
1 parent d275a12 commit 242bdd8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gluonts/core/serde/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ def encode_partial(v: partial) -> Any:
}


decode_disallow = [
eval,
exec,
]


def decode(r: Any) -> Any:
"""
Decodes a value from an intermediate representation `r`.
Expand All @@ -313,7 +319,7 @@ def decode(r: Any) -> Any:
cls = cast(Any, locate(r["class"]))

assert cls is not None, f"Can not locate {r['class']}."
assert cls is not eval, f"{r['class']} cannot be run."
assert cls not in decode_disallow, f"{r['class']} cannot be run."

if kind == Kind.Type:
return cls
Expand Down

0 comments on commit 242bdd8

Please sign in to comment.