open_basedir restriction when parsing LESS files - less

I got a warning when parsing my "Twitter BootStrap" files and saving them on disk in my less-cache folder.
Warning: is_file(): open_basedir restriction in effect. File(/../../lib/bootstrap/less/reset.less.less) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/httpdocs/wp-content/modules/wp-less/lessc/lessc.inc.php on line 80
I'm using (for example) #import "../../lib/bootstrap/less/reset.less"; in the main file that I'm parsing.
The funky thing is, that the first stylesheet gets the extension two times: reset.less.less - the other ones not. Another thing that keeps me wondering, is why the heck there's a leading / in front of the files.
Some data about the environment and server:
PHP 5.3.3
Wordpress 3.4.2
The WP-LESS Plugin (yes, I commit to this repo), which uses the LESSc library - which throws the error from here.
php.ini
include_path = ".:..:"
upload_temp_dir _no value/not set_
open_basedir = "/var/www/vhosts/example.com/:/tmp/"
Thanks for any help in advance!

Related

node red cannot GET /myfile from directory

I would like to ask.
I have file in C:\users\nxf68958\.Node-red\report.html
And when I would like to open this file by: localhost:1880/report.html
I get:
Cannot GET /report.html
in Log I have: "Nov 09:52:00 - [info] User directory : \Users\nxf68958\.node-red"
I am using:
NR: 3.0.2
Node: 18.12.0
It worked perfectly on older versions of: NR: 2.2 and Node: 16.13.
Then I actualized and it stopped working.
In settings.js is option: "fileWorkingDirectory" I tried to change it, but without change.
What I am doing wrong?
Thank you
Node-RED will not serve static files by default, you have to explicitly enable it by settings the httpStatic option in the settings.js file.
Settings the httpStatic value to point to the userDir (which is what you have basically done by setting it to __dirname) is a bad idea from a security point of view because this means anybody can download your flows.json and flows_creds.json files and the files like settings.js and .config.runtime.json (which holds the default encryption key for the creds file).
fileWorkDirectory is purely to set the default working directory for the code nodes that interact with the filesystem, it will have no effect on what files are served by the HTTP server.

Why is my ProxyPass and uWSGI not connecting?

I am trying to get a python environment live for a Django project and it's fighting me. I have installed mod_proxy_uwsgi through EasyApache4 (mod_proxy was already on). I have added the following include in the Apache include editor under pre-virtual host (Versioned):
include /etc/apache2/conf.d/userdata/std/2_4/user/domain/proxy.conf
with the following content:
ProxyPreserveHost On
ProxyPass "/" "unix://localhost/var/run/swerth_django.sock"
ProxyPassReverse "/" "unix://localhost/var/run/swerth_django.sock"
I have used YUM installer to install uWSGI and run using a .ini file (command:uwsgi --ini php.ini) with the following content which is executing fine so far (no error messages):
[uwsgi]
chdir=/home/swerth/public_html/mysite
module=mysite.wsgi:application
env=DJANGO_SETTINGS_MODULE=mysite.settings
master=True
pidfile=/tmp/project-master.pid
socket=127.0.0.1:49152
processes=5
harakiri=20
post-buffering=1
max-requests=5000
vacuum=True
home=/home/swerth/public_html/Swerth.VirtualEnv
Despite all this, it's still not working. My Django project still isn't serving. I have a sneaky suspicion that there's something I don't understand about these systems and reverse proxying. Is there something I'm missing or messing up?
Ok, so turns out I was adding my Include function under the versioned part of the includes editor and it needed to be added under the global one because of how the includes editor adds the files to the main httpd.conf file (versioned wasn't being included into the main httpd.conf for some reason)

Which IntelliJ config files should I save in my dotfiles?

I would like to keep my IntelliJ config files in my dotfiles repo but my ~/.IntelliJIdea2016.1 folder weights > 1.3G :(
~/.IntelliJIdea2016.1/config/ still weights > 215M...
~/.IntelliJIdea2016.1/config/plugins/ contains lots of binaries... not the best candidates for dotfiles :(
Anyone tried to save IntelliJ config without Export/Import settings menu option?
No need to store IntelliJ config file, just use
IDE Settings Sync plugin.
See this post: Better Synchronization of your Settings Across Devices
Sadly, it's not simple. The user configuration folders are not well-documented and have historically included a bunch of default junk, which is slowly being stripped out (see https://youtrack.jetbrains.com/issue/IDEA-128660 and https://youtrack.jetbrains.com/issue/IDEA-163616). The documentation of settings files is also very poor; my request for improvement was declined https://youtrack.jetbrains.com/issue/IDEA-154157).
I version control my settings. If you request access, you can see it at https://gitlab.com/jcrben-staples/dotfiles-group/dotfiles/tree/master/config/intellij-idea-latest with notes at https://gitlab.com/jcrben-staples/dotfiles-group/dotfiles/tree/master/config/intellij-idea-latest/MY_CONFIG_DOCS.md).
I set up my .gitignore to ignore everything by default, and then I whitelist the files that I want. With IntelliJ, I didn't know where to start, so I whitelisted the entire folder and then blacklisted a bunch of the files.
My blacklist doesn't exactly answer your question about what files to include, but it does give you an idea of what to exclude. I'll try to update this if I figure out which ones to include at some point, but it's a mishmash of plugin files and such.
Right now the blacklist looks something like this:
# IntelliJ IDEA stuff
.idea
!config/intellij-idea-latest/**
!projects/bi-idea/workspace.xml
# statistics files
config/intellij-idea-latest/options/statistics*
config/intellij-idea-latest/options/feature.usage.statistics.xml
config/intellij-idea-latest/options/usage.statistics.xml
config/intellij-idea-latest/options/statistics.application.usages.xml
# user files ??
config/intellij-idea-latest/user*
# other
config/intellij-idea-latest/options/atlassian-ide-plugin.app.xml
config/intellij-idea-latest/options/cachedDictionary.xml
config/intellij-idea-latest/options/customization.xml
# has my autobracket disable
config/intellij-idea-latest/options/CodeGlance.xml
# config/intellij-idea/options/editor.codeinsight.xml
config/intellij-idea-latest/options/databaseDrivers.xml
config/intellij-idea-latest/options/debugger.xml
config/intellij-idea-latest/options/dimensions.xml
config/intellij-idea-latest/options/extensionsRootType.xml
config/intellij-idea-latest/options/filetypes.xml
config/intellij-idea-latest/options/find.xml
config/intellij-idea-latest/options/find.recents.xml
config/intellij-idea-latest/options/jdk.table.xml
config/intellij-idea-latest/options/gemmanager.xml
config/intellij-idea-latest/options/github_settings.xml
config/intellij-idea-latest/options/gradle.run.settings.xml
config/intellij-idea-latest/options/extensionsRootType.xml
config/intellij-idea-latest/options/hg.xml
config/intellij-idea-latest/options/ignore.xml
config/intellij-idea-latest/options/markdown.xml
config/intellij-idea-latest/options/multimarkdown.local.xml
config/intellij-idea-latest/options/multimarkdown.shared.xml
config/intellij-idea-latest/options/options.xml
config/intellij-idea-latest/options/other.xml
config/intellij-idea-latest/options/packages.xml
config/intellij-idea-latest/options/pomodoro.state.xml
config/intellij-idea-latest/options/project.default.xml
config/intellij-idea-latest/options/proxy.settings.pwd
config/intellij-idea-latest/options/recentProjects.xml
config/intellij-idea-latest/options/recentProjectDirectories.xml
config/intellij-idea-latest/options/remote-servers.xml
config/intellij-idea-latest/options/runner.layout.xml
config/intellij-idea-latest/options/scratches.xml
config/intellij-idea-latest/options/stubIndex.xml
config/intellij-idea-latest/options/updates.xml
config/intellij-idea-latest/options/usageView.xml
config/intellij-idea-latest/options/vcs.xml
config/intellij-idea-latest/options/window.manager.xml
config/intellij-idea-latest/options/window.state.xml
# turn off those auto-update messages...
config/intellij-idea-latest/port
config/intellij-idea-latest/plugins/*
config/intellij-idea-latest/tasks/*
config/intellij-idea-latest/extensions/
config/intellij-idea-latest/jdbc-drivers/*
# region START UNIGNORE IntelliJ
!config/intellij-idea-latest/scratches/
!config/intellij-idea-latest/consoles/
config/intellij-idea-latest/consoles/.history/*
# General settings
# config/intellij-idea-latest/sonarlint/
config/intellij-idea-latest/javascript/nodejs/**
# config/intellij-idea-latest/options/editor.codeinsight.xml # has my autobracket disable
# endregion END UNIGNORE Intellij
This leaves fair number of files which are not blacklisted - plus I symlink my .idea files sometimes and version control those settings, although workspace.xml has a lot of stuff and it changes all the time (see https://youtrack.jetbrains.com/issue/IDEA-163348).
Also, keep your eye out for "Share" buttons like the one shown for a scope below, as these seem to control whether the setting is shared to a configuration.
The most elegant set up for settings configuration comes from VSCode - hopefully at some point Jetbrains will figure this out and copy them:
You can either 'Share settings through a settings repository' or you can 'Share your settings with the Settings Sync plugin'.
More details can be found at https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html. If the link ever expires please let me know in the comments below.

Khan Academy API displayed on Geektool

I have been experimenting with the Khan Academy API found here
http://api-explorer.khanacademy.org/api/v1/user
and tried to find a way to display a user's points (and maybe some other information) on the desktop using geektool. I tried this
stackoverflow.com/questions/12514722/khan-academy-php-oauth-code
and
github.com/Khan/khan-api/
but nothing seems to work. The first link is the khan academy API provided as is. The second is someone with a similar problem who found a solution. He wrote a PHP script according to the temboo library and said to replace a few fields of the PHP and add both the PHP and the Temboo source code to the webroot. So, I added a folder called "php-sdk" into the webroot which is in /Library/WebServer/Documents/ and inside that folder was another folder "src" which contained the Khan Academy API and the Temboo library. Here is what I had.
cl.ly/image/2c2Z1B3T443L
Then I took a look at this and followed the steps until 6:19. Then I started the Apache server by entering this in terminal...
sudo apachectl restart
I opened a web browser, and typed in this...
localhost/php-sdk/src/khanAcademy.php
and I got this...
Warning: require(php-sdk/src/temboo.php): failed to open stream: No such file or directory in /Library/WebServer/Documents/php-sdk/src/khanAcademy.php on line 66
Fatal error: require(): Failed opening required 'php-sdk/src/temboo.php' (include_path='.:') in /Library/WebServer/Documents/php-sdk/src/khanAcademy.php on line 66
any ideas on what this could mean or how I could fix this? I am not advanced in PHP, or python, but I really would love to find a solution to this problem and I am willing to try anything that might work.
This error:
Warning: require(php-sdk/src/temboo.php): failed to open stream: No such file or directory in /Library/WebServer/Documents/php-sdk/src/khanAcademy.php on line 66
indicates that the path you're using for require is likely incorrect. Currently your PHP is trying to find a file called temboo.php here:
/Library/WebServer/Documents/php-sdk/src/php-sdk/src/temboo.php
Note the repeated directory structure. I'll make an assumption that your temboo.php is in the same directory as your khanAcademy.php file. In that case, simply change require "php-sdk/src/temboo.php" to require "temboo.php". If my assumption is incorrect, just adjust the include path accordingly.

XUL standalone application not starting

I recently took on a project built on XUL (standalone, using xulrunner) - However I can't get it to properly run.
I'm getting this error when I attempt to start it using the command line (xulrunner.exe ../application.ini -jsconsole):
No chrome package registered for chrome://case_scenario_builder/content/case_scenario_builder.xul
The chrome.manifest file looks like this:
content case_scenario_builder file:chrome/case_scenario_builder/content/ contentaccessible=yes
content jslib jar:chrome/jslib.jar!/
skin case_scenario_builder skin file:chrome/case_scenario_builder/skin/
locale case_scenario_builder en-US chrome/case_scenario_builder/locale/en-US/
Any ideas on where I could start debugging?
I figured it out!
In case anyone else runs into this as well:
It was due to the caching system in place by default and the use of .jar containers instead of folders.
The XUL environment had cached both JS and XUL files - and even after disabling those, I had to extract everything that was in the .jar file to the content folder and update the chrome.manifest file.
Thanks for your suggestions on debugging! - they helped the process.
I guess your manifest just isn't getting loaded. To test that I'd introduce an intentional syntax error and check the error console. E.g. if you put
asdfasd
on its own line, you should get a Warning: Ignoring unrecognized chrome manifest directive 'asdfasd'. in the Error console.
(Note to other experts: initially I wanted to suggest dropping 'file:' prefix and avoiding underscores in the package name, but I tested it on a Firefox nightly, and it works fine.)
Your chrome package clearly didn't get registered. From what I can tell, the reason is the bogus file: prefix, you should drop it when specifying relative paths:
content case_scenario_builder chrome/case_scenario_builder/content/ contentaccessible=yes
Btw, I suspect that you copied contentaccessible=yes from somewhere - you should drop it as well unless you know what it does.