Yumax-panda / full-stack

A portfolio platform
https://full-stack-rvp52emraq-an.a.run.app/
MIT License
1 stars 0 forks source link

ログインしているかの確認を`page.tsx`でする #155

Closed Yumax-panda closed 2 months ago

Yumax-panda commented 3 months ago

layout.tsxをミドルウェアとしてつかうことはできない

ref: https://zenn.dev/meijin/articles/nextjs14-layout-as-middleware

Yumax-panda commented 3 months ago

一部のページでログインの確認をlayout.tsxで行なっているが、それではログイン必要なページの秘匿が完全ではない

https://github.com/Yumax-panda/full-stack/blob/70f787a6194913672b4865b9120192b137038fc1/src/app/(withAuth)/layout.tsx#L11

要修正

参考

bfs84 commented 3 months ago

User Story

Who: 外部ユーザー What: 任意のユーザーのセッション情報を不正に取得できないようにする Why: 現在の実装ではlayout.tsxでセッション確認しており、curlコマンドで攻撃者にセッション情報を盗まれるおそれがあるため Where: full-stack

受け入れ条件

page.tsxでセッション確認を実施し結果のみlayout.tsxに渡すことで、クライアント側に秘匿情報が漏れない構造になっていること

bfs84 commented 3 months ago

@Yumax-panda さん お疲れ様です! リモートリポジトリのブランチを切って作業をしようとしたところ、アクセス権がないようで fatal: unable to access 'https://github.com/Yumax-panda/full-stack.git/': The requested URL returned error: 403 と出たのでアクセス権の付与をお願いしてもよろしいでしょうか?