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

chore(agw): activate mypy code scanning in lte except integ_tests #13187

Merged
merged 1 commit into from Jul 18, 2022

Conversation

ajahl
Copy link
Contributor

@ajahl ajahl commented Jul 5, 2022

Signed-off-by: Alex Jahl alexander.jahl@tngtech.com

Summary

Active MyPy scanning for all Python code in lte except integ_tests (is part of a separate PR) and fix all MyPy related errors.

Test Plan

vagrant@magma$ cd $MAGMA_ROOT/lte/gateway
vagrant@magma$ mypy --ignore-missing-imports python/magma/
vagrant@magma$ bazel test //lte/gateway/python:all
  • Verified S1AP Integration Tests

Additional Information

This change is not backwards-breaking

@pull-request-size pull-request-size bot added the size/L Denotes a Pull Request that changes 100-499 lines. label Jul 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@github-actions github-actions bot added the component: agw Access gateway-related issue label Jul 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

Oops! Looks like you failed the Python Format Check.

Howto

♻️ Updated: ✅ The check is passing the Python Format Check after the last commit.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

feg-workflow

    2 files  203 suites   39s ⏱️
374 tests 374 ✔️ 0 💤 0
388 runs  388 ✔️ 0 💤 0

Results for commit 08bc4e8.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

dp-workflow

14 tests   14 ✔️  4m 0s ⏱️
  1 suites    0 💤
  1 files      0

Results for commit 08bc4e8.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

agw-workflow

615 tests   611 ✔️  4m 27s ⏱️
    2 suites      4 💤
    2 files        0

Results for commit 08bc4e8.

♻️ This comment has been updated with latest results.

@ajahl ajahl marked this pull request as ready for review July 5, 2022 12:16
@ajahl ajahl requested a review from a team July 5, 2022 12:16
@ajahl ajahl requested a review from a team as a code owner July 5, 2022 12:16
@ajahl
Copy link
Contributor Author

ajahl commented Jul 11, 2022

@magma/approvers-agw-pipelined, can someone take a look at this PR? Thanks!

@nstng nstng self-requested a review July 11, 2022 07:44
Copy link
Contributor

@nstng nstng left a comment

Choose a reason for hiding this comment

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

LGTM (% NIT discussed offline, adding return types)

Signed-off-by: Alex Jahl <alexander.jahl@tngtech.com>
return hmac.hexdigest() + iv.hex() + enc.hex()
elif encryption_algorithm == PipelineD.HEConfig.AES256_ECB_HMAC_MD5:
aes_cipher = AES.new(key_val, AES.MODE_ECB)
enc = aes_cipher.encrypt(pad(s).encode('utf-8'))

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic algorithm

The block mode ECB is broken or weak, and should not be used.
return hmac.hexdigest() + enc.hex()
elif encryption_algorithm == PipelineD.HEConfig.GZIPPED_AES256_ECB_SHA1:
aes_cipher = AES.new(key_val, AES.MODE_ECB)
enc = aes_cipher.encrypt(pad(s).encode('utf-8'))

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic algorithm

The block mode ECB is broken or weak, and should not be used.
decrypted = cipher.decrypt(codecs.decode(data[32:], 'hex_codec'))
ret = decrypted.decode("utf-8").strip()
aes_cipher = AES.new(key, AES.MODE_ECB)
decrypted = aes_cipher.decrypt(codecs.decode(data[32:], 'hex_codec'))

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic algorithm

The block mode ECB is broken or weak, and should not be used.
logging.error("Unsupported encryption algorithm")
return ret
aes_cipher = AES.new(key, AES.MODE_ECB)
decrypted = aes_cipher.decrypt(codecs.decode(data[32:], 'hex_codec'))

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic algorithm

The block mode ECB is broken or weak, and should not be used.
@ajahl ajahl merged commit 2836307 into magma:master Jul 18, 2022
emakeev pushed a commit to emakeev/magma that referenced this pull request Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: agw Access gateway-related issue size/L Denotes a Pull Request that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants