Skip to content

Add sharing-aware RBAC authorization for secrets#37

Merged
jeffmccune merged 2 commits intomainfrom
feature/secret-sharing-backend
Jan 31, 2026
Merged

Add sharing-aware RBAC authorization for secrets#37
jeffmccune merged 2 commits intomainfrom
feature/secret-sharing-backend

Conversation

@jeffmccune
Copy link
Contributor

Summary

  • Add per-user and per-group sharing grants for secrets using Kubernetes annotations (holos.run/share-users, holos.run/share-groups)
  • Implement CheckAccessSharing() on GroupMapping with email/group grant evaluation and legacy allowedRoles fallback
  • Wire all secret handlers (List, Get, Create, Update, Delete) to use sharing-aware authorization
  • Full test coverage for RoleFromString, CheckAccessSharing, GetShareUsers, GetShareGroups, and all sharing-aware authz wrappers

Test plan

  • All existing tests continue to pass (backward compatibility)
  • New unit tests for RoleFromString (9 cases)
  • New unit tests for CheckAccessSharing (9 cases covering email, group, legacy, case-insensitivity, deny paths)
  • New unit tests for GetShareUsers and GetShareGroups annotation parsing (8 cases)
  • New unit tests for sharing-aware authz wrappers (4 test functions)
  • All tests pass with race detector enabled
  • Container workflow build

🤖 Generated with Claude Code

jeffmccune and others added 2 commits January 29, 2026 22:13
Implement per-user and per-group sharing grants using Kubernetes
annotations (holos.run/share-users, holos.run/share-groups). The
sharing model follows Google Docs-style access: users/groups receive
a role (viewer, editor, owner) granting the corresponding permissions.

- Add RoleFromString() to convert string role names to Role enum
- Add CheckAccessSharing() with email/group grant evaluation and
  legacy allowedRoles fallback
- Add GetShareUsers/GetShareGroups annotation parsing helpers
- Add sharing-aware authz wrappers (CheckReadAccessSharing, etc.)
- Wire all handlers to use sharing-aware authorization
- Full test coverage for all new functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add ShareGrant proto message and UpdateSharing RPC to SecretsService.
The UpdateSharing handler requires owner-level access (PERMISSION_SECRETS_ADMIN)
and persists per-user and per-group sharing grants as Kubernetes annotations.

- Add ShareGrant, UpdateSharingRequest/Response proto messages
- Add UpdateSharing RPC to SecretsService
- Add CheckAdminAccessSharing authz wrapper
- Add K8sClient.UpdateSharing() to persist sharing annotations
- Implement UpdateSharing handler with RBAC and audit logging
- Add helper functions: shareGrantsToMap, buildSecretMetadata, protoRoleFromString
- Full test coverage: 7 handler tests + 2 audit logging tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jeffmccune jeffmccune merged commit 63276e6 into main Jan 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant