Skip to content

Commit

Permalink
libcnb-test: Only expose ports to localhost (#610)
Browse files Browse the repository at this point in the history
Previously ports exposed using `ContainerConfig::expose_port` would be
exposed to the internet, rather than just localhost.

See:
https://docs.docker.com/network/#published-ports

Fixes #609.
GUS-W-13812521.
  • Loading branch information
edmorley authored Jul 24, 2023
1 parent 702997a commit 8ed12de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ libcnb package` will refer to the new locations. ([#580](https://github.com/hero
- `libherokubuildpack`: Switch the `flate2` decompression backend from `miniz_oxide` to `zlib`. ([#593](https://github.com/heroku/libcnb.rs/pull/593))
- Bump minimum external dependency versions. ([#587](https://github.com/heroku/libcnb.rs/pull/587))

### Fixed

- `libcnb-test`: `ContainerContext::expose_port` now only exposes the port to localhost. ([#610](https://github.com/heroku/libcnb.rs/pull/610))

## [0.13.0] 2023-06-21

The highlight of this release is the `cargo libcnb package` changes to support compilation of both buildpacks and meta-buildpacks.
Expand Down
8 changes: 4 additions & 4 deletions libcnb-test/src/container_port_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub(crate) fn port_mapped_container_config(
(
format!("{port}/tcp"),
Some(vec![PortBinding {
host_ip: None,
host_ip: Some(String::from("127.0.0.1")),
host_port: None,
}]),
)
Expand Down Expand Up @@ -205,21 +205,21 @@ mod tests {
(
String::from("80/tcp"),
Some(vec![PortBinding {
host_ip: None,
host_ip: Some(String::from("127.0.0.1")),
host_port: None,
}]),
),
(
String::from("443/tcp"),
Some(vec![PortBinding {
host_ip: None,
host_ip: Some(String::from("127.0.0.1")),
host_port: None,
}]),
),
(
String::from("22/tcp"),
Some(vec![PortBinding {
host_ip: None,
host_ip: Some(String::from("127.0.0.1")),
host_port: None,
}]),
)
Expand Down

0 comments on commit 8ed12de

Please sign in to comment.