# GHSA-7G73-5RRW-446P: Tree listing filters on the owner instead of the requester

- Database: GitHub
- Severity: CVSS 3.1 (Low)
- Published: 2026-08-10
- Modified: 2026-08-10

## Affected versions

- github.com/enchant97/note-mark (Go): through 1.0.2

## Description

## Summary

`TreeService.GetTreeForUser` filters a user's note tree by passing the **tree owner** to `FilteredNodeTree`, where every other access check in the same file passes the **requester**. The filter therefore decides visibility by looking up the wrong principal in each node's access-control list, and an authenticated user who requests someone else's tree can be shown node metadata that the owner has not shared with them.

Filed separately at your request, split out of GHSA-wmf3-35h7-7xhh.

## Where it is

`backend/services/tree.go`, `GetTreeForUser`:

```go
func (s *TreeService) GetTreeForUser(
	optionalAuthUser *core.AuthenticatedUser,
	username core.Username,
) (core.NodeTree, error) {
	nodeTree, err := s.tc.TryGetNodeTreeForUser(username)
	if err != nil {
		return nil, core.ErrNotFound
	}
	if optionalAuthUser == nil {
		return tree.FilteredNodeTree(nodeTree, nil), nil
	} else if optionalAuthUser.Username != string(username) {
		return tree.FilteredNodeTree(nodeTree, &username), nil
	}
	return nodeTree, nil
}
```

`username` is the owner of the tree being fetched. On the branch that handles "an authenticated user who is not the owner", that owner is what gets handed to the filter.

`FilteredNodeTree` treats its second argument as the viewer whose grant is being checked, in `backend/tree/helpers.go`:

```go
func FilteredNode(node core.Node, username *core.Username) *core.Node {
	if node.FrontMatter.AccessControl != nil {
		if node.FrontMatter.AccessControl.PublicRead {
			return &node
		} else if username != nil {
			if _, exists := node.FrontMatter.AccessControl.Users[*username]; exists {
				return &node
			}
		}
	}
	return nil
}
```

So for each node the code asks "is the owner named in this node's ACL", when the question it means to ask is "is the requester named in this node's ACL".

The same file gets it right a few lines further down, in `GetAvailableNodeAccessControlMode`:

```go
if mode, exists := ac.Users[core.Username(optionalAuthUser.Username)]; exists {
```

That is the requester. The inconsistency between the two is what makes this look like an oversight rather than intent.

## Impact

The filter evaluates the wrong identity, so any node whose ACL happens to name the owner becomes visible to every authenticated user who requests that tree. Nothing stops an owner from appearing in their own node's ACL user map, since the map is written from the note's front matter.

I want to be accurate about the limits rather than overstate this. The leak is conditional on ACL contents, not automatic: for a node whose ACL names only third parties, the wrong lookup fails too and the node stays hidden. Content also still returns 404, so what is exposed is node metadata rather than note bodies. That is why I would put this at the low end rather than treat it as a general private-note disclosure.

## Suggested fix

Pass the requester:

```go
} else if optionalAuthUser.Username != string(username) {
	requester := core.Username(optionalAuthUser.Username)
	return tree.FilteredNodeTree(nodeTree, &requester), nil
}
```

That matches what `GetAvailableNodeAccessControlMode` already does and makes the two consistent.

## Verification

Code-traced at HEAD, not executed. I read `GetTreeForUser`, `FilteredNodeTree`, `FilteredNode` and the sibling check in `GetAvailableNodeAccessControlMode`, and confirmed that the owner is passed on the non-owner branch while the sibling uses the requester. I did not stand up an instance and drive two accounts through it, so the conditional impact above is argued from the code rather than demonstrated.

## How I found it and a note on tooling

I was checking whether the identity used for access decisions was consistent across the tree service, which is how the mismatch between these two call sites turned up. I used AI assistance while investigating and verified the finding myself by reading the code path at HEAD.

## References

- https://github.com/enchant97/note-mark/security/advisories/GHSA-7g73-5rrw-446p

Page: https://cve.now/GHSA-7G73-5RRW-446P

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
