How to avoid a hostile takeover of first authorship during medical leave? A colleague has approached me with a tough situation. I'm unsure how to advise her. 

She is a postdoc, and will soon take a month-long planned medical leave. Her adviser, a senior research scientist, has a history of reshuffling authorships of papers of his subordinates during leave, sometimes to make himself first author. She had previously hoped to have the paper in question in submission, but “serendipitously” some last minute data is unavailable. Adding to her suspicion, the adviser has asked her to deliver all drafts and all data analysis code before leaving.

Her question, which stumped me: how can she safeguard her present first-author position? I will meet with her at the end of the week (17th) and share this thread with her.

Some details:


This advisor has reshuffled authorship on several previous occasions of which I am aware. He has suffered no disciplinary action from the department in these situations, and has a reputation for working to damage the careers of those that work against him. The unit has a history of turning a blind eye in these situations.
There's very little accountability to be had within this unit. Pieces of proof like emails and widely witnessed public statements are unlikely to be actual safeguards.
The advisor really does control all the inputs and outputs. This is true even after her return: he may switch authorship at that point over any real or perceived failure.
My feeling is the successful path here will involve some clever way to move the power in the situation from his side to her side.
Certainly, she is looking for a exit from the lab. A solution will substantially increase the chances she can take this first authorship with her.
My sense from our discussion is that early drafts and data analysis already shared, but the most recent ones are not yet. That said, the entire situation seems to suggest a lack of trust on all sides.
The distribution of work put into the paper is roughly: 95 % by my colleague, 4 % by another co-author, and 1 % by the supervisor.


EDIT: This has concluded. She used several of the strategies here, documenting extensively. Her adviser remover her from the paper and sent it for publication within 48 hours of her leaving. Upon her recovery, which took somewhat longer than expected, she appealed to the editor and the department. Her adviser ended her postdoc position, citing insufficient funding, and responded to the editor (how I'm unsure). She appealed to the university, which did not intervene. She has had no additional communication from the journal or her old lab. She has left, in some disgust, for an industry job.
I would send an email along the following lines to the supervisor and copied to the person doing the additional piece of work. While not complete protection, this approach provides evidence and also makes it clear that the supervisor should respond if he doesn't intend to wait.

The draft article attached to the email should have a version number and date.


  Dear ...
  
  As requested, I have attached the latest draft of our paper, TITLE.
  It is saved at LOCATION, together with the data and analysis code.
  Unfortunately, I was unable to submit the draft before taking leave as
  planned because the data concerning XYZ was not available.
  
  I understand that OTHER-RESEARCHER is intending to complete his/her part of the
  analysis while I am on leave. I will verify that analysis and
  integrate it with the existing paper as my first task on my return in
  a month. I understand that OTHER-RESEARCHER is willing to draft that section of
  the paper, but as lead author, I want to ensure that it is consistent
  with the existing message and style of the paper. I would therefore
  prefer that the analysis is prepared as a separate document and I will
  integrate it myself.
  
  Assuming that no additional questions are raised by this final
  analysis, I expect to be able to circulate the complete draft within a
  week of my return for submission shortly thereafter. As the analysis
  has already taken NN months, I don't expect this delay to create any
  difficulties, but please let me know if you are concerned about
  waiting until my return for the paper to be completed.


Depending on the reason for the medical leave, it may also be appropriate to add a final paragraph:


  If there are any questions about this work, I am contactable during my
  leave at EMAIL