Page MenuHomePhabricator

D8345.id19841.diff
No OneTemporary

D8345.id19841.diff

Index: src/applications/passphrase/controller/PassphraseCredentialRevealController.php
===================================================================
--- src/applications/passphrase/controller/PassphraseCredentialRevealController.php
+++ src/applications/passphrase/controller/PassphraseCredentialRevealController.php
@@ -35,6 +35,7 @@
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel(pht('Plaintext'))
+ ->setReadOnly(true)
->setValue($credential->getSecret()->openEnvelope()));
} else {
$body = pht('This credential has no associated secret.');
@@ -46,6 +47,17 @@
->appendChild($body)
->addCancelButton($view_uri, pht('Done'));
+ $type_secret = PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET;
+ $xactions = array(id(new PassphraseCredentialTransaction())
+ ->setTransactionType($type_secret)
+ ->setNewValue(true));
+
+ $editor = id(new PassphraseCredentialTransactionEditor())
+ ->setActor($viewer)
+ ->setContinueOnNoEffect(true)
+ ->setContentSourceFromRequest($request)
+ ->applyTransactions($credential, $xactions);
+
return id(new AphrontDialogResponse())->setDialog($dialog);
}
Index: src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php
===================================================================
--- src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php
+++ src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php
@@ -14,6 +14,7 @@
$types[] = PassphraseCredentialTransaction::TYPE_USERNAME;
$types[] = PassphraseCredentialTransaction::TYPE_SECRET_ID;
$types[] = PassphraseCredentialTransaction::TYPE_DESTROY;
+ $types[] = PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET;
return $types;
}
@@ -35,6 +36,8 @@
return $object->getSecretID();
case PassphraseCredentialTransaction::TYPE_DESTROY:
return $object->getIsDestroyed();
+ case PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET:
+ return null;
}
return parent::getCustomTransactionOldValue($object, $xaction);
@@ -49,6 +52,7 @@
case PassphraseCredentialTransaction::TYPE_USERNAME:
case PassphraseCredentialTransaction::TYPE_SECRET_ID:
case PassphraseCredentialTransaction::TYPE_DESTROY:
+ case PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET:
return $xaction->getNewValue();
}
return parent::getCustomTransactionNewValue($object, $xaction);
@@ -92,6 +96,8 @@
case PhabricatorTransactions::TYPE_EDIT_POLICY:
$object->setEditPolicy($xaction->getNewValue());
return;
+ case PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET:
+ return;
}
return parent::applyCustomInternalTransaction($object, $xaction);
@@ -107,6 +113,7 @@
case PassphraseCredentialTransaction::TYPE_USERNAME:
case PassphraseCredentialTransaction::TYPE_SECRET_ID:
case PassphraseCredentialTransaction::TYPE_DESTROY:
+ case PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
return;
Index: src/applications/passphrase/storage/PassphraseCredentialTransaction.php
===================================================================
--- src/applications/passphrase/storage/PassphraseCredentialTransaction.php
+++ src/applications/passphrase/storage/PassphraseCredentialTransaction.php
@@ -8,6 +8,7 @@
const TYPE_USERNAME = 'passphrase:username';
const TYPE_SECRET_ID = 'passphrase:secretID';
const TYPE_DESTROY = 'passphrase:destroy';
+ const TYPE_LOOKEDATSECRET = 'passphrase:lookedAtSecret';
public function getApplicationName() {
return 'passphrase';
@@ -28,6 +29,8 @@
return ($old === null);
case self::TYPE_USERNAME:
return !strlen($old);
+ case self::TYPE_LOOKEDATSECRET:
+ return false;
}
return parent::shouldHide();
}
@@ -77,6 +80,10 @@
return pht(
'%s destroyed this credential.',
$this->renderHandleLink($author_phid));
+ case self::TYPE_LOOKEDATSECRET:
+ return pht(
+ '%s examined the secret plaintext for this credential.',
+ $this->renderHandleLink($author_phid));
}
return parent::getTitle();
@@ -97,5 +104,4 @@
json_encode($this->getNewValue()));
}
-
}

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 3:39 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711837
Default Alt Text
D8345.id19841.diff (4 KB)

Event Timeline