Merge pull request #590 from nextcloud/fix/586/decryptionerrors_for_shares_compromised

Fix error where compromised beeing null would disable shares
This commit is contained in:
newhinton 2019-05-19 17:24:33 +02:00 committed by GitHub
commit 9ce3664156
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 88 additions and 23 deletions

View file

@ -127,8 +127,9 @@
if (shareRequests.length > 0) { if (shareRequests.length > 0) {
$scope.incoming_share_requests = shareRequests; $scope.incoming_share_requests = shareRequests;
jQuery('.share_popup').dialog({ jQuery('.share_popup').dialog({
width: 600, width: 800,
position: ['center', 90] modal: true,
dialogClass: 'shareincoming-dialog'
}); });
} }
}); });

View file

@ -152,6 +152,7 @@
$('#iconPicker').dialog({ $('#iconPicker').dialog({
width: 800, width: 800,
height: 380, height: 380,
modal: true,
dialogClass: 'iconpicker-dialog', dialogClass: 'iconpicker-dialog',
close: function() { close: function() {
$(this).dialog('destroy'); $(this).dialog('destroy');

View file

@ -179,9 +179,11 @@
return _credential; return _credential;
}, },
decryptSharedCredential: function (credential, sharedKey) { decryptSharedCredential: function (credential, sharedKey) {
var _credential = angular.copy(credential); var _credential = angular.copy(credential);
var encrypted_fields = CredentialService.getEncryptedFields(); var encrypted_fields = CredentialService.getEncryptedFields();
for (var i = 0; i < encrypted_fields.length; i++) { for (var i = 0; i < encrypted_fields.length; i++) {
var field = encrypted_fields[i]; var field = encrypted_fields[i];
var fieldValue = angular.copy(_credential[field]); var fieldValue = angular.copy(_credential[field]);
var field_decrypted_value; var field_decrypted_value;
@ -189,7 +191,14 @@
try { try {
field_decrypted_value = EncryptService.decryptString(fieldValue, sharedKey); field_decrypted_value = EncryptService.decryptString(fieldValue, sharedKey);
} catch (e) { } catch (e) {
throw e; if(field === 'compromised' && fieldValue === null){
//old shares do not have compromised set, so we need to make sure that it will be set for version 2.3.0
//credentials from 2.3.0 onwards have compromised already set, and don't need to worry about that.
//if compromised is not the issue, break and throw an error
field_decrypted_value=0;
}else{
throw e;
}
} }
try { try {
_credential[field] = JSON.parse(field_decrypted_value); _credential[field] = JSON.parse(field_decrypted_value);

View file

@ -27,6 +27,7 @@
@import 'partials/tabs'; @import 'partials/tabs';
@import 'partials/pwgen'; @import 'partials/pwgen';
@import 'partials/icon-picker'; @import 'partials/icon-picker';
@import 'partials/share-incoming';
@import 'vaults'; @import 'vaults';
@import 'credentials'; @import 'credentials';
@import 'menu'; @import 'menu';

View file

@ -20,7 +20,7 @@
*/ */
.iconpicker-dialog{ .iconpicker-dialog{
border-radius: var(--border-radius-large); border-radius: var(--border-radius-large) !important;
box-shadow: 0 0 30px var(--color-box-shadow); box-shadow: 0 0 30px var(--color-box-shadow);
.ui-dialog{ .ui-dialog{
border-radius: var(--border-radius-large); border-radius: var(--border-radius-large);
@ -45,6 +45,9 @@
.ui-state-default {background: white !important;} .ui-state-default {background: white !important;}
.ui-button {background: white !important;} .ui-button {background: white !important;}
//This moves the modal from tbe background to the foreground so that it is actually visible
z-index: 9999 !important;
} }
#iconPicker { #iconPicker {
@ -90,9 +93,4 @@
.content_show { .content_show {
display: block; display: block;
} }
}
//This moves the modal from tbe background to the foreground so that it is actually visible
.ui-front{
z-index: 9999 !important;
} }

View file

@ -0,0 +1,57 @@
/**
* Nextcloud - passman
*
* @copyright Copyright (c) 2019, Felix Nüsse (felix.nuesse@t-online.de)
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
.shareincoming-dialog{
border-radius: var(--border-radius-large) !important;
box-shadow: 0 0 30px var(--color-box-shadow);
.ui-dialog{
border-radius: var(--border-radius-large);
box-shadow: 0 0 30px var(--color-box-shadow);
}
.ui-widget-header {
background: none !important;
}
.ui-icon-closethick {
background-position: inherit;
}
.ui-button .ui-icon {
background-image: var(--icon-close-000);
}
.ui-button:hover .ui-icon {
background-image: var(--icon-close-000);
cursor: pointer !important;
}
.ui-button-icon {border: none !important;}
.ui-icon {border: none !important;}
.ui-icon-closethick {border: none !important;}
.ui-corner-all {border: none !important;}
.ui-state-default {background: white !important;}
.ui-button {background: white !important;}
//This moves the modal from tbe background to the foreground so that it is actually visible
z-index: 9999 !important;
}

View file

@ -41,6 +41,10 @@
background: none; background: none;
} }
//This moves the modal from tbe background to the foreground so that it is actually visible
z-index: 9999 !important;
//closebutton top right //closebutton top right
.ui-icon-closethick { .ui-icon-closethick {
background-position: inherit; background-position: inherit;
@ -69,8 +73,3 @@
} }
//bottom line end //bottom line end
} }
//This moves the modal from tbe background to the foreground so that it is actually visible
.ui-front{
z-index: 9999 !important;
}

View file

@ -195,17 +195,16 @@
</div> </div>
</div> </div>
<div class="share_popup" style="display: none"> <div class="share_popup" style="display: none" title="{{ 'sharereq.title' | translate }}">
{{ 'sharereq.title' | translate}}<br/> <p>{{ 'sharereq.line1' | translate}} {{ 'sharereq.line2' | translate}}</p>
<p>{{ 'sharereq.line1' | translate}}</p> <br>
{{active_vault.vault_id}}
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<td>{{ 'label' | translate}}</td> <td><b>{{ 'label' | translate}}</b></td>
<td>{{ 'permissions' | translate}}</td> <td><b>{{ 'permissions' | translate}}</b></td>
<td>{{ 'received.from' | translate}}</td> <td><b>{{ 'received.from' | translate}}</b></td>
<td>{{ 'date' | translate}}</td> <td><b>{{ 'date' | translate}}</b></td>
</tr> </tr>
</thead> </thead>
<tr ng-repeat="share_request in incoming_share_requests" <tr ng-repeat="share_request in incoming_share_requests"
@ -223,7 +222,7 @@
{{share_request.created * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}} {{share_request.created * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}
</td> </td>
<td> <td>
<span class="link" ng-click="acceptShareRequest(share_request)">{{ 'accept' | translate}}</span> <span class="link" ng-click="acceptShareRequest(share_request)"><b>{{ 'accept' | translate}}</b></span>
| <span class="link" ng-click="declineShareRequest(share_request)">{{ 'decline' | translate}}</span> | <span class="link" ng-click="declineShareRequest(share_request)">{{ 'decline' | translate}}</span>
</td> </td>
</tr> </tr>