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

Ignore implicit memberships in Requester.getAllTeams - #101

Merged
zapu merged 3 commits into
masterfrom
zapu/implicit-admin-bug
Jun 20, 2020
Merged

zapu merged 3 commits into
masterfrom
zapu/implicit-admin-bug

Conversation

@zapu

@zapu zapu commented Jun 16, 2020

Copy link
Copy Markdown
Contributor

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

zapu commented Jun 16, 2020

Copy link
Copy Markdown
Contributor Author

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.

Comment thread src/kssh/requester.go Outdated
}
for _, m := range memberships {
teams = append(teams, m.FqName)
if m.Role != keybase1.TeamRole_NONE {

@mmou mmou Jun 17, 2020 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

@mmou mmou Jun 17, 2020 •

Copy link
Copy Markdown
Contributor

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.

@mmou mmou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see latest conversation

@zapu

zapu commented Jun 18, 2020

Copy link
Copy Markdown
Contributor Author

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

@zapu

zapu commented Jun 19, 2020

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/shared/teams.go Outdated
// 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
Copy Markdown
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
Copy Markdown
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.

2 participants