Skip to content

feat: Allow jwt from cookie, but only if it's explicitly requested - #329

Merged
spencewenski merged 1 commit into
mainfrom
optional-jwt-cookie-name
Aug 12, 2024
Merged

feat: Allow jwt from cookie, but only if it's explicitly requested#329
spencewenski merged 1 commit into
mainfrom
optional-jwt-cookie-name

Conversation

@spencewenski

Copy link
Copy Markdown
Member

Getting the JWT from the cookie seems to be acceptable, and is useful for GET requests (e.g., initial page load when using SSR). However, for POST requests it should be accompanied with some CSRF protection mechanism. At the moment, the CSRF validation will need to be performed by the consuming application.

@codecov

codecov Bot commented Aug 12, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 53.84615% with 12 lines in your changes missing coverage. Please review.

Project coverage is 48.34%. Comparing base (ff48b19) to head (29144ba).
Report is 1 commits behind head on main.

Files Patch % Lines
src/middleware/http/auth/jwt/mod.rs 53.84% 12 Missing ⚠️
Files Coverage Δ
src/config/auth/mod.rs 100.00% <ø> (ø)
src/middleware/http/auth/jwt/mod.rs 64.10% <53.84%> (-2.21%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89798eb...29144ba. Read the comment docs.

@spencewenski
spencewenski force-pushed the optional-jwt-cookie-name branch from 9097105 to 9c3f76d Compare August 12, 2024 20:38
Getting the JWT from the cookie seems to be acceptable, and is useful
for GET requests (e.g., initial page load when using SSR). However, for
POST requests it should be accompanied with some CSRF protection
mechanism. At the moment, the CSRF validation will need to be performed
by the consuming application.
@spencewenski
spencewenski force-pushed the optional-jwt-cookie-name branch from 9c3f76d to 29144ba Compare August 12, 2024 20:46
@spencewenski
spencewenski merged commit b20d890 into main Aug 12, 2024
@spencewenski
spencewenski deleted the optional-jwt-cookie-name branch August 12, 2024 20:56
@github-actions github-actions Bot mentioned this pull request Aug 12, 2024
@spencewenski spencewenski changed the title feat: Allow jwt from cookie, but only if it's explicitly requested feat: Allow jwt from cookie, but only if it's explicitly enabled Aug 13, 2024
@spencewenski spencewenski changed the title feat: Allow jwt from cookie, but only if it's explicitly enabled feat: Allow jwt from cookie, but only if it's explicitly requested Aug 13, 2024
@github-actions github-actions Bot mentioned this pull request Aug 25, 2024
spencewenski added a commit that referenced this pull request Aug 26, 2024
## 🤖 New release
* `roadster`: 0.5.19 -> 0.6.0

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[0.6.0](roadster-v0.5.19...roadster-v0.6.0)
- 2024-08-25

### Added
- Add a public method to decode a JWT from a string
([#348](#348))
- Mark refresh token headers as sensitive
([#347](#347))
- Make the `User` sea-orm migration enum public
([#346](#346))
- Allow splitting config files into many files in env directories
([#344](#344))
- [**breaking**] App methods take `self`
([#337](#337))
- Remove cookie extraction for `Jwt`, but allow it in `JwtCsrf`
([#332](#332))
- Allow custom sub-claims in provided `Claims` types
([#331](#331))
- Allow jwt from cookie, but only if it's explicitly requested
([#329](#329))

### Fixed
- [**breaking**] Don't expect a "Bearer" token in the auth token cookie
([#340](#340))

### Other
- Remove a `todo` comment
([#345](#345))
- Remove a todo comment from the tracing mod
([#343](#343))
- Update leptos example to use site-addr and env from roadster config
([#341](#341))
- sea-orm workspace dep and upgrade to `1.0.0`
([#336](#336))
- [**breaking**] Update tower to `0.5.0`
([#334](#334))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Spencer Ferris <3319370+spencewenski@users.noreply.github.com>
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