Added compromised state to database

Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
fnuesse 2019-01-08 21:23:27 +01:00
parent 5733031bcd
commit deee11f454
No known key found for this signature in database
GPG key ID: 2089A3431243E819
7 changed files with 30 additions and 8 deletions

View file

@ -229,6 +229,10 @@
<type>boolean</type> <type>boolean</type>
<default>false</default> <default>false</default>
</field> </field>
<field>
<name>compromised</name>
<type>clob</type>
</field>
<field> <field>
<name>shared_key</name> <name>shared_key</name>
<type>clob</type> <type>clob</type>

View file

@ -19,7 +19,7 @@ Features:
- Import from various password managers (KeePass, LastPass, DashLane, ZOHO, Clipperz.is ) - Import from various password managers (KeePass, LastPass, DashLane, ZOHO, Clipperz.is )
For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc) For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
]]></description> ]]></description>
<version>2.2.1</version> <version>2.2.7</version>
<licence>agpl</licence> <licence>agpl</licence>
<author homepage="https://github.com/brantje">Sander Brand</author> <author homepage="https://github.com/brantje">Sander Brand</author>
<author homepage="https://github.com/animalillo">Marcos Zuriaga</author> <author homepage="https://github.com/animalillo">Marcos Zuriaga</author>
@ -42,8 +42,8 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
<database>pgsql</database> <database>pgsql</database>
<database min-version="5.5">mysql</database> <database min-version="5.5">mysql</database>
<lib>openssl</lib> <lib>openssl</lib>
<nextcloud min-version="14" max-version="15"/> <nextcloud min-version="14" max-version="16"/>
<owncloud min-version="14" max-version="15"/> <owncloud min-version="14" max-version="16"/>
</dependencies> </dependencies>
<background-jobs> <background-jobs>

View file

