From be3c46964bd41801d44ee3ea668310ef1093df40 Mon Sep 17 00:00:00 2001 From: Guilherme Gallo Date: Mon, 15 Aug 2022 17:07:21 -0300 Subject: [PATCH] ci/bin: Remove whitespace from token files There was a security problem with some `gitlab_gql.py` scenarios because of `\r` and `\n` in the token file, which interrupted the requests for Gitlab endpoints. Stripping the token file after reading the file content solves the problem. Signed-off-by: Guilherme Gallo Part-of: --- .gitlab-ci/bin/gitlab_gql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci/bin/gitlab_gql.py b/.gitlab-ci/bin/gitlab_gql.py index 57922ec..bd58f32 100755 --- a/.gitlab-ci/bin/gitlab_gql.py +++ b/.gitlab-ci/bin/gitlab_gql.py @@ -123,7 +123,7 @@ def print_dag(dag: Dag) -> None: def fetch_merged_yaml(gl_gql: GitlabGQL, params) -> dict[Any]: gitlab_yml_file = get_project_root_dir() / ".gitlab-ci.yml" - content = Path(gitlab_yml_file).read_text() + content = Path(gitlab_yml_file).read_text().strip() params["content"] = content raw_response = gl_gql.query("job_details.gql", params) if merged_yaml := raw_response["ciConfig"]["mergedYaml"]: -- 2.7.4