[PR #2874] [MERGED] policy: fix issue where non existent user results in empty ssh pol #2909

Closed
opened 2025-12-29 04:19:37 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2874
Author: @kradalby
Created: 11/10/2025
Status: Merged
Merged: 11/10/2025
Merged by: @kradalby

Base: mainHead: kradalby/2863-ssh-no-user


📝 Commits (2)

  • 4b71fa1 policy: reproduce 2863 in test
  • 2c74043 policy: fix issue where non existent user results in empty ssh pol

📊 Changes

2 files changed (+49 additions, -1 deletions)

View changed files

📝 hscontrol/policy/policy_test.go (+49 -0)
📝 hscontrol/policy/v2/filter.go (+0 -1)

📄 Description

When we encounter a source we cannot resolve, we skipped the whole rule,
even if some of the srcs could be resolved. In this case, if we had one user
that exists and one that does not.

In the regular policy, we log this, and still let a rule be created from what
does exist, while in the SSH policy we did not.

This commit fixes it so the behaviour is the same.

Fixes https://github.com/juanfont/headscale/issues/2863


🔄 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/juanfont/headscale/pull/2874 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 11/10/2025 **Status:** ✅ Merged **Merged:** 11/10/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/2863-ssh-no-user` --- ### 📝 Commits (2) - [`4b71fa1`](https://github.com/juanfont/headscale/commit/4b71fa1ae88b53b520209608d75cf677cbda4af0) policy: reproduce 2863 in test - [`2c74043`](https://github.com/juanfont/headscale/commit/2c740432cedc54b3691299bd6b386e8691a4c4d0) policy: fix issue where non existent user results in empty ssh pol ### 📊 Changes **2 files changed** (+49 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `hscontrol/policy/policy_test.go` (+49 -0) 📝 `hscontrol/policy/v2/filter.go` (+0 -1) </details> ### 📄 Description When we encounter a source we cannot resolve, we skipped the whole rule, even if some of the srcs could be resolved. In this case, if we had one user that exists and one that does not. In the regular policy, we log this, and still let a rule be created from what does exist, while in the SSH policy we did not. This commit fixes it so the behaviour is the same. Fixes https://github.com/juanfont/headscale/issues/2863 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 04:19:37 +01:00
adam closed this issue 2025-12-29 04:19:37 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2909