From e6a9219c42d209ff76045a83de9086e7017a9d33 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Fri, 10 May 2024 18:31:00 +0300 Subject: [PATCH] Add an allow list of keys Signed-off-by: Kemal Akkoyun --- projects/fal/src/fal/container.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/fal/src/fal/container.py b/projects/fal/src/fal/container.py index 004d7539..663a124b 100644 --- a/projects/fal/src/fal/container.py +++ b/projects/fal/src/fal/container.py @@ -3,9 +3,15 @@ class ContainerImage: from a Dockerfile. """ + _known_keys = {"dockerfile_str", "build_env", "build_args"} + @classmethod def from_dockerfile_str(cls, text: str, **kwargs): - return dict(dockerfile_str=text, **kwargs) + # Check for unknown keys and return them as a dict. + return dict( + dockerfile_str=text, + **{k: v for k, v in kwargs.items() if k in cls._known_keys}, + ) @classmethod def from_dockerfile(cls, path: str, **kwargs):