Skip to content

Commit

Permalink
Merge pull request #1 from jrasband-dev/dev-0.3.1
Browse files Browse the repository at this point in the history
Fixed eval vulnerability
  • Loading branch information
jrasband-dev authored Dec 23, 2024
2 parents 263052d + 4808342 commit a190f5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions polars_extensions/io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import json
from typing import IO, Union
import json
from pathlib import Path
from typing import IO, Union
import ast

import polars as pl


Expand All @@ -20,6 +22,6 @@ def read_schema(file: str | Path | IO[str] | IO[bytes]):
f = open(file,'r')
schema = json.load(f)
f.close()
schema_dict = {k: eval(f"pl.{v}") for k, v in schema.items()}
schema_dict = {k: ast.literal_eval(f"pl.{v}") for k, v in schema.items()}
schema_object = pl.Schema(schema_dict)
return schema_object
return schema_object

0 comments on commit a190f5b

Please sign in to comment.