withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
45.48k stars 2.39k forks source link

Content cookie available after delete on Safari #11779

Open ohrrkan opened 3 weeks ago

ohrrkan commented 3 weeks ago

Astro Info

Astro                    v4.14.2
Node                     v20.16.0
System                   macOS (arm64)
Package Manager          npm
Output                   hybrid
Adapter                  @astrojs/vercel/serverless
Integrations             @astrojs/sitemap
                         @astrojs/tailwind

If this issue only occurs in one browser, which browser is a problem?

Safari

Describe the Bug

Not certain it is a Astro issue or Safari (Need more investigation) but impact.

The content of the cookie can be access on the client after a cookie.delete (Only on Safari)

Example :

set.astro

---
Astro.cookies.set("sb-access-token", "token", {
  path: "/",
});
---

<!doctype html>
<html>
  <body>
    <h1>Set cookie</h1>
  </body>
</html>

delete.astro

---
Astro.cookies.delete("sb-access-token", { path: "/" });
---

<!doctype html>
<html>
  <body>
    <h1>Delete cookie</h1>
    <script>
      console.log(document.cookie);
    </script>
  </body>
</html>

What's the expected result?

Tempory solution : cookies.set("sb-access-token", "",{ path: "/" });in place of cookies.delete("sb-access-token", { path: "/" });

Link to Minimal Reproducible Example

stackblitz not work with safari

Participation

matthewp commented 3 weeks ago

We still need an example. Even if it doesn't break in Stackblitz we use these examples to pull down locally and eventually turn into a test.

github-actions[bot] commented 3 weeks ago

Hello @ohrrkan. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

ohrrkan commented 3 weeks ago

We still need an example. Even if it doesn't break in Stackblitz we use these examples to pull down locally and eventually turn into a test.

linked