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

warehouse, tests: v2 caveats #10888

Closed
wants to merge 2 commits into from
Closed

Conversation

woodruffw
Copy link
Member

WIP.

Closes #10792.

@woodruffw woodruffw added the tokens Issues relating to API tokens label Mar 7, 2022
@woodruffw woodruffw requested a review from di March 7, 2022 19:25
@woodruffw woodruffw self-assigned this Mar 7, 2022
@woodruffw
Copy link
Member Author

woodruffw commented Mar 7, 2022

Specific TODOs:

  • Design the V2 caveat body
  • Allow V2 caveats to be minted (should we replace the current user-created-by-form tokens with them?)
  • Figure out how authentication works with "userless" macaroons (as OIDC-minted ones will be, unless we decide to associate them with the user who enabled the OIDC publisher)

@woodruffw
Copy link
Member Author

Re: v2 caveat body: here's my rough plan:

version: 2
permissions: {
  kind: "user" | "projects"
  projects: [str]?
  not_before: int?
  expires: int?
}

For OIDC-minted tokens, kind would always be "projects" and not_before and expires will always be present.

@woodruffw
Copy link
Member Author

I'm going to repurpose this PR to generally refactor how Macaroons are handled in Warehouse. In particular:

  • It's wasteful and inflexible of us to store the entire serialized caveat state with each db.Macaroon model. The only reason we do that is to present a user-friendly table in the account management view; instead, we should store a list of "permission" strings that mirror the permissions of the crafted macaroon.

  • Instead of TopLevelCaveat dispatching to V1Caveat and V2Caveat, we should fully leverage Macaroons' ability to have multiple first-party caveats. In other words, both V1Caveat and V2Caveat should be registered via satisfy_general. That, in turn, will have implications for how we actually structure "v2" caveats.

@di
Copy link
Member

di commented Mar 17, 2022

Going to dismiss my review request until those changes are made!

@di di removed their request for review March 17, 2022 19:01
@woodruffw
Copy link
Member Author

I'm gonna close this and start anew, since the TopLevelCaveat decision was an initial misdesign.

@woodruffw woodruffw closed this Apr 5, 2022
@woodruffw woodruffw deleted the tob-v2-caveat branch April 5, 2022 17:29
@woodruffw
Copy link
Member Author

Replacement #11122.

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

Successfully merging this pull request may close these issues.

Update Macaroon claims/constraints for OIDC token minting
2 participants