rollbar / rollbar.js

Error tracking and logging from Javascript to Rollbar
https://docs.rollbar.com/docs/javascript
MIT License
566 stars 212 forks source link

Deno support - does Rollbar need to read files outside of current directory? #1113

Closed josephrocca closed 8 months ago

josephrocca commented 1 year ago

Currently Rollbar works in Deno. Just install, then run the script below with deno run --allow-read --allow-net main.js

// main.js
import Rollbar from "npm:rollbar@2.26.2"; 

let rollbar = new Rollbar({
  accessToken: 'f73a.......',
  captureUncaught: true,
  captureUnhandledRejections: true,
});

rollbar.log('Hello world!');

That works fine.

But the problem is that it needs to read a file outside of the current directory. I'm not sure yet what file this is but I'm wondering whether it's possible to ensure that Rollbar only every reads files within the current directory (and subdirectories)?

If this were possible, then that would mean I could give my servers the --allow-read=. permission, which is much safer than allowing the server to read any file on the machine (which is what's currently required to get Rollbar working in Deno).

Currently I use --allow-read=. on my servers, and none of my other imports have any trouble with this. It's only Rollbar that seems to want to look outside of the current directory.

josephrocca commented 1 year ago

Here's the issue: https://github.com/denoland/deno/issues/19864#issuecomment-1639804027

Is there a less hacky way to do that, or could one be added? I don't want to give my server read access to my whole machine, even if that means having to add some extra configuration options or something.

mudetroit commented 8 months ago

I don't think that we have a cleaner solution to that at this time. That said I am opening an internal issue to evaluate our support for deno (and other new JS runtimes like Bun) to evaluate improving our support for them.

josephrocca commented 8 months ago

Thank you!