Skip to content

start-basic-auth example is not secure #3348

Open
@ensconced

Description

@ensconced

Which project does this relate to?

Start

Describe the bug

I think it's reasonable to expect that in the start-basic-auth example, the posts should only be accessible if you're logged in.

But in fact they are accessible without logging in. i.e. the example is a poor demonstration of how to actually secure the posts information.

Your Example Website or App

The issue can be seen on the codesandbox from the docs.

Steps to Reproduce the Bug or Issue

  1. Open the codesandbox linked above
  2. In the codesandbox preview, edit the URL so that it ends with /_server/app_utils_posts_ts--fetchPosts_createServerFn_handler?payload=%7B%22data%22%3A%7B%22%24undefined%22%3A0%7D%2C%22context%22%3A%7B%7D%7D, then hit enter to go to this page. You successfully retrieve the posts as JSON, despite not being logged in.
  3. Do the same for /_server/app_utils_posts_ts--fetchPost_createServerFn_handler?payload=%7B%22data%22%3A%223%22%2C%22context%22%3A%7B%7D%7D and see that you get a single post in the response

Expected behavior

When following the start-basic-auth example, it shouldn't be possible to get the posts without being properly authenticated.

Screenshots or Videos

Image

Platform

not relevant

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions