Skip to content
Snippets Groups Projects
Commit ce304cf6 authored by Andrii Sosiuk's avatar Andrii Sosiuk
Browse files

[CICD][BUILD] Mask sensitive environment variables in build:pass job

  The build:pass job prints environment variables, some of which
  may contain sensitive data.
  This update ensures that variables with names matching substrings
  in FILTER_LIST have their values masked
parent 62eb8719
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,25 @@ build:pass:
needs: []
timeout: 2m
image: {{ CI_IMAGE_PYTHON }}
variables:
FILTER_LIST: "TOKEN KEY"
script:
- printenv
# Mask the value of environment variables if their names match any substring in FILTER_LIST
- |
printenv | awk -F= -v filters="$FILTER_LIST" '
BEGIN {
IGNORECASE = 1;
split(filters, filter_array, " ");
}
{
for (i in filter_array) {
if (index(toupper($1), toupper(filter_array[i])) > 0) {
print $1 "=[MASKED]";
next;
}
}
print;
}'
- echo "Build successful"
- echo "This is the value of the MANUAL_BUILD variable '${MANUAL_BUILD}'"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment