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

CSS-5672 Adds declared caveats to the discharge macaroon. #1047

Merged

Conversation

alesstimec
Copy link
Contributor

Description

Adds declared caveats to the discharge macaroon.

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Test instructions

Notes for code reviewers

@alesstimec alesstimec changed the title Adds declared caveats to the discharge macaroon. CSS-5672 Adds declared caveats to the discharge macaroon. Sep 22, 2023
@kian99 kian99 self-requested a review September 22, 2023 07:39

if allowed {
return []checkers.Caveat{
checkers.DeclaredCaveat(relationString, objectTagString),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the main bit that changed right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

c.Check(ms, qt.HasLen, 2)
c.Assert(ms, qt.HasLen, 2)

declaredCaveats := checkers.InferDeclared(macaroon.MacaroonNamespace, ms)
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of interest is this a mock checker that will always validate the caveat or something? Or where do we setup the permissions for the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nvm, I see the setup function in all the tests is how that's done.

jimmnames "github.com/canonical/jimm/pkg/names"
)

var defaultDischargeExpiry = 15 * time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

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

Much better having these functions moved out

Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

lgtm but i'm rusty on macaroons again honestly

@alesstimec alesstimec merged commit 8e0a1a5 into canonical:feature-rebac Sep 22, 2023
2 checks 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.

3 participants