Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ntninja
Copy link
Contributor

@ntninja ntninja commented Dec 26, 2025

Also add run and migrate-db tasks to the Deno configuration and use them from the Makefile, so that the Makefile is fully optional.

Just some conveniences, also means the list of permissions is passively tested.

Copy link
Member

@BrunoBernardino BrunoBernardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. There are a couple of changes I'd like to see, and I'd have to find the time to thoroughly test the permissions before allowing this. I do prefer explicit permissions over "all", though.

deno.json Outdated
"test": "deno test -A --check",

"migrate-db": "deno task run-with-perms ./migrate-db.ts",
"run": "deno task run-with-perms ./main.ts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have preview above, which does the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that name absolutely doesn’t convey that it’s useful for running in production…
Can we rename current start to preview and preview to either start or run maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Actually just applied my suggestion.)

@ntninja
Copy link
Contributor Author

ntninja commented Dec 26, 2025

Also updated Dockerfile to use deno task as well.

…permissions actually needed and alias all other tasks through that

Also add `migrate-db` task to the Deno configuration and use that in the
`Makefile`, so that the Makefile is fully optional, and swap the meanings of
the `start` and `preview` tasks, so that `start` is for production while
`preview` is for development.
Copy link
Member

@BrunoBernardino BrunoBernardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pulled this down and had to make a few changes while testing everything.

Unfortunately read and write access to / is necessary due to some node/deno/fresh compatibility needs (to look into the env vars and build into temporary/cache directories), and also to work both in docker and locally.

If this version causes issues in Windows (I'm unable to test), I'll just change them to --allow-write and --allow-read (global/everything) instead of specifying what the app needs and root (it's redundant, but clearer, I hope).

@BrunoBernardino BrunoBernardino merged commit f647519 into bewcloud:main Dec 29, 2025
{
"lock": true,
"tasks": {
"execute-with-permissions": "deno run --allow-env --allow-net --allow-sys=networkInterfaces,hostname,cpus,homedir --allow-read=.,/ --allow-write=data-files,/ --allow-run",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm… why is --allow-run (with no restrictions) in that list? That’s completely identical to just disabling sandboxing entirely.

Copy link
Member

@BrunoBernardino BrunoBernardino Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall what was the process that needed it, but if you remove it and run it (at least via docker), it'll request that permission (I think it's for some node:fs compatibility layer used in fresh). And that's probably why I've had --allow-all or -A before.

@ntninja
Copy link
Contributor Author

ntninja commented Dec 29, 2025

We obviously have different ideas of what a breaking change is. I know Deno’s handling of file access is isn’t great, so I’m not surprised about the extended permissions there, although what you wrote is actually identical to just using --allow-read --allow-write in scope unless you put it there to document that aspirationally those extra / entries should hopefully go away at some point.

The plain --allow-run is definitely problematic though.

@ntninja ntninja deleted the dev-run-with-perms branch December 29, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants