Skip to content

Update EC2MetadataUtilServer to only accept localhost address #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class EC2MetadataUtilsIntegrationTest {

@BeforeClass
public static void setUp() throws IOException {
SERVER = new EC2MetadataUtilsServer("localhost", 0);
SERVER = new EC2MetadataUtilsServer( 0);
SERVER.start();

System.setProperty(AwsSystemSetting.AWS_EC2_METADATA_SERVICE_ENDPOINT.property(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static class MetadataServiceRunningTest {

@BeforeClass
public static void setupFixture() throws IOException {
server = new EC2MetadataUtilsServer("localhost", 0);
server = new EC2MetadataUtilsServer(0);
server.start();

System.setProperty(AwsSystemSetting.AWS_EC2_METADATA_SERVICE_ENDPOINT.property(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class EC2MetadataUtilsServer {

private ServerSocket server;

public EC2MetadataUtilsServer(String address, int port)
public EC2MetadataUtilsServer(int port)
throws UnknownHostException, IOException {
server = new ServerSocket(port, 1, InetAddress.getByName(address));
server = new ServerSocket(port, 1, InetAddress.getLoopbackAddress());
}

public void start()
Expand Down