ssh-keys: further sanitize data of inputted SSH keys.

This commit is contained in:
Marcin Kuzminski 2018-05-16 23:01:46 +02:00
parent b5d6ed7f04
commit 10cf433145
3 changed files with 4 additions and 3 deletions

View file

@ -826,7 +826,7 @@ class UsersView(UserAppView):
fingerprint = key.hash_md5()
ssh_key = SshKeyModel().create(
c.user.user_id, fingerprint, key_data, description)
c.user.user_id, fingerprint, key.keydata, description)
ssh_key_data = ssh_key.get_api_data()
audit_logger.store_web(

View file

@ -98,7 +98,7 @@ class MyAccountSshKeysView(BaseAppView, DataGridAppView):
fingerprint = key.hash_md5()
ssh_key = SshKeyModel().create(
c.user.user_id, fingerprint, key_data, description)
c.user.user_id, fingerprint, key.keydata, description)
ssh_key_data = ssh_key.get_api_data()
audit_logger.store_web(

View file

@ -87,7 +87,8 @@ def _generate_ssh_authorized_keys_file(
# replace all newline from ends and inside
safe_key_data = user_key.ssh_key_data\
.strip()\
.replace('\n', ' ')\
.replace('\n', ' ') \
.replace('\t', ' ') \
.replace('\r', ' ')
line = line_tmpl.format(