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

fix(auth): interact redirect #2832

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/auth/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,13 @@ export class App {
signed: true,
store: {
async get(key) {
return await redis.hgetall(key)
const s = await redis.hgetall(key)
const session = {
nonce: s.nonce,
_expire: Number(s._expire),
_maxAge: Number(s._maxAge)
}
return session
Copy link
Contributor

@BlairCurrey BlairCurrey Aug 1, 2024

Choose a reason for hiding this comment

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

this would lose anything from s not explicitly set in session. not sure we can assume the only properties set on the session in redis will be these. we could do session = { ...s, _maxAge: Number(s._maxAge), _expire: Number(s._expire)} but that would have the same problem if the other fields are expected not to be strings (just like we saw with maxAge).

I think a more common way of getting/settings is JSON.stringify(object) on set and JSON.parse(string) on get, which which would take care of converting these to numbers without manually reforming the session object. hashes were suggested to me originally when I implemented this but not sure it's the best way to do it now that we're running into this...

},
async set(key, session) {
// Add a delay to cookie age to ensure redis record expires after cookie
Expand Down
Loading