Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant