2 Commits

Author SHA1 Message Date
eliaskohout 61c8867742 fix: remove global readability of namespace nodes
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Successful in 50s
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Successful in 43s
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 44s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 55s
Build and Publish Docker Image / build-and-push-docker (push) Successful in 10m46s
2026-06-12 16:09:51 +02:00
eliaskohout c1f196640b fix: resolve AX_TOKEN before config user in getNodeService
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Successful in 44s
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Successful in 49s
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 44s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 44s
Build and Publish Docker Image / build-and-push-docker (push) Successful in 10m47s
2026-06-12 15:53:09 +02:00
2 changed files with 21 additions and 7 deletions
+15
View File
@@ -12,6 +12,21 @@ import (
)
func getNodeService() (service.NodeService, error) {
if token := os.Getenv("AX_TOKEN"); token != "" {
if cfg.Remote.Host != "" {
base := fmt.Sprintf("http://%s:%d", cfg.Remote.Host, cfg.Remote.Port)
return service.NewRemoteNodeService(base, ""), nil
}
st, err := store.FindAndOpenSQLiteStore()
if err != nil {
return nil, err
}
agentID := service.LookupAgentToken(st, token)
if agentID == "" {
return nil, fmt.Errorf("invalid AX_TOKEN: agent not found")
}
return service.NewLocalNodeService(st, agentID), nil
}
user := cfg.User
if user == "" {
return nil, fmt.Errorf("no user configured: run 'ax user set <username>' first")
+3 -4
View File
@@ -185,16 +185,15 @@ func (s *nodeServiceImpl) getPermContext() (*permContext, error) {
}
}
// User and namespace nodes are globally readable (they represent identities,
// User nodes are globally readable (they represent identities,
// and anyone can reference or assign to them).
for _, nodeType := range []string{"user", "namespace"} {
nodes, _ := s.store.FindNodes([]*models.Rel{{Type: models.RelType("_type::" + nodeType), Target: ""}})
// Namespace nodes are NOT globally readable; access must be explicitly granted.
nodes, _ := s.store.FindNodes([]*models.Rel{{Type: "_type::user", Target: ""}})
for _, n := range nodes {
if pc.levels[n.ID] < permRead {
pc.levels[n.ID] = permRead
}
}
}
return pc, nil
}