Skip to content

fix(events): deny every cloud metadata endpoint under every egress policy - #901

Open
ThomasK33 wants to merge 4 commits into
mainfrom
guard-metadata-list
Open

ThomasK33 wants to merge 4 commits into
mainfrom
guard-metadata-list

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

With private targets admitted, the egress guard denied only two cloud metadata addresses, 169.254.169.254 and fd00:ec2::254. The other metadata and credential endpoints of the major clouds lie inside the classes that the policy admits, so a webhook or a sync link could reach them whenever an operator set OPENSTORAGE_WEBHOOK_ALLOW_PRIVATE=true or OPENSTORAGE_SYNC_ALLOW_PRIVATE=true, and on pulls under the transitional default too. Alibaba Cloud's 100.100.100.200, for example, is in RFC 6598 shared space. Azure's WireServer, 168.63.129.16, is a public address, so every policy admitted it, the strict default too. (fe80::a9fe:a9fe is listed for completeness: on Linux a link-local address without a zone does not connect, and with a zone the guard already refused it.)

Now deniedReason (internal/events/guard.go) denies one list of single addresses, metadataAddrs, under every policy, for webhook deliveries and for both sync directions. The private classes around them stay admitted.

The list

Each address was checked on 2026-11-16 in the provider's own documentation, except fd00:c1::a9fe:a9fe, which comes from Oracle's own SDK:

