Skip to content

Commit 40270e7

Browse files
authored
fix: Avoid XSS attack from Jinjin2's Environment(). (feast-dev#4355)
Signed-off-by: Shuchu Han <shuchu.han@gmail.com>
1 parent b9696ef commit 40270e7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sdk/python/feast/infra/offline_stores/contrib/postgres_offline_store/postgres.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ def build_point_in_time_query(
365365
full_feature_names: bool = False,
366366
) -> str:
367367
"""Build point-in-time query between each feature view table and the entity dataframe for PostgreSQL"""
368-
template = Environment(loader=BaseLoader()).from_string(source=query_template)
368+
template = Environment(autoescape=True, loader=BaseLoader()).from_string(
369+
source=query_template
370+
)
369371

370372
final_output_feature_names = list(entity_df_columns)
371373
final_output_feature_names.extend(

sdk/python/feast/infra/offline_stores/offline_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ def build_point_in_time_query(
186186
full_feature_names: bool = False,
187187
) -> str:
188188
"""Build point-in-time query between each feature view table and the entity dataframe for Bigquery and Redshift"""
189-
template = Environment(loader=BaseLoader()).from_string(source=query_template)
189+
template = Environment(autoescape=True, loader=BaseLoader()).from_string(
190+
source=query_template
191+
)
190192

191193
final_output_feature_names = list(entity_df_columns)
192194
final_output_feature_names.extend(

0 commit comments

Comments
 (0)