Home GnuPG

Make csprintf() return an object, not a string
e953f5c073a6Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

Make csprintf() return an object, not a string

Summary:
See discussion in D6364. This didn't turn out to be as bad as I thought.

Make csprintf() return an object which implements __toString(), but renders in either masked or unmasked modes.

The only downside to this approach is that you must use "%P". It is otherwise completey effective in masking sensitive information, even from logs and traces:

>>> [25] <exec> $ echo 'xxxxx'
<<< [25] <exec> 3,246 us
>>> [26] <exec> $ sh -c 'sh -c '\''sh -c '\''\'\'''\''echo '\''\'\'''\''\'\''\'\'''\'''\''\'\'''\''xxxxx'\''\'\'''\''\'\''\'\'''\'''\''\'\'''\'''\''\'\'''\'''\'''
<<< [26] <exec> 6,922 us
   PASS   13ms★  testPasswords

This also works in the command-which-runs-a-command case, as above.

Test Plan:

  • Added unit tests.
  • Ran arc unit --everything in libphutil, arcanist and phabricator.
  • Browsed around Diffusion.

Reviewers: btrahan, mbishopim3

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6366

Details

Provenance
epriestley <git@epriestley.com>Authored on Jul 4 2013, 12:13 AM
Parents
rPHUTILff98fffd1396: Allow UNION queries to be detected as reads for CRSF purposes
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHUTILe953f5c073a6: Make csprintf() return an object, not a string (authored by epriestley <git@epriestley.com>).Jul 4 2013, 12:13 AM