wireapp / wireapp/wire-server

Database inconsistencies for scim / saml users between spar, brig?

Open
#1,147 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
2.8k
Forks
334
Avg merge
1d 7h
Merged PRs (30d)
50

Description

In rare cases after production availability issues, you may get 409 conflict responses for creating new users. Searching for those users with curl on brig or on ES will yield no results.

The 409 conflict can have two possible causes:

  1. SAML NameID (externalId in scim, usually email address); symptom: the error message contains the phrase "externalId is already taken".
  2. Wire handle (userName in scim); symptom: error message contains the user handle in the reason phrase.

The first one is more likely. To confirm, talk to spar's cassandra:

$ /opt/cassandra/bin/cqlsh $(hostname -i) | tee table.dump
> select * from spar.user where issuer='<entity id of the IdP>'

Now press <enter> a few times until you've seen the entire output, then:

$ grep $externaiId table.dump

If this doesn't yield anything, you don't have ruled out case 1.

If it does yield one line, you have a user id. If that user doesn't exist in brig, you have confirmed 1.

Work-around:

delete * from spar.user where issuer='<what you entered above>' and sso_id='<what you found above>'

Fix: coming up!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the 409 conflict and use the documented spar Cassandra query to inspect the affected issuer and SAML user records, then compare them with brig and Elasticsearch. Trace how the stale spar.user record causes the externalId or userName conflict. Done means inconsistent users no longer produce this conflict and the spar, brig, and Elasticsearch records agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
cassandra, elasticsearch
Domain
authentication, backend-api-design, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.