{"id":18772619,"url":"https://github.com/authgear/authgear-deno","last_synced_at":"2025-04-13T08:31:43.235Z","repository":{"id":103560063,"uuid":"561254310","full_name":"authgear/authgear-deno","owner":"authgear","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-12T12:09:00.000Z","size":75,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T00:22:57.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/authgear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-03T09:45:29.000Z","updated_at":"2025-02-12T12:09:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"3484c610-1c8c-429a-b129-c4430ed1a1f4","html_url":"https://github.com/authgear/authgear-deno","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-deno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-deno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-deno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-deno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authgear","download_url":"https://codeload.github.com/authgear/authgear-deno/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248684285,"owners_count":21145051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T19:29:43.381Z","updated_at":"2025-04-13T08:31:43.226Z","avatar_url":"https://github.com/authgear.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# authgear-deno\n\nauthgear-deno is a HTTP server that takes a JavaScript / TypeScript file and an JSON value.\nThe file is expected to have a default export of a function taking one argument, and return a value.\nThe function can be async or sync.\n\nauthgear-deno takes care of granting permission as the script runs.\nOnly network access to remote is granted.\n\n## Setup\n\nInstall Deno according to [.tool-versions](./.tool-versions).\n\n## Run\n\n```\n$ make start\n```\n\n## Examples\n\n### Evaluate a pure function\n\n```\n$ curl --request POST \\\n  --url http://localhost:8090/run \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n\t\"script\": \"export default async function addOne(a) { return a + 1; }\",\n\t\"input\": 42\n}'\n{\"output\":43,\"stderr\":{},\"stdout\":{}}\n```\n\n### Evaluate a function with side-effects\n\n```\n$ curl --request POST \\\n  --url http://localhost:8090/run \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n\t\"script\": \"export default async function addOne(a) { console.log('\\''hello'\\''); return a + 1; }\",\n\t\"input\": 42\n}'\n{\"output\":43,\"stderr\":{},\"stdout\":{\"string\":\"hello\\n\"}}\n```\n\n### Evaluate a malicious function\n\n```\n$ curl --request POST \\\n  --url http://localhost:8090/run \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n\t\"script\": \"export default async function malicious() { Deno.remove('\\''/'\\'', { recursive: true}) }\",\n\t\"input\": 42\n}'\n{\"error\":\"exit status 1\",\"stderr\":{\"string\":\"┌ ⚠️  Deno requests write access to \\\"/\\\".\\r\\n├ Requested by `Deno.remove()` API.\\r\\n├ Run again with --allow-write to bypass this prompt.\\r\\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all write permissions) \\u003e n\\r\\n\\u001b[4A\\u001b[0J❌ Denied write access to \\\"/\\\".\\r\\nerror: Uncaught (in promise) PermissionDenied: Requires write access to \\\"/\\\", run again with the --allow-write flag\\r\\nexport default async function malicious() { Deno.remove('/', { recursive: true}) }\\r\\n                                                 ^\\r\\n    at Object.remove (ext:deno_fs/30_fs.js:259:9)\\r\\n    at Module.malicious (file:///var/folders/8x/b6m06y8j6xdfhnb574s1yn_00000gn/T/authgear-deno-script.3385027413.ts:1:50)\\r\\n    at file:///Users/louischan/authgear-deno/pkg/deno/runner.ts:7:47\\r\\n\"},\"stdout\":{}}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthgear%2Fauthgear-deno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthgear%2Fauthgear-deno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthgear%2Fauthgear-deno/lists"}