Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to change encoding used to store a key-value pair in redis. #294

Merged
merged 5 commits into from
Jul 22, 2020

Conversation

jjnicola
Copy link
Member

Some credentials contains utf-8 chars, while the default for openvas
is latin-1. This allows to change the encoding when storing credentials.

@codecov
Copy link

codecov bot commented Jul 17, 2020

Codecov Report

Merging #294 into ospd-openvas-20.08 will decrease coverage by 0.80%.
The diff coverage is 48.71%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           ospd-openvas-20.08     #294      +/-   ##
======================================================
- Coverage               82.71%   81.90%   -0.81%     
======================================================
  Files                       9        9              
  Lines                    1481     1509      +28     
======================================================
+ Hits                     1225     1236      +11     
- Misses                    256      273      +17     
Impacted Files Coverage Δ
ospd_openvas/preferencehandler.py 87.10% <0.00%> (ø)
ospd_openvas/daemon.py 62.24% <44.44%> (-0.67%) ⬇️
ospd_openvas/db.py 96.24% <55.00%> (-3.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab45fcd...ee73c09. Read the comment docs.

@jjnicola jjnicola marked this pull request as ready for review July 17, 2020 14:08
def _add_single_item(
self, name: str, values: Iterable, utf8_enc: Optional[bool] = False
):
''' Changing the encoding format of an existent redis context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
''' Changing the encoding format of an existent redis context
''' Changing the encoding format of an existing redis context

self, openvas_scan_id: str, preferences: Iterable
):
''' Force the usage of the utf-8 encoding, since some credentials
contains specials chars not supported by latin-1 enconding. '''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
contains specials chars not supported by latin-1 enconding. '''
contain special chars not supported by latin-1 encoding. '''

""" Connect to redis to the given database or to the default db 0 .

Arguments:
dbnum: The db number to connect to.
encoding: The enconding to be used to read and write.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
encoding: The enconding to be used to read and write.
encoding: The encoding to be used to read and write.

Sorry, missed this one on the first go.

ArnoStiefvater
ArnoStiefvater previously approved these changes Jul 21, 2020
Some credentials contains utf-8 chars, while the standard for openvas
is latin-1. This allows to change the encoding when storing credentials.
@jjnicola jjnicola merged commit 1f9d6aa into greenbone:ospd-openvas-20.08 Jul 22, 2020
@jjnicola jjnicola deleted the redis-encoding branch July 22, 2020 08:52
ArnoStiefvater pushed a commit to ArnoStiefvater/ospd-openvas that referenced this pull request Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants