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
[apps] App attempts require() of module in same directory -> "ERROR: Unsafe App require" #5356
Comments
I think that you're looking along the right lines -
The tests are probably making an incorrect assumption somewhere to do with what the paths are like here, it would be interesting to see if you could recreate a failure case or put the console logging in the tests to see how it behaves differently. I really recommend playing with it some more - will happily merge a fix, but this is not being actively worked on or really considered a working part of the codebase 😉 |
Yes, Will stick to stuffing my code in |
I don't think this needs to be closed - it is a bug & should be tracked. I was just trying to infer that it's not considered high priority, as most bugs are. |
Wanted to dive in and help out on a 'beginner' issue. Spent some time on this, and using these files: Index.js:
package.json
Structure:
I get:
I'm willing to dig deeper, if someone can give me some pointers. Or if there are other more important bugs/issues that a first-timer to the project can help out with, please direct me to those. I can and want to do both client and server work in ghost. |
Hi there @program247365, sorry to send you off on a wild goose chase with this! Since it was raised, much of Ghost has changed and apps (which are not yet officially supported) no longer have permissions to access the API. That means requests through the api proxy fail with these big unhelpful errors. I'm going to close this for now with the As for other issues to work on, I've been going through the repo today closing as many of the issues that are stalled or not ready to be worked on as possible, and marking things with |
Gotcha. No problem at all. Just looking to start contributing. Thanks for updating it. I'll keep an eye on the beginner label filter. Thanks! |
Hi, I found a workaround using this:
|
My app works fine with all code inside
../content/apps/fayspook/index.js
as in https://github.com/TryGhost/Ghost/wiki/Apps-Getting-Started-for-Ghost-Devs.However, when I refactor the code by placing the app logic in a separate module
client.js
which Irequire('./client')
fromindex.js
:This should work, shouldn't it? Or do these test cases fail, or aren't even performed?:
https://github.com/TryGhost/Ghost/blob/c7713c1d2730d548591ff6b68ac7d0d423516f7e/core/test/utils/fixtures/app/good.js
https://github.com/TryGhost/Ghost/blob/c7713c1d2730d548591ff6b68ac7d0d423516f7e/core/test/utils/fixtures/app/goodlib.js
Trying to find out what is going on here, I added some logging to https://github.com/TryGhost/Ghost/blob/stable/core/server/apps/sandbox.js#L19 ...
... causing this output:
Maybe something fishy here with the variable
modulePath
?The text was updated successfully, but these errors were encountered: