jwt_tools_spec - thesavant42/retrorecon GitHub Wiki
This document specifies the design for a new JWT Tools window within Retrorecon. The tool lets users decode, edit and re-encode JSON Web Tokens without leaving the application.
- Provide a menu entry under Tools labelled
JWT Tools
. - Display a full-screen editor like the existing Text Tools overlay.
- Allow decoding of JWTs into formatted JSON with timestamp conversion.
- Allow encoding (and optional signing) of JWTs from edited JSON.
- Highlight weak algorithms and fixed keys.
- Offer quick copy and save actions.
- Selecting Tools â JWT Tools opens a modal overlay similar to
text_tools.html
. - The top half contains
<textarea id="jwt-tool-input">
for the JWT or JSON payload. - Beneath the textarea is a row of buttons:
- JWT Decode
- JWT Encode
- Save As â downloads the current text
- Copy â copies to the clipboard
- Close â hides the overlay
- When decoding, the tool pretty prints the header and payload. Epoch values for
iat
,nbf
andexp
are translated to readable timestamps. Expired tokens show theexp
value in black; valid tokens show it in green. - A small text input allows supplying a
secret
used when encoding/signing. - Algorithms considered weak (
none
,HS256
, etc.) or tokens signed with a known fixed key should trigger a visible warning banner.
-
GET /jwt_tools
â serve the overlay HTML fragment. -
POST /tools/jwt_decode
â accept atoken
field and return formatted JSON. Validation errors return status 400. -
POST /tools/jwt_encode
â acceptpayload
(JSON) and optionalsecret
. Returns the encoded token.
- Limit request payloads to ~64âŻKB.
- Use Python's
jwt
library with explicit algorithms to avoidnone
spoofing. - Catch decoding exceptions and return clear error messages.
- Sanitize any JSON inserted back into the DOM.
- Create
jwt_tools.html
template and accompanying JS instatic/jwt_tools.js
. - Implement the new Flask routes in
app.py
with robust error handling. - Update the navigation menu text (
Text Tools
entry renamed toJWT Tools
). - Add CSS under
.retrorecon-root
intools.css
if additional styling is required. - Extend documentation and unit tests as outlined below.
- Build the HTML, CSS and JS for the JWT Tools overlay.
- Add the
/jwt_tools
,/tools/jwt_decode
and/tools/jwt_encode
routes. - Support optional signing when a secret is provided.
- Display algorithm and key warnings when decoding.
- Update the navigation menu and ensure the overlay only opens from the menu.
- Create unit tests for decoding, encoding, signing and warnings.
- Update
README.md
,docs/api_routes.md
,docs/test_plan.md
and regeneratetests/postman/retrorecon.postman.json
.