Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTORING] Different data structures for services and rules #1093

Closed
kontsevoy opened this issue Jun 21, 2017 · 1 comment
Closed

[REFACTORING] Different data structures for services and rules #1093

kontsevoy opened this issue Jun 21, 2017 · 1 comment
Assignees
Milestone

Comments

@kontsevoy
Copy link
Contributor

kontsevoy commented Jun 21, 2017

Problem

Teleport code is hard to reason about because it uses word "role" in two completely different contexts.

  1. "Service roles": these are roles for built-in Teleport services such as "Proxy", "Web", "Node", as defined in /roles.go. These are used for creating certificates used by Teleport services to interact with each other. The same roles are used in iconic places like /lib/auth/auth_with_roles.go

  2. "User roles": these are roles assigned to Teleport users. Currently they are implemented using exactly the same data structure (and name) as "service roles". They are, however, separated by having their own "checker", which is awesome, but the data structure itself does not scale well for both service and user purposes.

Re-using the same data structure in both contexts makes it hard to reason about security. One checker (for services) would ignore a lot of fields that are user-specific, etc. Also reading the code makes it hard to understand which role is meant in what context.

Proposal

  • Have two separate data structures: ServiceRole and UserRole. The service role should continue using the format we have now. This basically means that no changes will be introduced to v2.3 to service roles. But UserRole structure should be based on Expanded Role format  #1092

  • Do a code review on pieces that heavily use roles and provide comments and/or rename functions to indicate which role is meant. Role-related code is poorly commented and hard to understand right now

@kontsevoy
Copy link
Contributor Author

This is not needed anymore. Closing. FYI: @klizhentas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants