Skip to content

Refactor user show view to display API tokens conditionally and remov…#168

Open
fujiwara-e wants to merge 3 commits intonomlab:mainfrom
fujiwara-e:fix/user-show-view
Open

Refactor user show view to display API tokens conditionally and remov…#168
fujiwara-e wants to merge 3 commits intonomlab:mainfrom
fujiwara-e:fix/user-show-view

Conversation

@fujiwara-e
Copy link
Copy Markdown
Contributor

概要

ユーザ詳細画面で,ログインしていないユーザの画面にログインしているユーザの API キーが表示されるようになっていた.

変更点

  • UsersController で表示中のユーザがログインユーザと同じ場合のみトークンを取得.
  • 表示中のユーザがログインユーザと同じ場合のみ API トークンのセクションを表示するように変更.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a data-leak issue where a logged-in user’s API token(s) could appear on another user’s detail page.

Changes:

  • Restricts UsersController#show to load API tokens only when the shown user is the current user.
  • Updates the user show view to render the API token section only for the current user.
  • Removes self-referential links from the name and screen name fields on the user show page.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
app/controllers/users_controller.rb Conditionally loads @api_tokens only for the current user to prevent cross-user exposure.
app/views/users/show.html.erb Conditionally renders the API token section only when viewing your own profile; adjusts name/screen name display.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/controllers/users_controller.rb Outdated
Comment thread app/controllers/users_controller.rb
Comment thread app/views/users/show.html.erb Outdated
Comment thread app/views/users/show.html.erb
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.

2 participants