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

IAPL schema generation #106

Merged
merged 14 commits into from
Jun 15, 2023
Merged

Conversation

jnschaeffer
Copy link
Contributor

@jnschaeffer jnschaeffer commented Jun 13, 2023

This PR updates permissions-api to use the Infratographer authorization policy language (final name TBD) as defined in this design document: https://gist.github.com/jnschaeffer/29df29ee3fc8aca905cafb45919e9843

The overall goal here is to move towards an external policy being provided to permissions-api, then modified with some resources like roles and subjects that permissions-api needs to do its job. Some work in that realm that is explicitly out of scope for this PR:

  • External policy definition and consumption
  • Moving from URNs to prefixed IDs for resources
  • Moving to new Infratographer message formats

These items will be addressed in subsequent PRs.

Copy link
Contributor

@fishnix fishnix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start to me - just a few comments so far.

internal/iapl/policy.go Outdated Show resolved Hide resolved
internal/iapl/policy.go Outdated Show resolved Hide resolved
internal/iapl/policy.go Show resolved Hide resolved
internal/iapl/policy.go Outdated Show resolved Hide resolved
return &out
}

func (v *policy) validateTypeAliases() error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for a nil policy? here and below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I don't like to do nil checks for pointer receivers unless there's a legitimate reason they could be nil. In this case there isn't, so a panic would be the expected result for me if someone tried to call validateTypeAliases() on a nil policy.

internal/spicedbx/schema.go Outdated Show resolved Hide resolved
jnschaeffer and others added 6 commits June 14, 2023 16:28
Signed-off-by: John Schaeffer <[email protected]>
Signed-off-by: John Schaeffer <[email protected]>
Co-authored-by: E Camden Fisher <[email protected]>
Signed-off-by: John Schaeffer <[email protected]>
Copy link
Contributor

@fishnix fishnix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reran the tests, looks like they are still failing - otherwise lgtm 👍

Signed-off-by: John Schaeffer <[email protected]>
internal/iapl/policy.go Outdated Show resolved Hide resolved
internal/iapl/default.go Outdated Show resolved Hide resolved
internal/iapl/default.go Outdated Show resolved Hide resolved
internal/iapl/policy.go Outdated Show resolved Hide resolved
internal/iapl/errors.go Outdated Show resolved Hide resolved
internal/iapl/policy.go Outdated Show resolved Hide resolved
@jnschaeffer jnschaeffer marked this pull request as ready for review June 15, 2023 18:30
@jnschaeffer jnschaeffer requested review from a team as code owners June 15, 2023 18:30
@jnschaeffer jnschaeffer changed the title [WIP] First pass at IAPL schema generation IAPL schema generation Jun 15, 2023
@jnschaeffer jnschaeffer merged commit d80de5a into infratographer:main Jun 15, 2023
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.

3 participants