jwt-toolkit 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jwt_toolkit-0.1.2/.github/ISSUE_TEMPLATE/bug_report.yml +104 -0
- jwt_toolkit-0.1.2/.github/ISSUE_TEMPLATE/config.yml +8 -0
- jwt_toolkit-0.1.2/.github/ISSUE_TEMPLATE/documentation.yml +35 -0
- jwt_toolkit-0.1.2/.github/ISSUE_TEMPLATE/feature_request.yml +67 -0
- jwt_toolkit-0.1.2/.github/PULL_REQUEST_TEMPLATE.md +62 -0
- jwt_toolkit-0.1.2/CONTRIBUTING.md +281 -0
- jwt_toolkit-0.1.2/PKG-INFO +283 -0
- jwt_toolkit-0.1.2/README.md +252 -0
- jwt_toolkit-0.1.2/assets/images/demo.jpg +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/pyproject.toml +2 -2
- jwt_toolkit-0.1.0/PKG-INFO +0 -116
- jwt_toolkit-0.1.0/README.md +0 -85
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.editorconfig +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.github/dependabot.yml +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.github/workflows/ci.yml +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.github/workflows/publish.yml +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.gitignore +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.pre-commit-config.yaml +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/.python-version +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/LICENSE +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/Makefile +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/__init__.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/cli/__init__.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/cli/algorithms.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/cli/banner.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/cli/console.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/cli/decoding.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/cli/panels.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/__init__.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/audit.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/crack.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/decode.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/download_wordlists.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/forge.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/generate_secret.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/sign.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/commands/verify.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/__init__.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/auditor.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/crypto.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/decoder.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/encoding.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/errors.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/forge.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/jwt_toolkit/core/jwks.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/__init__.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/conftest.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/helpers.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_auditor.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_audit.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_crack.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_decode.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_download_wordlists.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_forge.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_generate_secret.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_sign.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_cmd_verify.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_crypto.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_crypto_asymmetric.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_decoder.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_forge.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/tests/test_jwks.py +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/uv.lock +0 -0
- {jwt_toolkit-0.1.0 → jwt_toolkit-0.1.2}/wordlists/common-secrets.txt +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report something that is broken or behaves incorrectly.
|
|
3
|
+
title: "[bug]: "
|
|
4
|
+
labels: ["bug", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to report a bug. Please fill in the sections below so we can reproduce and fix the issue.
|
|
10
|
+
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: summary
|
|
13
|
+
attributes:
|
|
14
|
+
label: Summary
|
|
15
|
+
description: A clear, one or two sentence description of the bug.
|
|
16
|
+
placeholder: "jwt-toolkit audit crashes when the token has a nested array claim."
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: reproduction
|
|
22
|
+
attributes:
|
|
23
|
+
label: Steps to reproduce
|
|
24
|
+
description: The exact command(s) you ran. Include the token or a minimal redacted equivalent if relevant.
|
|
25
|
+
placeholder: |
|
|
26
|
+
1. Run `jwt-toolkit audit eyJhbGciOi...`
|
|
27
|
+
2. Observe the traceback
|
|
28
|
+
render: bash
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
|
|
32
|
+
- type: textarea
|
|
33
|
+
id: expected
|
|
34
|
+
attributes:
|
|
35
|
+
label: Expected behavior
|
|
36
|
+
description: What did you expect to happen?
|
|
37
|
+
validations:
|
|
38
|
+
required: true
|
|
39
|
+
|
|
40
|
+
- type: textarea
|
|
41
|
+
id: actual
|
|
42
|
+
attributes:
|
|
43
|
+
label: Actual behavior
|
|
44
|
+
description: What actually happened? Paste the full output or traceback inside a code block.
|
|
45
|
+
render: shell
|
|
46
|
+
validations:
|
|
47
|
+
required: true
|
|
48
|
+
|
|
49
|
+
- type: input
|
|
50
|
+
id: version
|
|
51
|
+
attributes:
|
|
52
|
+
label: jwt-toolkit version
|
|
53
|
+
description: Output of `jwt-toolkit --version`.
|
|
54
|
+
placeholder: "0.1.0"
|
|
55
|
+
validations:
|
|
56
|
+
required: true
|
|
57
|
+
|
|
58
|
+
- type: input
|
|
59
|
+
id: python
|
|
60
|
+
attributes:
|
|
61
|
+
label: Python version
|
|
62
|
+
description: Output of `python --version`.
|
|
63
|
+
placeholder: "3.13.1"
|
|
64
|
+
validations:
|
|
65
|
+
required: true
|
|
66
|
+
|
|
67
|
+
- type: dropdown
|
|
68
|
+
id: install_method
|
|
69
|
+
attributes:
|
|
70
|
+
label: Install method
|
|
71
|
+
options:
|
|
72
|
+
- pipx
|
|
73
|
+
- uv tool
|
|
74
|
+
- pip
|
|
75
|
+
- from source
|
|
76
|
+
- other
|
|
77
|
+
validations:
|
|
78
|
+
required: true
|
|
79
|
+
|
|
80
|
+
- type: input
|
|
81
|
+
id: os
|
|
82
|
+
attributes:
|
|
83
|
+
label: Operating system
|
|
84
|
+
placeholder: "macOS 15.2 / Ubuntu 24.04 / Windows 11"
|
|
85
|
+
validations:
|
|
86
|
+
required: true
|
|
87
|
+
|
|
88
|
+
- type: textarea
|
|
89
|
+
id: extra
|
|
90
|
+
attributes:
|
|
91
|
+
label: Additional context
|
|
92
|
+
description: Anything else worth noting. Environment variables (`JWT_TOOLKIT_*`, `NO_COLOR`), related issues, screenshots, etc.
|
|
93
|
+
|
|
94
|
+
- type: checkboxes
|
|
95
|
+
id: checks
|
|
96
|
+
attributes:
|
|
97
|
+
label: Pre-flight checks
|
|
98
|
+
options:
|
|
99
|
+
- label: I have searched existing issues and confirmed this is not a duplicate.
|
|
100
|
+
required: true
|
|
101
|
+
- label: I am running the latest released version of jwt-toolkit, or have noted the version above.
|
|
102
|
+
required: true
|
|
103
|
+
- label: This is not a security vulnerability. Security issues must be reported privately via GitHub Security Advisories.
|
|
104
|
+
required: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Question or discussion
|
|
4
|
+
url: https://github.com/KhaledSaeed18/jwt-toolkit/discussions
|
|
5
|
+
about: Ask a question, share a use case, or discuss an idea before filing an issue.
|
|
6
|
+
- name: Security vulnerability
|
|
7
|
+
url: https://github.com/KhaledSaeed18/jwt-toolkit/security/advisories/new
|
|
8
|
+
about: Report a security vulnerability privately. Do not open a public issue.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
description: Report unclear, missing, or incorrect documentation.
|
|
3
|
+
title: "[docs]: "
|
|
4
|
+
labels: ["documentation", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
id: location
|
|
8
|
+
attributes:
|
|
9
|
+
label: Where
|
|
10
|
+
description: Link to the file, section, or command help text that needs work.
|
|
11
|
+
placeholder: "README.md > Examples > Audit a token"
|
|
12
|
+
validations:
|
|
13
|
+
required: true
|
|
14
|
+
|
|
15
|
+
- type: textarea
|
|
16
|
+
id: problem
|
|
17
|
+
attributes:
|
|
18
|
+
label: What is wrong or missing
|
|
19
|
+
description: Describe what is unclear, outdated, or incorrect.
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: suggestion
|
|
25
|
+
attributes:
|
|
26
|
+
label: Suggested change
|
|
27
|
+
description: If you have a concrete improvement in mind, share it here. A PR is welcome.
|
|
28
|
+
|
|
29
|
+
- type: checkboxes
|
|
30
|
+
id: checks
|
|
31
|
+
attributes:
|
|
32
|
+
label: Pre-flight checks
|
|
33
|
+
options:
|
|
34
|
+
- label: I have searched existing issues and confirmed this is not a duplicate.
|
|
35
|
+
required: true
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Propose a new command, flag, audit rule, or capability.
|
|
3
|
+
title: "[feature]: "
|
|
4
|
+
labels: ["enhancement", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for the suggestion. Please describe the problem and the proposed solution clearly so we can evaluate it.
|
|
10
|
+
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: problem
|
|
13
|
+
attributes:
|
|
14
|
+
label: Problem
|
|
15
|
+
description: What is the use case or pain point that this feature would solve?
|
|
16
|
+
placeholder: "I want to audit a batch of tokens at once and currently have to script around the single-token CLI."
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: proposal
|
|
22
|
+
attributes:
|
|
23
|
+
label: Proposed solution
|
|
24
|
+
description: Describe the feature. If it adds a command or flag, sketch the CLI surface.
|
|
25
|
+
placeholder: |
|
|
26
|
+
Add `jwt-toolkit audit-batch <file>` where each line of `<file>` is a JWT.
|
|
27
|
+
Output a JSON array of audit results.
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: alternatives
|
|
33
|
+
attributes:
|
|
34
|
+
label: Alternatives considered
|
|
35
|
+
description: Workarounds you have tried or other designs you considered.
|
|
36
|
+
|
|
37
|
+
- type: dropdown
|
|
38
|
+
id: scope
|
|
39
|
+
attributes:
|
|
40
|
+
label: Area
|
|
41
|
+
options:
|
|
42
|
+
- new command
|
|
43
|
+
- new flag on existing command
|
|
44
|
+
- new audit rule
|
|
45
|
+
- new algorithm or key format
|
|
46
|
+
- output format (json, table, etc.)
|
|
47
|
+
- performance
|
|
48
|
+
- documentation
|
|
49
|
+
- other
|
|
50
|
+
validations:
|
|
51
|
+
required: true
|
|
52
|
+
|
|
53
|
+
- type: textarea
|
|
54
|
+
id: extra
|
|
55
|
+
attributes:
|
|
56
|
+
label: Additional context
|
|
57
|
+
description: Links to specs, CVEs, blog posts, related issues, or example tokens that motivate the request.
|
|
58
|
+
|
|
59
|
+
- type: checkboxes
|
|
60
|
+
id: checks
|
|
61
|
+
attributes:
|
|
62
|
+
label: Pre-flight checks
|
|
63
|
+
options:
|
|
64
|
+
- label: I have searched existing issues and confirmed this is not a duplicate.
|
|
65
|
+
required: true
|
|
66
|
+
- label: This feature fits the defensive, learning-focused scope of jwt-toolkit.
|
|
67
|
+
required: true
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Thanks for contributing to jwt-toolkit. Please fill in the sections below.
|
|
3
|
+
Keep the title concise and in the conventional-commits style, for example:
|
|
4
|
+
feat(audit): flag jku header pointing to non-https URL
|
|
5
|
+
fix(crack): handle wordlists with trailing whitespace
|
|
6
|
+
docs(readme): add JWKS verification example
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
<!-- One or two sentences describing what this PR changes and why. -->
|
|
12
|
+
|
|
13
|
+
## Type of change
|
|
14
|
+
|
|
15
|
+
<!-- Check all that apply. -->
|
|
16
|
+
|
|
17
|
+
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
18
|
+
- [ ] New feature (non-breaking change that adds functionality)
|
|
19
|
+
- [ ] Breaking change (fix or feature that changes existing CLI surface or behavior)
|
|
20
|
+
- [ ] Refactor (no behavior change)
|
|
21
|
+
- [ ] Documentation
|
|
22
|
+
- [ ] Tests only
|
|
23
|
+
- [ ] Build, CI, or tooling
|
|
24
|
+
|
|
25
|
+
## Related issues
|
|
26
|
+
|
|
27
|
+
<!-- Link issues this PR closes or relates to. Use "Closes #123" to auto-close. -->
|
|
28
|
+
|
|
29
|
+
Closes #
|
|
30
|
+
|
|
31
|
+
## Changes
|
|
32
|
+
|
|
33
|
+
<!-- A short bulleted list of what changed. Focus on user-facing impact. -->
|
|
34
|
+
|
|
35
|
+
-
|
|
36
|
+
-
|
|
37
|
+
|
|
38
|
+
## How to test
|
|
39
|
+
|
|
40
|
+
<!--
|
|
41
|
+
Concrete commands a reviewer can run to verify this PR.
|
|
42
|
+
Include sample tokens, expected output, or screenshots for CLI changes.
|
|
43
|
+
-->
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
make check
|
|
47
|
+
# or specific commands:
|
|
48
|
+
jwt-toolkit audit <token>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Checklist
|
|
52
|
+
|
|
53
|
+
- [ ] I read [CONTRIBUTING.md](../CONTRIBUTING.md) and followed the branch and commit conventions.
|
|
54
|
+
- [ ] `make check` passes locally (lint, typecheck, tests, security scan, dependency audit).
|
|
55
|
+
- [ ] I added or updated tests for the change.
|
|
56
|
+
- [ ] I updated the README, command help text, or other docs if user-facing behavior changed.
|
|
57
|
+
- [ ] I did not introduce new runtime dependencies, or I justified each new one in the PR description.
|
|
58
|
+
- [ ] This PR does not contain real secrets, private keys, or production tokens.
|
|
59
|
+
|
|
60
|
+
## Additional notes
|
|
61
|
+
|
|
62
|
+
<!-- Optional. Anything the reviewer should know: tradeoffs, follow-ups, screenshots. -->
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Contributing to jwt-toolkit
|
|
2
|
+
|
|
3
|
+
Thank you for considering a contribution. This document explains the project layout, how to set up a development environment, and the conventions we follow for branches, commits, and pull requests. The aim is to keep the contributor experience predictable so that you can focus on the change itself.
|
|
4
|
+
|
|
5
|
+
If anything here is unclear, open a documentation issue using the [Documentation issue template](.github/ISSUE_TEMPLATE/documentation.yml).
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
- [Code of conduct](#code-of-conduct)
|
|
10
|
+
- [Project scope](#project-scope)
|
|
11
|
+
- [Repository layout](#repository-layout)
|
|
12
|
+
- [Development setup](#development-setup)
|
|
13
|
+
- [Common tasks](#common-tasks)
|
|
14
|
+
- [Branch naming](#branch-naming)
|
|
15
|
+
- [Commit messages](#commit-messages)
|
|
16
|
+
- [Pull request workflow](#pull-request-workflow)
|
|
17
|
+
- [Testing guidelines](#testing-guidelines)
|
|
18
|
+
- [Code style](#code-style)
|
|
19
|
+
- [Security policy](#security-policy)
|
|
20
|
+
- [Releasing](#releasing)
|
|
21
|
+
|
|
22
|
+
## Code of conduct
|
|
23
|
+
|
|
24
|
+
Be respectful, be patient, and assume good intent. Personal attacks, harassment, and discriminatory language are not acceptable in any project space, including issues, pull requests, discussions, and commit messages.
|
|
25
|
+
|
|
26
|
+
## Project scope
|
|
27
|
+
|
|
28
|
+
`jwt-toolkit` is a defensive command-line tool for inspecting, verifying, auditing, and stress-testing JSON Web Tokens. Contributions that fit this scope are welcome:
|
|
29
|
+
|
|
30
|
+
- New audit rules with a clear security rationale, ideally referencing a CVE, RFC, or well-known attack pattern.
|
|
31
|
+
- Additional verification options (algorithms, key formats, JWKS behaviors).
|
|
32
|
+
- CLI ergonomics, better output, and machine-readable formats.
|
|
33
|
+
- Tests, documentation, and tooling improvements.
|
|
34
|
+
|
|
35
|
+
Out of scope:
|
|
36
|
+
|
|
37
|
+
- Features that primarily enable offensive use against systems the user does not own.
|
|
38
|
+
- Network probing, exfiltration, or any behavior that targets remote systems beyond fetching public JWKS documents.
|
|
39
|
+
- Heavy runtime dependencies. Each new dependency must be justified.
|
|
40
|
+
|
|
41
|
+
## Repository layout
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
jwt-toolkit/
|
|
45
|
+
├── jwt_toolkit/ # Source package
|
|
46
|
+
│ ├── __init__.py # Package version
|
|
47
|
+
│ ├── cli/ # CLI plumbing: banner, console, panels, decoding helpers
|
|
48
|
+
│ │ ├── __init__.py # Click root group, global flags, command registration
|
|
49
|
+
│ │ ├── algorithms.py # CLI-side algorithm validation and listing
|
|
50
|
+
│ │ ├── banner.py # Startup banner and custom help renderer
|
|
51
|
+
│ │ ├── console.py # Rich console wiring (quiet, no-color, JSON modes)
|
|
52
|
+
│ │ ├── decoding.py # Shared CLI helpers for decoding input
|
|
53
|
+
│ │ └── panels.py # Reusable Rich panels (header, payload, verdicts, findings)
|
|
54
|
+
│ ├── commands/ # One file per `jwt-toolkit <command>`
|
|
55
|
+
│ │ ├── audit.py
|
|
56
|
+
│ │ ├── crack.py
|
|
57
|
+
│ │ ├── decode.py
|
|
58
|
+
│ │ ├── download_wordlists.py
|
|
59
|
+
│ │ ├── forge.py
|
|
60
|
+
│ │ ├── generate_secret.py
|
|
61
|
+
│ │ ├── sign.py
|
|
62
|
+
│ │ └── verify.py
|
|
63
|
+
│ └── core/ # Pure logic, no Click and no Rich
|
|
64
|
+
│ ├── auditor.py # Static audit rules and verdict scoring
|
|
65
|
+
│ ├── crypto.py # HMAC and asymmetric signing and verification
|
|
66
|
+
│ ├── decoder.py # JWT parsing and base64url helpers
|
|
67
|
+
│ ├── encoding.py # base64url, JSON canonicalization
|
|
68
|
+
│ ├── errors.py # Domain-specific exceptions
|
|
69
|
+
│ ├── forge.py # Defensive attack-shaped variant generation
|
|
70
|
+
│ └── jwks.py # JWKS fetching, caching, and key selection
|
|
71
|
+
├── tests/ # Pytest suite mirroring the source layout
|
|
72
|
+
│ ├── conftest.py # Shared fixtures (keys, tokens, tmp wordlists)
|
|
73
|
+
│ ├── helpers.py # Test helpers
|
|
74
|
+
│ ├── test_cmd_*.py # CLI-level tests (invoke commands via Click runner)
|
|
75
|
+
│ └── test_*.py # Core-level unit tests
|
|
76
|
+
├── wordlists/ # Bundled wordlist resources
|
|
77
|
+
├── assets/ # README images and demo assets
|
|
78
|
+
├── .github/
|
|
79
|
+
│ ├── ISSUE_TEMPLATE/ # Issue forms (bug, feature, docs)
|
|
80
|
+
│ ├── workflows/ # CI and publish workflows
|
|
81
|
+
│ ├── dependabot.yml # Dependency update config
|
|
82
|
+
│ └── PULL_REQUEST_TEMPLATE.md
|
|
83
|
+
├── pyproject.toml # Build, dependencies, ruff, mypy, pytest, bandit config
|
|
84
|
+
├── Makefile # Developer command shortcuts
|
|
85
|
+
├── uv.lock # Locked dependency tree (managed by uv)
|
|
86
|
+
└── README.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Layering rules
|
|
90
|
+
|
|
91
|
+
The package is split into three layers and dependencies must flow downward:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
commands --> cli (rendering) --> core (logic)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- `core/` must not import from `cli/` or `commands/`. It contains the pure JWT logic and is meant to be testable without any CLI plumbing.
|
|
98
|
+
- `cli/` may import from `core/` and provides Rich-based rendering helpers.
|
|
99
|
+
- `commands/` wires Click flags to `core/` operations and uses `cli/` to render results.
|
|
100
|
+
|
|
101
|
+
If you find yourself wanting `core/` to know about Rich, colors, or Click, stop and rethink. Pass plain data structures out of `core/` and let the command layer format them.
|
|
102
|
+
|
|
103
|
+
## Development setup
|
|
104
|
+
|
|
105
|
+
You need Python 3.13 or newer and [uv](https://docs.astral.sh/uv/). The Makefile assumes `uv` is on your PATH.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/KhaledSaeed18/jwt-toolkit.git
|
|
109
|
+
cd jwt-toolkit
|
|
110
|
+
make install
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`make install` does two things:
|
|
114
|
+
|
|
115
|
+
1. Syncs the dev dependency group with `uv sync --group dev`.
|
|
116
|
+
2. Installs the pre-commit hook so style and lint run on every commit.
|
|
117
|
+
|
|
118
|
+
Verify the install:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv run jwt-toolkit --version
|
|
122
|
+
make check
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`make check` runs the full local CI gate: lint, type checking, tests, security scan, and dependency audit. Run this before opening a pull request.
|
|
126
|
+
|
|
127
|
+
## Common tasks
|
|
128
|
+
|
|
129
|
+
| Task | Command |
|
|
130
|
+
| ------------------------------------ | ------------------ |
|
|
131
|
+
| Show available make targets | `make` or `make help` |
|
|
132
|
+
| Install dev deps and pre-commit hook | `make install` |
|
|
133
|
+
| Auto-format with ruff | `make fmt` |
|
|
134
|
+
| Lint without modifying files | `make lint` |
|
|
135
|
+
| Type check with mypy | `make typecheck` |
|
|
136
|
+
| Run tests with coverage in parallel | `make test` |
|
|
137
|
+
| Fast tests, no coverage | `make test-fast` |
|
|
138
|
+
| Coverage report on stdout | `make cov` |
|
|
139
|
+
| Static security scan (bandit) | `make security` |
|
|
140
|
+
| Check deps for known CVEs (pip-audit)| `make audit` |
|
|
141
|
+
| Full local CI gate | `make check` |
|
|
142
|
+
| Run all pre-commit hooks | `make pre-commit` |
|
|
143
|
+
| Clean caches and build artifacts | `make clean` |
|
|
144
|
+
|
|
145
|
+
## Branch naming
|
|
146
|
+
|
|
147
|
+
Use short, hyphen-separated branch names prefixed with the type of change:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
<type>/<short-description>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Allowed types:
|
|
154
|
+
|
|
155
|
+
- `feat/` for new user-facing functionality
|
|
156
|
+
- `fix/` for bug fixes
|
|
157
|
+
- `docs/` for documentation only changes
|
|
158
|
+
- `refactor/` for internal refactors with no behavior change
|
|
159
|
+
- `test/` for changes that only add or adjust tests
|
|
160
|
+
- `chore/` for build, CI, dependency, or tooling changes
|
|
161
|
+
- `perf/` for performance improvements
|
|
162
|
+
- `security/` for hardening fixes that are not vulnerability disclosures
|
|
163
|
+
|
|
164
|
+
Examples:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
feat/audit-jku-rule
|
|
168
|
+
fix/crack-trailing-whitespace
|
|
169
|
+
docs/readme-jwks-example
|
|
170
|
+
refactor/decoder-split-base64
|
|
171
|
+
chore/bump-cryptography
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Branch off the latest `main`. Keep one logical change per branch.
|
|
175
|
+
|
|
176
|
+
## Commit messages
|
|
177
|
+
|
|
178
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/). The format is:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
<type>(<scope>): <short summary>
|
|
182
|
+
|
|
183
|
+
<optional body>
|
|
184
|
+
|
|
185
|
+
<optional footer>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`<type>` must be one of: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `perf`, `security`, `build`, `ci`, `style`.
|
|
189
|
+
|
|
190
|
+
`<scope>` is a short identifier for the area of the codebase. Use a command name, a `core/` module name, or a high-level area:
|
|
191
|
+
|
|
192
|
+
- Command scopes: `audit`, `crack`, `decode`, `verify`, `sign`, `forge`, `generate-secret`, `download-wordlists`
|
|
193
|
+
- Core scopes: `core`, `auditor`, `crypto`, `decoder`, `forge`, `jwks`, `jwks-cache`
|
|
194
|
+
- Other scopes: `cli`, `readme`, `ci`, `deps`, `release`
|
|
195
|
+
|
|
196
|
+
Rules:
|
|
197
|
+
|
|
198
|
+
- Use the imperative mood: "add" not "added" or "adds".
|
|
199
|
+
- Keep the summary line under 72 characters.
|
|
200
|
+
- Do not end the summary with a period.
|
|
201
|
+
- Describe the change, not the file. "fix(crack): handle empty wordlist" is better than "update crack.py".
|
|
202
|
+
- The body explains the why and any non-obvious tradeoffs. Wrap at 72 columns.
|
|
203
|
+
- Reference issues in the footer: `Refs #42` or `Closes #42`.
|
|
204
|
+
- Mark breaking changes with `!` after the type or a `BREAKING CHANGE:` footer.
|
|
205
|
+
|
|
206
|
+
Examples:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
feat(audit): flag jku header pointing to non-https URL
|
|
210
|
+
fix(crack): handle wordlists with trailing whitespace
|
|
211
|
+
docs(readme): add JWKS verification example
|
|
212
|
+
refactor(core)!: split decoder into parser and encoder modules
|
|
213
|
+
chore(deps): bump cryptography to 48.0.0
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Pull request workflow
|
|
217
|
+
|
|
218
|
+
1. Open or comment on an issue first if the change is non-trivial. This avoids wasted work on a direction that may not be accepted.
|
|
219
|
+
2. Fork the repository and create a feature branch from `main`.
|
|
220
|
+
3. Make focused commits that follow the conventions above.
|
|
221
|
+
4. Run `make check` and make sure everything passes locally.
|
|
222
|
+
5. Push your branch and open a pull request against `main`. Fill in every section of the PR template.
|
|
223
|
+
6. The CI workflow runs lint, type check, tests, and security checks. All checks must pass.
|
|
224
|
+
7. A maintainer will review. Address review feedback by pushing additional commits to the same branch. Avoid force-pushing during review so reviewers can see incremental changes. Squash-merging is performed by the maintainer at merge time.
|
|
225
|
+
8. Once approved and green, a maintainer merges with a squash commit whose message follows the conventional-commits format.
|
|
226
|
+
|
|
227
|
+
### What makes a good pull request
|
|
228
|
+
|
|
229
|
+
- Small and focused. One logical change per PR.
|
|
230
|
+
- Tests for new behavior and for fixed bugs.
|
|
231
|
+
- Documentation updates when user-facing surface changes (README, command help text, examples).
|
|
232
|
+
- A clear "How to test" section that a reviewer can paste into a terminal.
|
|
233
|
+
|
|
234
|
+
## Testing guidelines
|
|
235
|
+
|
|
236
|
+
- Tests live in `tests/`. CLI-level tests use Click's `CliRunner` and assert on stdout, exit codes, and JSON shapes. Core tests exercise pure functions.
|
|
237
|
+
- Mirror the source layout: `core/auditor.py` is tested by `tests/test_auditor.py`, `commands/audit.py` by `tests/test_cmd_audit.py`, and so on.
|
|
238
|
+
- Use the fixtures in `tests/conftest.py` for keys, tokens, and temporary wordlists. Do not check in real secrets or production tokens.
|
|
239
|
+
- New audit rules require both a positive case (the rule triggers) and a negative case (the rule does not trigger).
|
|
240
|
+
- New verification or signing behavior must cover error paths: invalid signature, missing claim, malformed key.
|
|
241
|
+
|
|
242
|
+
Run the suite with:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
make test # parallel, with coverage
|
|
246
|
+
make test-fast # parallel, no coverage, fastest feedback loop
|
|
247
|
+
make cov # full coverage report on stdout
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Code style
|
|
251
|
+
|
|
252
|
+
- Formatting and linting are handled by [ruff](https://docs.astral.sh/ruff/). Run `make fmt` before committing or rely on the pre-commit hook.
|
|
253
|
+
- Type checking is enforced with [mypy](https://mypy-lang.org/) on the whole package. New code should be fully typed.
|
|
254
|
+
- Prefer explicit, plain-Python code. No clever metaprogramming in the CLI surface.
|
|
255
|
+
- Keep comments minimal. Names should make code self-explanatory. Only add a comment when the why is non-obvious.
|
|
256
|
+
- User-facing strings should be neutral and informative. No emojis, no em or en dashes in output. Match the style of existing panels.
|
|
257
|
+
- Errors raised from `core/` should be domain-specific subclasses of the exceptions in `core/errors.py`. The command layer turns them into formatted Rich output.
|
|
258
|
+
|
|
259
|
+
## Security policy
|
|
260
|
+
|
|
261
|
+
Do not file public issues for security vulnerabilities. Use the [GitHub Security Advisories](https://github.com/KhaledSaeed18/jwt-toolkit/security/advisories/new) form so we can coordinate disclosure privately.
|
|
262
|
+
|
|
263
|
+
When working on security-relevant code:
|
|
264
|
+
|
|
265
|
+
- Reference the CVE, RFC section, or attack writeup in commit messages and tests.
|
|
266
|
+
- Make sure new audit rules have clear severity, a concrete recommendation, and a positive and negative test.
|
|
267
|
+
- Never commit real secrets, real private keys, or production tokens. Use the fixtures in `tests/conftest.py`.
|
|
268
|
+
|
|
269
|
+
## Releasing
|
|
270
|
+
|
|
271
|
+
Releases are maintainer-only. The publish workflow uses PyPI Trusted Publishing through the `pypi` GitHub environment, which requires manual approval. The release flow is:
|
|
272
|
+
|
|
273
|
+
1. Bump the version in `pyproject.toml` on a release branch.
|
|
274
|
+
2. Open a PR titled `chore(release): vX.Y.Z`.
|
|
275
|
+
3. After merge, tag `main` with `vX.Y.Z` and push the tag.
|
|
276
|
+
4. Create a GitHub release from the tag. The release body becomes the changelog entry.
|
|
277
|
+
5. Approve the `pypi` environment when the publish workflow asks.
|
|
278
|
+
|
|
279
|
+
Contributors do not need to do any of this. Maintainers handle releases.
|
|
280
|
+
|
|
281
|
+
Thank you for contributing.
|