Skip to content

Commit

Permalink
chore(signing): Ensure that template policy is copied when signing is…
Browse files Browse the repository at this point in the history
… `insecureAcceptAnything` as default
  • Loading branch information
fiftydinar authored Dec 17, 2024
1 parent 7451299 commit fc4fd86
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/signing/signing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,17 @@ else
POLICY_FILE="${CONTAINER_DIR}/policy.json"
fi

# If there is no policy.json file, then copy the template policy
if ! [ -f "${POLICY_FILE}" ]; then
cp "${TEMPLATE_POLICY}" "${POLICY_FILE}"
fi

# If the already existing policy.json file doesn't have 'reject' as default policy,
# then signing is effectively disabled & template policy.json should be copied in that case also
if [[ "$(jq -r '.default[0].type' "${POLICY_FILE}")" == "insecureAcceptAnything" ]]; then
cp "${TEMPLATE_POLICY}" "${POLICY_FILE}"
fi

jq --arg image_registry "${IMAGE_REGISTRY}" \
--arg image_name "${IMAGE_NAME}" \
--arg image_name_file "${IMAGE_NAME_FILE}" \
Expand Down

0 comments on commit fc4fd86

Please sign in to comment.