---
title: Zypper install without explicit package version
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Infrastructure as Code (IaC)
  Security > IaC Security Rules > Zypper install without explicit package
  version
---

# Zypper install without explicit package version

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ().
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**Id:** `562952e4-0348-4dea-9826-44f3a2c6117b`

**Cloud Provider:** Dockerfile

**Platform:** Dockerfile

**Severity:** Low

**Category:** Supply-Chain

#### Learn More{% #learn-more %}

- [Provider Reference](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run)

### Description{% #description %}

When using zypper to install packages in a Dockerfile, each package should include an explicit version to ensure reproducible builds and avoid unintentionally pulling newer package releases that could introduce vulnerabilities or break functionality.

This rule inspects Dockerfile `RUN` instructions that invoke `zypper install` or `zypper in` (both shell-form and exec-form) and flags package arguments that are bare names without a version component. Resources missing a version, for example, `curl` instead of `curl=7.79.1` will be flagged. Specify the version inline using the repository-appropriate syntax or use a package pin/lock mechanism to fix the exact package release.

Secure example:

```Dockerfile
RUN zypper install -y curl=7.79.1 libxml2=2.9.10
```

## Compliant Code Examples{% #compliant-code-examples %}

```dockerfile
FROM opensuse/leap:15.2
RUN zypper install -y httpd=2.4.46 && zypper clean
HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1
```

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```dockerfile
FROM opensuse/leap:15.2
RUN zypper install -y httpd && zypper clean
RUN ["zypper", "install", "http"]
HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1
```
