-
Notifications
You must be signed in to change notification settings - Fork 62
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
Refactor for IO independent protocol implementation #1127
Refactor for IO independent protocol implementation #1127
Conversation
Conventional Commits Report
🚀 Conventional commits found. |
8b98e23
to
91f98e2
Compare
Dependency ReviewThe following issues were found:
Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. License Issuespoetry.lock
Allowed Licenses: 0BSD, AGPL-3.0-or-later, GPL-3.0-or-later, LGPL-2.1, EPL-2.0, Python-2.0, GPL-2.0-or-later, GPL-2.0-only, GPL-3.0-or-later AND LGPL-2.1-only, GPL-3.0-or-later AND LGPL-3.0 AND LGPL-3.0-only, GPL-2.0 AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later, MIT, ISC, Unlicense, Apache-2.0, BSD-3-Clause, BSD-2-Clause, BSD-2-Clause AND MIT, MPL-2.0, CC-BY-4.0, CC-BY-3.0, CC-BY-SA-4.0, CC0-1.0, BSD-2-Clause AND BSD-3-Clause, BSD-3-Clause AND BSD-3-Clause-Clear, MIT OR Apache-2.0, MIT AND Python-2.0, (Apache-2.0 AND BSD-3-Clause) OR (Apache-2.0 AND MIT), (MIT OR Apache-2.0) AND Unicode-DFS-2016, OFL-1.1, Apache-2.0 AND BSD-3-Clause AND MIT AND OFL-1.1, BlueOak-1.0.0, BSL-1.0, Python-2.0.1, MIT AND PSF-2.0, LGPL-2.0-only AND LGPL-2.1-or-later, CAL-1.0 OpenSSF Scorecard
Scanned Manifest Files.github/workflows/ci.yml
poetry.lock
pyproject.toml
|
4c33cef
to
8237b8d
Compare
5e67903
to
4f55c34
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1127 +/- ##
==========================================
- Coverage 97.85% 97.57% -0.28%
==========================================
Files 61 65 +4
Lines 4292 4541 +249
Branches 1047 831 -216
==========================================
+ Hits 4200 4431 +231
- Misses 72 74 +2
- Partials 20 36 +16 ☔ View full report in Codecov by Sentry. |
2ba6b61
to
431ca35
Compare
431ca35
to
fa88c2a
Compare
It seems lxml doesn't support type hints. Thus an additional package needs to be installed.
The file can be str or bytes IO. For example sys.stdout is str IO (TextIO).
Passing an empty string or None has to fail.
If None is allowed the argument must be typed as optional.
The module `gvm.protocols.gmp` should be the main entry point when using python-gvm for GMP.
Allow code like `SomeEnum(OtherEnum.Foo)`. With this change it is possible to reuse enum classes from older gmp versions in new gmp classes.
Some methods and arguments got dropped and all methods create bytes data that is send via a connection class.
We should not rename the methods which would result in requiring adjustments in user code.
This also removes all code providing GMP 20.8 and 21.4.
Drop obsolete tests and adjust tests for enum imports.
While on it also add type hints and rename variables for consistent naming style.
It seems Iterable.__name__ is not defined on Python 3.9.
Allow to version the request classes for specific GMP versions. With this change we can add new requests that are only available for specific GMP versions.
Update tests to just have 22.4 and 22.5.
gvm-cli passes a string to the osp or gmp class via send_command method. Therefore still support this interface.
The types should be used from the protocol module or from the gmp class.
fa88c2a
to
a771cbd
Compare
What
Refactor python-gvm to provide an I/O independent implementation of GMP and drop support for GMP < 22.4.
An IO independent protocol means it is possible to create data for requests. This data is represented as bytes. The bytes can be send via I/O and the response is returned again as bytes.
Currently this doesn't bring much value besides being able to split the actual request generating code into smaller peaces. But at the end it would allow to not only provide a sync implementation but also async implementation of GMP.
Additional Changes:
ifaces
andifaces_allow
arguments fromcreate_user
andmodify_user
modify_scan_config
methodthread
arguments fromcreate_override
,modify_override
,create_note
andmodify_note
SeverityLevel
enum as it was used only for thethread
argumentsWhy
Abstract the request/response generating code from the actual transport of the protocol.
With this PR it is easier again to add version specific protocol code. It requires to add a new
gvm.protocols.gmp.requests
sub module for a new protocol version and to add a protocol class in a GMP version specific new sub module ofgvm.protocols.gmp
.Checklist