diff --git a/CHANGELOG.md b/CHANGELOG.md index e46e4887..17238e28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - When running `semgrep`, its always added to `PATH`, as otherwise semgrep is not able to find `pysemgrep` folder. ([#439](https://github.com/crashappsec/chalk/pull/439)) +- Docker pushing non-chalked images did not report metsys + plugin keys such as `_EXIT_CODE`, `_CHALK_RUN_TIME`. + ([#438](https://github.com/crashappsec/chalk/pull/438)) ### New Features diff --git a/tests/functional/test_docker.py b/tests/functional/test_docker.py index 860b26a4..bb74aaeb 100644 --- a/tests/functional/test_docker.py +++ b/tests/functional/test_docker.py @@ -960,6 +960,14 @@ def test_build_and_push( assert pull.find("Digest:") == f"sha256:{image_digest}" +def test_push_nonchalked(chalk: Chalk, random_hex: str): + tag_base = f"{REGISTRY}/nonchalked_{random_hex}" + tag = f"{tag_base}:latest" + Docker.build(content="FROM alpine", tag=tag) + push = chalk.docker_push(tag) + assert push.report.has(_OP_EXIT_CODE=0, _CHALK_RUN_TIME=ANY) + + @pytest.mark.parametrize("test_file", ["valid/sample_1"]) def test_push_without_buildx( chalk: Chalk, diff --git a/tests/functional/testing.c4m b/tests/functional/testing.c4m index 1ebe46a9..9df2b15a 100644 --- a/tests/functional/testing.c4m +++ b/tests/functional/testing.c4m @@ -7,6 +7,7 @@ custom_report.terminal_other_op.use_when: ["extract", "delete", "exec", "env", " report_template insertion_default { key._OP_EXIT_CODE.use = true + key._CHALK_RUN_TIME.use = true } report_template report_default { diff --git a/tests/functional/utils/docker.py b/tests/functional/utils/docker.py index 4872e98b..a56b4e26 100644 --- a/tests/functional/utils/docker.py +++ b/tests/functional/utils/docker.py @@ -54,7 +54,7 @@ def build_cmd( for t in tags: cmd += ["-t", t] if content: - stdin = content.encode() + stdin = Docker.dockerfile(content).encode() cmd += ["-f", "-"] elif dockerfile: cmd += ["-f", str(dockerfile)]