Skip to content

Commit

Permalink
[change] Passphrase shall be only write only
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Jul 25, 2021
1 parent 9abbb5c commit a020222
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openwisp_controller/pki/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Meta:
'organization': {'required': True},
'key_length': {'initial': '2048'},
'digest': {'initial': 'sha256'},
'passphrase': {'write_only': True},
'validity_start': {'default': default_validity_start()},
'validity_end': {'default': default_ca_validity_end()},
}
Expand Down Expand Up @@ -154,6 +155,7 @@ class Meta:
'revoked_at': {'read_only': True},
'key_length': {'initial': '2048'},
'digest': {'initial': 'sha256'},
'passphrase': {'write_only': True},
'validity_start': {'default': default_validity_start()},
'validity_end': {'default': default_cert_validity_end()},
}
Expand Down
2 changes: 2 additions & 0 deletions openwisp_controller/pki/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_ca_list_api(self):
with self.assertNumQueries(4):
r = self.client.get(path)
self.assertEqual(r.status_code, 200)
self.assertNotIn('passphrase', r.content.decode('utf8'))

def test_ca_detail_api(self):
ca1 = self._create_ca(name='ca1', organization=self._get_org())
Expand Down Expand Up @@ -217,6 +218,7 @@ def test_cert_list_api(self):
r = self.client.get(path)
self.assertEqual(r.status_code, 200)
self.assertEqual(Cert.objects.count(), 1)
self.assertNotIn('passphrase', r.content.decode('utf8'))

def test_cert_detail_api(self):
cert1 = self._create_cert(name='cert1')
Expand Down

0 comments on commit a020222

Please sign in to comment.