@ -70,7 +70,7 @@ class CredentialController extends ApiController {
$credential_id, $custom_fields, $delete_time, $credential_id, $custom_fields, $delete_time,
$description, $email, $expire_time, $favicon, $files, $guid, $description, $email, $expire_time, $favicon, $files, $guid,
$hidden, $label, $otp, $password, $renew_interval, $hidden, $label, $otp, $password, $renew_interval,
$tags, $url, $username, $vault_id) { $tags, $url, $username, $vault_id, $compromised) {
$credential = array( $credential = array(
'credential_id' => $credential_id, 'credential_id' => $credential_id,
'guid' => $guid, 'guid' => $guid,
@ -93,6 +93,7 @@ class CredentialController extends ApiController {
'custom_fields' => $custom_fields, 'custom_fields' => $custom_fields,
'otp' => $otp, 'otp' => $otp,
'hidden' => $hidden, 'hidden' => $hidden,
'compromised' => $compromised
); );
@ -125,7 +126,7 @@ class CredentialController extends ApiController {
$credential_id, $custom_fields, $delete_time, $credential_guid, $credential_id, $custom_fields, $delete_time, $credential_guid,
$description, $email, $expire_time, $icon, $files, $guid, $description, $email, $expire_time, $icon, $files, $guid,
$hidden, $label, $otp, $password, $renew_interval, $hidden, $label, $otp, $password, $renew_interval,
$tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key, $skip_revision) { $tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key, $skip_revision, $compromised) {
$storedCredential = $this->credentialService->getCredentialByGUID($credential_guid); $storedCredential = $this->credentialService->getCredentialByGUID($credential_guid);
@ -151,7 +152,8 @@ class CredentialController extends ApiController {
'delete_time' => $delete_time, 'delete_time' => $delete_time,
'hidden' => $hidden, 'hidden' => $hidden,
'otp' => $otp, 'otp' => $otp,
'user_id' => $storedCredential->getUserId() 'user_id' => $storedCredential->getUserId(),
'compromised' => $compromised
); );

View file

@ -105,6 +105,9 @@
} }
angular.merge($scope.active_vault.credentials, _credentials); angular.merge($scope.active_vault.credentials, _credentials);
$scope.show_spinner = false; $scope.show_spinner = false;
console.log($scope.active_vault.credentials)
$rootScope.$broadcast('credentials_loaded'); $rootScope.$broadcast('credentials_loaded');
$rootScope.vaultCache[$scope.active_vault.guid] = angular.copy($scope.active_vault); $rootScope.vaultCache[$scope.active_vault.guid] = angular.copy($scope.active_vault);
if(!vault.private_sharing_key){ if(!vault.private_sharing_key){

View file

@ -55,9 +55,10 @@
'files': [], 'files': [],
'custom_fields': [], 'custom_fields': [],
'otp': {}, 'otp': {},
'compromised': false,
'hidden': false 'hidden': false
}; };
var _encryptedFields = ['description', 'username', 'password', 'files', 'custom_fields', 'otp', 'email', 'tags', 'url']; var _encryptedFields = ['description', 'username', 'password', 'files', 'custom_fields', 'otp', 'email', 'tags', 'url', 'compromised'];
return { return {
@ -140,8 +141,14 @@
var fieldValue = angular.copy(credential[field]); var fieldValue = angular.copy(credential[field]);
var field_decrypted_value; var field_decrypted_value;
try { try {
field_decrypted_value = EncryptService.decryptString(fieldValue, key); if(fieldValue!==null){
field_decrypted_value = EncryptService.decryptString(fieldValue, key);
}else{
field_decrypted_value=null;
}
} catch (e) { } catch (e) {
console.log(fieldValue)
console.log(e)
throw e; throw e;
} }
try { try {

View file

@ -70,6 +70,8 @@ use \OCP\AppFramework\Db\Entity;
* @method string getHidden() * @method string getHidden()
* @method void setSharedKey(string $value) * @method void setSharedKey(string $value)
* @method string getSharedKey() * @method string getSharedKey()
* @method void setCompromised(bool $value)
* @method bool getCompromised()
@ -101,6 +103,7 @@ class Credential extends Entity implements \JsonSerializable{
protected $otp; protected $otp;
protected $hidden; protected $hidden;
protected $sharedKey; protected $sharedKey;
protected $compromised;
public function __construct() { public function __construct() {
// add types in constructor // add types in constructor
@ -142,6 +145,7 @@ class Credential extends Entity implements \JsonSerializable{
'otp' => $this->getOtp(), 'otp' => $this->getOtp(),
'hidden' => $this->getHidden(), 'hidden' => $this->getHidden(),
'shared_key' => $this->getSharedKey(), 'shared_key' => $this->getSharedKey(),
'compromised' => $this->getCompromised()
]; ];
} }
} }

View file

@ -138,6 +138,7 @@ class CredentialMapper extends Mapper {
$credential->setCustomFields($raw_credential['custom_fields']); $credential->setCustomFields($raw_credential['custom_fields']);
$credential->setOtp($raw_credential['otp']); $credential->setOtp($raw_credential['otp']);
$credential->setHidden($raw_credential['hidden']); $credential->setHidden($raw_credential['hidden']);
$credential->setCompromised($raw_credential['compromised']);
if (isset($raw_credential['shared_key'])) { if (isset($raw_credential['shared_key'])) {
$credential->setSharedKey($raw_credential['shared_key']); $credential->setSharedKey($raw_credential['shared_key']);
} }
@ -177,6 +178,7 @@ class CredentialMapper extends Mapper {
$credential->setOtp($raw_credential['otp']); $credential->setOtp($raw_credential['otp']);
$credential->setHidden($raw_credential['hidden']); $credential->setHidden($raw_credential['hidden']);
$credential->setDeleteTime($raw_credential['delete_time']); $credential->setDeleteTime($raw_credential['delete_time']);
$credential->setCompromised($raw_credential['compromised']);
if (isset($raw_credential['shared_key'])) { if (isset($raw_credential['shared_key'])) {
$credential->setSharedKey($raw_credential['shared_key']); $credential->setSharedKey($raw_credential['shared_key']);