Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Exploit Deno KV storage? #101

Open
bdarcus opened this issue May 10, 2023 · 0 comments
Open

Exploit Deno KV storage? #101

bdarcus opened this issue May 10, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bdarcus
Copy link
Owner

bdarcus commented May 10, 2023

This feature is currently available behind an unstable flag, but will be opened up with 2.0 this Summer.

https://deno.com/manual@v1.33.2/runtime/kv

Interestingly, there's a two-part key, so like namespace-prefixed-keys, which I believe they adopted for some security reasons, but is pretty elegant from a usage POV as well.

await kv.set(["users", "alice"], { birthday: "January 1, 1990" });
await kv.set(["users", "sam"], { birthday: "February 14, 1985" });
await kv.set(["users", "taylor"], { birthday: "December 25, 1970" });

// List out all entries with keys starting with `["users"]`
for await (const entry of kv.list({ prefix: ["users"] })) {
  console.log(entry.key);
  console.log(entry.value);
}

And then the value is just JSON.

The above code returns the following in the REPL:

[ "users", "alice" ]
{ birthday: "January 1, 1990" }
[ "users", "sam" ]
{ birthday: "February 14, 1985" }
[ "users", "taylor" ]
{ birthday: "December 25, 1970" }

So it could be used to store (and even serve) styles, templates, terms, input data, etc. Think examples like:

await kv.set(["template", "author-apa-full"], { ... });
@bdarcus bdarcus self-assigned this May 11, 2023
@bdarcus bdarcus changed the title Deno KV notes Exploit Deno KV? May 11, 2023
@bdarcus bdarcus added this to the v0.3 milestone May 11, 2023
@bdarcus bdarcus changed the title Exploit Deno KV? Exploit Deno KV storage? May 11, 2023
@bdarcus bdarcus added the enhancement New feature or request label May 11, 2023
@bdarcus bdarcus modified the milestones: v0.3, v0.4 May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant