[PR #5806] [management] Handle missing NetworkAddresses in peer network range posture check #26812

Open
opened 2026-08-05 07:07:50 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5806
Author: @MichaelUray
Created: 4/6/2026
Status: 🔄 Open

Base: mainHead: fix/posture-check-empty-network-addresses


📝 Commits (2)

  • 9fb3a3b fix(management): handle missing NetworkAddresses in peer network range posture check
  • eda5559 Merge upstream/main into fix/posture-check-empty-network-addresses

📊 Changes

2 files changed (+30 additions, -7 deletions)

View changed files

📝 management/server/posture/network.go (+8 -1)
📝 management/server/posture/network_test.go (+22 -6)

📄 Description

Summary

Peers with empty NetworkAddresses (e.g., older mobile clients that don't report network interfaces) were incorrectly handled by the peer_network_range_check posture check. The check returned an error, which blocked the peer entirely.

Fix: For deny action, allow the peer through (can't confirm it IS in the denied range). For allow action, deny the peer (can't confirm it IS in the allowed range).

Includes updated unit tests.

Checklist

  • Bug fix
  • Create tests that fail without the change: updated existing tests to match new behavior
  • Documentation is not needed — behavioral fix for edge case

By submitting this pull request, I confirm that I have read and agree to the terms of the Contributor License Agreement.

Summary by CodeRabbit

  • Bug Fixes
    • Network posture checks now deterministically apply policy when peers lack address information: Deny actions allow the peer, Allow actions deny the peer, preventing unexpected errors and improving access-decision reliability.
  • Tests
    • Tests updated to reflect the new behavior for peers with no network addresses or connection IPs (no error and adjusted validity expectations).

Fixes #3968 — Posture checks peer network range failed on iPhone
Fixes #4657 — iOS Client loses all routes when Posture Checks are enabled
Related #5437 — Netbird not honoring large peer network ranges


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5806 **Author:** [@MichaelUray](https://github.com/MichaelUray) **Created:** 4/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/posture-check-empty-network-addresses` --- ### 📝 Commits (2) - [`9fb3a3b`](https://github.com/netbirdio/netbird/commit/9fb3a3beda620c452d3087e7efbda143529e4820) fix(management): handle missing NetworkAddresses in peer network range posture check - [`eda5559`](https://github.com/netbirdio/netbird/commit/eda55599da3d717834309537b2c3d1b60078b10b) Merge upstream/main into fix/posture-check-empty-network-addresses ### 📊 Changes **2 files changed** (+30 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `management/server/posture/network.go` (+8 -1) 📝 `management/server/posture/network_test.go` (+22 -6) </details> ### 📄 Description ## Summary Peers with empty NetworkAddresses (e.g., older mobile clients that don't report network interfaces) were incorrectly handled by the `peer_network_range_check` posture check. The check returned an error, which blocked the peer entirely. Fix: For `deny` action, allow the peer through (can't confirm it IS in the denied range). For `allow` action, deny the peer (can't confirm it IS in the allowed range). Includes updated unit tests. ## Checklist - [x] Bug fix - [x] Create tests that fail without the change: updated existing tests to match new behavior - [x] Documentation is **not needed** — behavioral fix for edge case By submitting this pull request, I confirm that I have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Network posture checks now deterministically apply policy when peers lack address information: Deny actions allow the peer, Allow actions deny the peer, preventing unexpected errors and improving access-decision reliability. * **Tests** * Tests updated to reflect the new behavior for peers with no network addresses or connection IPs (no error and adjusted validity expectations). <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Related Issues Fixes #3968 — Posture checks peer network range failed on iPhone Fixes #4657 — iOS Client loses all routes when Posture Checks are enabled Related #5437 — Netbird not honoring large peer network ranges --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 07:07:50 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#26812