oliver-zehentleitner / maity
runner: scratchop's password-file ops share one 'file we vouch for' check
tsk-dj6cm7teptyr Proposed
Audit round 4 (tsk-hgnbapyw7hnh), read at 0a1b832e. Kind: duplication.
What is wrong
- The rule for a password file the runner vouches for (regular file, this user's uid, mode exactly 0600, one link) is written twice in
runner/scratchop.py:_pg_vouched(scratchop.py:213-217, onos.stat(..., follow_symlinks=False)) used bypg_make, and inline inpg_read(scratchop.py:270-275, onos.fstat(fd)). A change to one (say, the mode) would letpg_makereportpg_pass: truefor a filepgenvthen refuses, or the other way round, and the session silently gets no cluster.
Proposal
- One predicate over a
stat_result, e.g._vouched(st) -> bool, called with theos.statresult inpg_makeand theos.fstatresult inpg_read.
Effort / risk: S. Low; test_scratchop covers both paths.