PilotUUID non-uniqueness can break Dirac and DiracX
- Dominant language
- Python
- Stars
- 126
- Forks
- 191
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
I think it is a known issue, but if we can add to the fixes of V9..
Currently, Dirac `PilotAgentDB` (as well as DiracX) has a `PilotID` primary key, an `Integer`. Most of the time, we use `PilotJobReferences` instead of `PilotID`, and we even translate the `PilotJobReference` into `PilotID`:
```py
def deletePilot(self, pilotRef, conn=False):
"""Delete Pilot with the given reference from the PilotAgentsDB"""
if isinstance(pilotRef, str):
pilotID = self.__getPilotID(pilotRef)
else:
pilotID = pilotRef
return self.deletePilots([pilotID], conn=conn)
```
With the example above, we will delete a pilot with a `pilotReference`. If for whatever reason there is a duplicate (two pilots with the same reference), we would delete one of them without being sure of which one.
This is an issue later on with DiracX with secrets, because:
- if there is a duplicate by error, one of the pilots won't have a secret
- we could have a race condition where the original pilot doesn't have a secret, and the "malicious" one could obtain a secret
- currently a pilot only knows its reference, not its ID (it's own identity is based on a non-unique string, it is not an identity anymore)
Changes:
```sql
-- From
`PilotJobReference` VARCHAR(255) NOT NULL DEFAULT 'Unknown',
-- To
`PilotJobReference` VARCHAR(255) UNIQUE NOT NULL DEFAULT 'Unknown',
```
Contributor guide
Assessment
This issue has not been assessed yet.