Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Conversation

@zapu
Copy link
Contributor

@zapu zapu commented Jun 16, 2020

When current user is an implicit admin in any team, loading kssh configs from Keybase KV store will fail for that team, failing the entire process. KV store is not available unless the user is an explicit member. This PR changes Requester.getAllTeams to skip teams where user is not an explicit member.

@zapu zapu requested a review from mmou June 16, 2020 17:39
@zapu
Copy link
Contributor Author

zapu commented Jun 16, 2020

This probably needs a test or something similar, I've yet to figure out how to do that though. Seems to be working locally, though.

}
for _, m := range memberships {
teams = append(teams, m.FqName)
if m.Role != keybase1.TeamRole_NONE {
Copy link
Contributor

@mmou mmou Jun 17, 2020

Choose a reason for hiding this comment

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

this might be more edge-case safe if we also != TeamRole_RESTRICTEDBOT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should probably also add this in

func (b *Bot) getAllTeams() (teams []string, err error) {

, 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.

And there's also similar code in

func getPrincipals(conf config.Config, sr shared.SignatureRequest) (string, error) {

in sshutils.go

Copy link
Contributor

@mmou mmou Jun 17, 2020

Choose a reason for hiding this comment

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

Good idea, let's move this line to be within both getAllTeams functions.

Copy link
Contributor

@mmou mmou left a comment

Choose a reason for hiding this comment

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

see latest conversation

@zapu
Copy link
Contributor Author

zapu commented Jun 18, 2020

yep thx! I'm still on this but something else also came up today

@zapu
Copy link
Contributor Author

zapu commented Jun 19, 2020

@mmou hey, I changed some things around here and also tested the entire thing using couple of virtual machines and it seems to work! My real account also hit this bug because it's an implicit admins for some subteams.

// GetAllTeams makes an API call and returns list of team names readable for
// current user.
func GetAllTeams(api *kbchat.API) (teams []string, err error) {
// TODO: dedup with same method in keybaseca/bot
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad. I'm so careless :(

@zapu zapu merged commit 1b8ee3a into master Jun 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants