Skip to content

Commit

Permalink
more explained comment on why to use IP 169.254.169.254
Browse files Browse the repository at this point in the history
Signed-off-by: Kapil Sharma <[email protected]>
  • Loading branch information
h4l0gen authored and poiana committed Apr 9, 2024
1 parent a29607a commit 7bc50fb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ var _ = events.Register(

func ContactCloudMetadataServiceFromContainer(h events.Helper) error {
if h.InContainer() {
//This event works on GCP, AWS, and Azure using the common link-local IP address 169.254.169.254.
// The IP address 169.254.169.254 is reserved for the Cloud Instance Metadata Service,
// a common endpoint used by cloud instances (GCP, AWS and Azure) to access
// metadata about the instance itself. Detecting attempts to communicate with this
// IP address from a container can indicate potential unauthorized access to
// sensitive cloud infrastructure metadata.
cmd := exec.Command("timeout", "1s", "nc", "169.254.169.254", "80")

if err := cmd.Run(); err != nil {
Expand Down

0 comments on commit 7bc50fb

Please sign in to comment.