Skip to content

Fix token validation to check JWT expiry#5

Open
wistfulvariable wants to merge 1 commit intomainfrom
fix/auth-validation
Open

Fix token validation to check JWT expiry#5
wistfulvariable wants to merge 1 commit intomainfrom
fix/auth-validation

Conversation

@wistfulvariable
Copy link
Copy Markdown
Owner

Summary\n- Validates JWT structure (3 parts)\n- Checks expiry timestamp against current time\n- Returns false for empty/malformed tokens\n\nFixes #1\n\n## Test plan\n- [ ] Unit tests for expired tokens\n- [ ] Unit tests for malformed tokens\n- [ ] Integration test with real JWT

Copy link
Copy Markdown
Owner Author

@wistfulvariable wistfulvariable left a comment

Choose a reason for hiding this comment

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

The JWT parsing looks good but we should add try/catch around the JSON.parse and atob calls — malformed base64 will throw.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

LGTM! The JWT expiry check looks correct. One suggestion: wrap the atob/JSON.parse in try/catch for malformed tokens.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

LGTM! The JWT expiry check looks correct. One suggestion: wrap the atob/JSON.parse in try/catch for malformed tokens.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

LGTM! The JWT expiry check looks correct. One suggestion: wrap the atob/JSON.parse in try/catch for malformed tokens.

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.

1 participant