[PR #7030] [MERGED] [management] Resolve agent network permissions per submodule #29461

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/7030
Author: @mlsmaycon
Created: 8/2/2026
Status: Merged
Merged: 8/3/2026
Merged by: @mlsmaycon

Base: mainHead: agent-network-permission-submodules


📝 Commits (2)

  • 934e84f [management] Resolve agent network permissions per submodule
  • 6c2411e [management] Gate settings bootstrap on the settings permission

📊 Changes

5 files changed (+372 additions, -30 deletions)

View changed files

📝 management/internals/modules/agentnetwork/manager.go (+49 -28)
management/internals/modules/agentnetwork/provider_bootstrap_test.go (+134 -0)
📝 management/server/permissions/manager.go (+20 -2)
management/server/permissions/manager_test.go (+139 -0)
📝 management/server/permissions/modules/module.go (+30 -0)

📄 Description

Describe your changes

Agent Network gates providers, policies, guardrails, budgets, usage, access logs, and settings behind the single agent_network permission module, so access is all-or-nothing: a future delegated role cannot be scoped to a subset of the area (for example usage-only visibility).

This introduces dotted submodules (agent_network.providers, .policies, .guardrails, .budgets, .usage, .logs, .settings) and resolves grants with a cascade: exact module first, then its parent, then the role's AutoAllowNew default. The agent network manager now validates each operation against its matching submodule. usage (aggregated counters, overview) is deliberately separate from logs (request-level entries, which can contain captured prompts).

No role definitions change. No built-in role carries an explicit agent_network entry, so every role resolves the submodules exactly as it resolved the parent module before — pinned by a test that compares each built-in role's answer on every submodule against its answer on agent_network. Role additions that use these submodules come separately.

NET-1399: Agent Network access roles

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • I ran and tested this change locally — I did not rely on CI to find out whether it works
  • This PR has a single purpose (not a fix + refactor + feature in one)
  • This change is a trivial fix, OR it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See CONTRIBUTING.md.

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

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

No user-facing behavior changes: every existing role keeps identical access, no API surface changes. Docs get updated together with the role additions that build on this.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added granular permissions for Agent Network providers, policies, guardrails, budgets, settings, usage, and access logs.
    • Parent Agent Network permissions cascade to submodules, while submodule-specific grants and denials remain independent.
    • Built-in roles retain their existing Agent Network access across all submodules.
    • Provider setup now supports permission-controlled creation and initialization of required settings.
  • Bug Fixes

    • Improved permission resolution for nested modules, including fallback and automatic access behavior.

🔄 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/7030 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 8/2/2026 **Status:** ✅ Merged **Merged:** 8/3/2026 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `agent-network-permission-submodules` --- ### 📝 Commits (2) - [`934e84f`](https://github.com/netbirdio/netbird/commit/934e84f3f477be218498434c059510af711bb100) [management] Resolve agent network permissions per submodule - [`6c2411e`](https://github.com/netbirdio/netbird/commit/6c2411e17cf7d55a3ecc33bdd6710e86f5afab60) [management] Gate settings bootstrap on the settings permission ### 📊 Changes **5 files changed** (+372 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/modules/agentnetwork/manager.go` (+49 -28) ➕ `management/internals/modules/agentnetwork/provider_bootstrap_test.go` (+134 -0) 📝 `management/server/permissions/manager.go` (+20 -2) ➕ `management/server/permissions/manager_test.go` (+139 -0) 📝 `management/server/permissions/modules/module.go` (+30 -0) </details> ### 📄 Description ## Describe your changes Agent Network gates providers, policies, guardrails, budgets, usage, access logs, and settings behind the single `agent_network` permission module, so access is all-or-nothing: a future delegated role cannot be scoped to a subset of the area (for example usage-only visibility). This introduces dotted submodules (`agent_network.providers`, `.policies`, `.guardrails`, `.budgets`, `.usage`, `.logs`, `.settings`) and resolves grants with a cascade: exact module first, then its parent, then the role's `AutoAllowNew` default. The agent network manager now validates each operation against its matching submodule. `usage` (aggregated counters, overview) is deliberately separate from `logs` (request-level entries, which can contain captured prompts). No role definitions change. No built-in role carries an explicit `agent_network` entry, so every role resolves the submodules exactly as it resolved the parent module before — pinned by a test that compares each built-in role's answer on every submodule against its answer on `agent_network`. Role additions that use these submodules come separately. ## Issue ticket number and link [NET-1399: Agent Network access roles](https://linear.app/netbird/issue/NET-1399/agent-network-access-roles-delegated-admin-usage-viewer-and-user-role) ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] Created tests that fail without the change (if possible) - [x] I ran and tested this change locally — I did not rely on CI to find out whether it works - [x] This PR has a single purpose (not a fix + refactor + feature in one) - [x] This change is a trivial fix, **OR** it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#ticket-first-pr-second). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) No user-facing behavior changes: every existing role keeps identical access, no API surface changes. Docs get updated together with the role additions that build on this. ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: --- _Generated by [Claude Code](https://claude.ai/code/session_01CnQsF7vfgYM7Gr82dwAhd3)_ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added granular permissions for Agent Network providers, policies, guardrails, budgets, settings, usage, and access logs. * Parent Agent Network permissions cascade to submodules, while submodule-specific grants and denials remain independent. * Built-in roles retain their existing Agent Network access across all submodules. * Provider setup now supports permission-controlled creation and initialization of required settings. * **Bug Fixes** * Improved permission resolution for nested modules, including fallback and automatic access behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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 08:08:07 -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#29461