0001-apiuser-imposes-256-bits-for-signature-key-of-new-us.patch
passerelle/base/models.py | ||
---|---|---|
74 | 74 |
def clean(self): |
75 | 75 |
if self.keytype and not self.key: |
76 | 76 |
raise ValidationError(_('Key can not be empty for type %s.') % self.keytype) |
77 |
if self.keytype == 'SIGN' and len(self.key)*8 < 256: |
|
78 |
raise ValidationError(_('Signature Key length must be at least 256 bits.')) |
|
77 | 79 | |
78 | 80 |
def export_json(self): |
79 | 81 |
return { |
tests/test_manager.py | ||
---|---|---|
125 | 125 |
resp = resp.form.submit() |
126 | 126 |
assert 'Key can not be empty' in resp.text |
127 | 127 | |
128 |
resp = resp.click('Add API User') |
|
129 |
resp.form['username'] = 'bar' |
|
130 |
resp.form['fullname'] = 'Bar' |
|
131 |
resp.form['keytype'] = 'SIGN' |
|
132 |
resp.form['key'] = '123' |
|
133 |
resp = resp.form.submit() |
|
134 |
assert 'Signature Key length must be at least 256 bits.' in resp.text |
|
135 | ||
136 | ||
128 | 137 |
def test_menu_json(app, admin_user): |
129 | 138 |
app.get('/manage/menu.json', status=302) |
130 | 139 | |
131 |
- |