Skip to content

Commit

Permalink
Fix format of email address for saltpack (keybase#22807)
Browse files Browse the repository at this point in the history
* Fix format of email address for saltpack

* Improve SBSAssertion if it's an email assertion

* Double golangci-lint timeout
  • Loading branch information
patrickxb authored Mar 3, 2020
1 parent 430f10e commit 86028f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def testGoBuilds(prefix, packagesToTest) {
println("Running golangci-lint on new code")
fetchChangeTarget()
def BASE_COMMIT_HASH = getBaseCommitHash()
timeout(activity: true, time: 360, unit: 'SECONDS') {
timeout(activity: true, time: 720, unit: 'SECONDS') {
sh "go list -f '{{.Dir}}' ./... | fgrep -v kbfs | fgrep -v protocol | xargs realpath --relative-to=. | xargs golangci-lint run --new-from-rev ${BASE_COMMIT_HASH} --deadline 5m0s"
}
}
Expand Down
13 changes: 13 additions & 0 deletions go/engine/saltpack_encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ func (e *SaltpackEncrypt) Run(m libkb.MetaContext) (err error) {

e.UsedSBS, e.SBSAssertion = kf.UsedUnresolvedSBSAssertion()

if e.UsedSBS {
actx := m.G().MakeAssertionContext(m)
expr, err := libkb.AssertionParse(actx, e.SBSAssertion)
if err == nil {
social, err := expr.ToSocialAssertion()
if err == nil && social.Service == "email" {
// email assertions are pretty ugly, so just return
// the "User" part for easier handling upstream.
e.SBSAssertion = social.User
}
}
}

// This flag determines whether saltpack is used in signcryption (false)
// vs encryption (true) format.
encryptionOnlyMode := false
Expand Down
4 changes: 4 additions & 0 deletions shared/actions/crypto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const onSetRecipients = (state: TypedState, _: TeamBuildingGen.FinishedTeamBuild
const usernames = users.map(user => {
// If we're encrypting to service account that is not proven on keybase set
// (SBS) then we *must* encrypt to ourselves
if (user.serviceId == 'email') {
hasSBS = true
return `[${user.username}]@email`
}
if (user.serviceId !== 'keybase') {
hasSBS = true
return `${user.username}@${user.serviceId}`
Expand Down

0 comments on commit 86028f0

Please sign in to comment.