Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14766173
D10414.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10414.id.diff
View Options
diff --git a/src/applications/passphrase/controller/PassphraseCredentialEditController.php b/src/applications/passphrase/controller/PassphraseCredentialEditController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialEditController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialEditController.php
@@ -155,8 +155,13 @@
->setTransactionType($type_username)
->setNewValue($v_username);
- $min_secret = str_replace($bullet, '', trim($v_decrypt));
- if (strlen($min_secret)) {
+ // If some value other than a sequence of bullets was provided for
+ // the credential, update it. In particular, note that we are
+ // explicitly allowing empty secrets: one use case is HTTP auth where
+ // the username is a secret token which covers both identity and
+ // authentication.
+
+ if (!preg_match('/^('.$bullet.')+$/', trim($v_decrypt))) {
// If the credential was previously destroyed, restore it when it is
// edited if a secret is provided.
$xactions[] = id(new PassphraseCredentialTransaction())
diff --git a/src/applications/passphrase/controller/PassphraseCredentialRevealController.php b/src/applications/passphrase/controller/PassphraseCredentialRevealController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialRevealController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialRevealController.php
@@ -46,16 +46,19 @@
}
if ($request->isFormPost()) {
- if ($credential->getSecret()) {
+ $secret = $credential->getSecret();
+ if (!$secret) {
+ $body = pht('This credential has no associated secret.');
+ } else if (!strlen($secret->openEnvelope())) {
+ $body = pht('This credential has an empty secret.');
+ } else {
$body = id(new PHUIFormLayoutView())
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel(pht('Plaintext'))
->setReadOnly(true)
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
- ->setValue($credential->getSecret()->openEnvelope()));
- } else {
- $body = pht('This credential has no associated secret.');
+ ->setValue($secret->openEnvelope()));
}
// NOTE: Disable workflow on the cancel button to reload the page so
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 24, 4:14 PM (17 h, 58 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7041637
Default Alt Text
D10414.id.diff (2 KB)
Attached To
Mode
D10414: Allow Passphrase to store empty secrets
Attached
Detach File
Event Timeline
Log In to Comment