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

new jwt decode verify codemod #27

Merged
merged 8 commits into from
Sep 26, 2023
Merged

new jwt decode verify codemod #27

merged 8 commits into from
Sep 26, 2023

Conversation

clavedeluna
Copy link
Contributor

@clavedeluna clavedeluna commented Sep 7, 2023

Overview

Add a codemod that will check either the verify (soon to be deprecated) flag to jwt.decode and/or the multiple verify_* kwargs in the options param

Description

  • see docs
  • We already had an api solution to flip to verify=True, but for options={...verify...} I had to write some codemod-specific code. Maybe it can be generalized later on.
  • I also think I have covered many edge cases, such as other keys to options, a mixture of verify flag and options, etc.

Additional Details

  • Any follow up tickets or discussion
  • Any specific merge / deploy details

@clavedeluna clavedeluna marked this pull request as ready for review September 7, 2023 15:40
@clavedeluna
Copy link
Contributor Author

@drdavella This is as ready as I can get it. I'm hoping the pipeline will pass. You can take it over while I'm out for 2 weeks (which would be good because then we can add this codemod to docs.pixee) or wait for me to come back and cleanup whatever minor thing is there.

@@ -31,7 +31,7 @@ jobs:
- name: Install Dependencies
run: pip install -r requirements/lint.txt
- name: Black Format Check
run: black --check .
run: black --check . --exclude samples/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this and the corresponding pre-commit-hook update is the right call. There will be other instances when we want to test multiline and similar things and we don't want black to format it if our integration tests are expecting non-formatted code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change ended up not being needed for my PR but it still seems useful.

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

Merging #27 (896cabb) into main (4c8c37d) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   95.78%   95.88%   +0.10%     
==========================================
  Files          38       39       +1     
  Lines        1446     1484      +38     
==========================================
+ Hits         1385     1423      +38     
  Misses         61       61              
Files Coverage Δ
src/codemodder/codemods/__init__.py 100.00% <100.00%> (ø)
src/codemodder/codemods/jwt_decode_verify.py 100.00% <100.00%> (ø)

Copy link
Member

@drdavella drdavella left a comment

Choose a reason for hiding this comment

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

Looks very nice. I think this is a good codemod. Just one small question/comment.

src/codemodder/codemods/jwt_decode_verify.py Show resolved Hide resolved
@clavedeluna clavedeluna force-pushed the jwt-verify branch 2 times, most recently from fd7f8ce to 896cabb Compare September 26, 2023 15:48
@clavedeluna clavedeluna merged commit e9dab50 into main Sep 26, 2023
@clavedeluna clavedeluna deleted the jwt-verify branch September 26, 2023 16:18
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.

4 participants