Address Endpoint of Source
169.254.169.254 AWS, Google Cloud, Azure, Oracle Cloud, DigitalOcean, Akamai (Linode), Hetzner, Huawei Cloud, OpenStack AWS, Google Cloud, Azure, Oracle, DigitalOcean, Akamai, Hetzner, Huawei, OpenStack
fd00:ec2::254 AWS instance metadata over IPv6 AWS
169.254.170.2 AWS ECS task metadata and task role credentials AWS
169.254.170.23, fd00:ec2::23 AWS EKS Pod Identity Agent AWS
fd20:ce::254 Google Cloud metadata on IPv6-only instances Google Cloud
169.254.169.252 Google Kubernetes Engine metadata server (Workload Identity) Google Cloud
100.100.100.200 Alibaba Cloud ECS metadata and RAM role credentials Alibaba Cloud
169.254.10.10 Tencent Cloud metadata.tencentyun.com Tencent Cloud
169.254.0.23 Tencent Cloud Cloudbase-Init metadata URL Tencent Cloud
169.254.42.42, fd00:42::42 Scaleway instance metadata Scaleway
fd00:a9fe:a9fe::1 Akamai (Linode) metadata over IPv6 Akamai
fe80::a9fe:a9fe OpenStack, Hetzner and Akamai metadata over IPv6 OpenStack, Hetzner, Akamai
fd00:c1::a9fe:a9fe Oracle Cloud metadata and instance-principal credentials over IPv6 (Oracle's metadata page names only 169.254.169.254) Oracle's oci-python-sdk (IMDS_IPV6_HOST), also cloud-init
168.63.129.16 Azure WireServer, which Microsoft lists with the Instance Metadata Service as serving metadata and bootstrapping VM credentials. A public address: every policy admitted it, the strict default too Azure
192.0.0.192 Oracle Cloud Infrastructure Classic metadata (already denied by the special-purpose 192.0.0.0/24; listed for its reason) Oracle

An IPv4 entry is denied in its IPv4-mapped IPv6 form too (the guard unmaps first), and a DNS name that resolves to an entry, such as metadata.google.internal, is denied at registration and at dial time.

Not on the list: fd00:100::100:200, an Alibaba Cloud IPv6 metadata address named only in a cloud-init issue and an unmerged cloud-init PR; Alibaba's metadata pages and its own credential SDKs name only 100.100.100.200.

Comments and docs

  • guard.go (TargetGuard.AllowPrivate, metadataAddrs), cmd/openstorage/config.go, internal/sync/worker.go, internal/sync/egress.go and cmd/openstorage/wire_eventing.go list RFC 6598 shared space with the admitted classes and state that the cloud metadata endpoints stay denied.
  • The three boot warnings in cmd/openstorage/wire.go name the admitted classes, RFC 6598 included, and say that a cloud metadata endpoint is never a target.
  • docs/reference/configuration.md gets a "Cloud metadata endpoints" section with the list; the sync and webhook sections, the table rows, docs/reference/http-api.md, docs/how-to/deploy-production.md, ADR-45 (a new paragraph), README.md and internal/events/README.md point to it. The sync true value also names the other addresses that stay denied (multicast, broadcast, unspecified, zone-scoped, IPv6 outside 2000::/3), and the unset default says that pulls admit what true admits: two P3 points from the review of docs(sync): name OPENSTORAGE_SYNC_ALLOW_PRIVATE for push destinations #897.

Evidence

  • Tests:
    • TestTargetGuardDeniesCloudMetadataUnderEveryPolicy (internal/events): each of the 17 addresses, and each IPv4 one in its mapped form, with AllowPrivate off and on: deniedReason, dial time for the literal and for a name that resolves to it, CheckHost and CheckRegistration.
    • TestTargetGuardMetadataNeighborsKeepTheirClass: the addresses next to the endpoints (100.100.100.201, 169.254.170.3, fd20:ce::255, …) stay admitted with AllowPrivate and keep their class's reason without it, so each entry is one address.
    • TestEgressProxyDeniesCloudMetadataUnderEveryPolicy (internal/sync): the sync egress proxy answers 403 to CONNECT and to an absolute-form request for five endpoints, with the private hatch off and on.
    • TestRegistrationDeniesCloudMetadataWithPrivateAllowed (internal/api): with private targets admitted, POST /repos with upstream.host http://100.100.100.200, http://169.254.170.2 or http://[fd20:ce::254], and POST /webhooks to 100.100.100.200, 169.254.170.23 or [fd00:ec2::23], answer 400 cloud metadata address and store nothing.
  • Red on main (main's guard.go overlaid): every allow_private case of the guard and proxy tests fails, and so does every case whose reason differs; the sync create to 100.100.100.200 answers 201, and the proxy dials 100.100.100.200 and 169.254.170.2 (10 s connect timeout).
  • Lanes: go test -race -tags=openstorage_viewcheck of ./internal/events/... (21 s), ./internal/sync/... (75 s) and ./internal/api/... without pg (362 s) pass at 8f097c7; b07b4d1, 6a333c5 and 8ba58a3 add three addresses, docs and tests; at each of them ./internal/events/... and the egress tests of ./internal/sync pass with -race, and the api metadata test passes. PostgreSQL and S3-WAL rely on CI.
  • lint (internal/events, internal/sync, internal/api, cmd/openstorage), vet (linux and darwin), gofmt, the docs gate and both fingerprint gates pass. go test ./cmd/openstorage/ passes (the boot warning tests match on substrings that stay).

Reviews

  • Round 1 (8f097c7): the Codex security review found nothing. The Codex review (P1) and a fresh read-only review both asked for fd00:c1::a9fe:a9fe, which b07b4d1 adds with Oracle's SDK as the source. The review also found a P2 in the docs: the sync true value said that all IPv6 outside 2000::/3 stays denied, but loopback, ULA and link-local are admitted. b07b4d1 fixes it with four P3 points: a source for 169.254.169.254 in guard.go, 192.0.0.192 has no private class around it, a boot warning test that pins the new text, and a ragged line. The reviewer's 18 overlay mutants (each address dropped, the metadata case moved after the private cases or before Unmap, gated on the policy) all failed the tests.

  • Round 2 (b07b4d1): the Codex review and the Codex security review found nothing. A fresh read-only review found one P2: Google documents 169.254.169.252 as the GKE metadata server, and the guard admitted it under private-admitting policies. 6a333c5 adds it, with three P3 points: the sync egress test records a denial for each request, the configuration reference says that an IPv4-mapped address counts as its IPv4 address, and a long line is rewrapped. Not changed: no test pins the webhook boot warning (it is logged inline in buildAPIHandler), and ADR-44 keeps its generic list.

  • Round 3 (6a333c5): the Codex review and a fresh read-only review (PASS) found nothing new in the code. The Codex security review (P2) asked for Azure's WireServer, 168.63.129.16, citing Microsoft's Metadata Security Protocol overview, which lists it with the Instance Metadata Service as serving metadata and bootstrapping VM credentials. 8ba58a3 adds it: it is a public address, so it was admitted even under the strict default. That commit also adds the Hetzner source for fe80::a9fe:a9fe and moves an older guard test from 100.100.100.200 to 100.100.100.201. All six Codex requests of this PR are used, so this last head has no Codex pass; a fresh read-only review covers it.

  • Round 4 (8ba58a3): a fresh read-only review: PASS. Its overlay mutants (main's guard, WireServer dropped, a /24 in its place, metadata before Unmap, metadata only with AllowPrivate) all failed the tests. Four wording points follow up in the desk's docs PR: deploy-production.md and the webhook false bullet still file the metadata endpoints under the public or IANA ranges, ADR-45 says that the private classes hold them all, and the guard.go note on 168.63.129.16 reads as past tense.

  • Left open (P3): no test pins the webhook boot warning text (it is logged inline in buildAPIHandler); ADR-44 keeps its generic list; the webhook half of the api test fails on main only after the sync half (the events test covers it).

Found by the reviews of #897 (desk follow-up).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

…licy

The egress guard denied only 169.254.169.254 and fd00:ec2::254 when an
operator admits private targets (OPENSTORAGE_WEBHOOK_ALLOW_PRIVATE,
OPENSTORAGE_SYNC_ALLOW_PRIVATE, and the transitional pull default). The
other metadata and credential endpoints of the major clouds sit inside
the classes that the policy admits: Alibaba Cloud's 100.100.100.200 in
RFC 6598 shared space, AWS ECS and EKS, Tencent Cloud and Scaleway in
169.254/16, Google Cloud and Scaleway IPv6 in ULA space, and OpenStack's
fe80::a9fe:a9fe in IPv6 link-local space. With private targets admitted,
a webhook or a sync link could reach them.

deniedReason now denies one list of single addresses, metadataAddrs,
whatever the policy; each entry cites the provider's documentation. The
classes around them stay admitted. The comments, the boot warnings, the
configuration and deployment docs and ADR-45 list RFC 6598 shared space
with the admitted classes and state the metadata rule; the configuration
reference gets the list.

Signed-off-by: Thomas Kosiewski <tk@coder.com>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

Change-Id: I1d3933353e9b897a8a669325f992763d0094cb2b
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T22:28:46.397497Z 6a333c5 Manual request
🔒 Security Review ✅ Completed 2026-11-16T22:35:06.641969Z 6a333c5 Manual request

Security findings

Advisory findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f097c7bd1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/events/guard.go Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 8f097c7bd1

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

fd00:c1::a9fe:a9fe is the IPv6 metadata and instance-principal
credential endpoint that Oracle's own SDK (oci-python-sdk,
IMDS_IPV6_HOST) and cloud-init use; Oracle's metadata page names only
169.254.169.254. It lies in ULA space, so private-admitting policies
reached it.

The docs no longer say that every IPv6 address outside 2000::/3 stays
denied under `true` (loopback, ULA and link-local are admitted), nor
that each entry has a private class around it (192.0.0.192 has none).
The guard comment cites AWS for 169.254.169.254, and the boot warning
test pins the new text.

Signed-off-by: Thomas Kosiewski <tk@coder.com>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

Change-Id: Icd1f32804db687427a41dbc7b6b74609227be878
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: b07b4d1ffc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: b07b4d1ffc

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

169.254.169.252 is the GKE metadata server that Pods reach for
Workload Identity (ports 988 and 987, in Google's network policy
guide). It lies in 169.254/16, so private-admitting policies reached it.

The sync egress test now records a denial for each request, the
configuration reference says that an IPv4-mapped address counts as its
IPv4 address, and a long line is rewrapped.

Signed-off-by: Thomas Kosiewski <tk@coder.com>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

Change-Id: Ic7df241bc27ab3f3b5321959a943abe0381bf97f
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 6a333c51a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: 6a333c51a8

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread internal/events/guard.go Resolved
Microsoft lists WireServer (168.63.129.16) with the Instance Metadata
Service as serving metadata and bootstrapping VM credentials, in its
Metadata Security Protocol overview. It is a public address, so every
policy admitted it, the strict default too. It is denied now under every
policy; its neighbours stay public.

The guard comment cites Hetzner for fe80::a9fe:a9fe, and an older guard
test that named 100.100.100.200 as a plain shared-space target uses
100.100.100.201.

Signed-off-by: Thomas Kosiewski <tk@coder.com>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

Change-Id: Iaad16b9e8def9cc74e97acd7886b9c48ddbc5ef9
Signed-off-by: Thomas Kosiewski <tk@coder.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant