Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A ruby library to read and write Java properties files.
Install via Rubygems
$ gem install java-properties
... or add to your Gemfile
gem "java-properties"
You can load a valid Java properties file from the file system using a path:
properties = JavaProperties.load("path/to/my.properties")
properties[:foo] # => "bar"
If have already the content of the properties file at hand than parse the content as:
properties = JavaProperties.parse("foo=bar")
properties[:foo] # => "bar"
You can write any Hash-like structure as a properties file:
hash = {:foo => "bar"}
JavaProperties.write(hash, "path/to/my.properties")
Or if you want to omit the file you can receive the content directly:
hash = {:foo => "bar"}
JavaProperties.generate(hash) # => "foo=bar"
As Java properties files normally hold UTF-8 chars in their escaped representation this tool tries to convert them:
"ה" <=> "\u05d4"
"𪀯" <=> "\ud868\udc2f"
The tool also escaped every '=', ' ' and ':' in the name part of a property line:
JavaProperties.generate({"i : like=strange" => "bar"})
# => "i\ \:\ like\=strange=bar"
In Java properties files a string can be multi line but line breaks have to be escaped.
Assume the following input:
my=This is a multi \
line content with only \n one line break
The parses would read:
{:my => "This is a multi line content which only \n one line break"}
In the opposite direction line breaks will be correctly escaped but the generator will never use multi line values.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Jonas Thiel (@jonasthiel)
For more information about the properties file format have a look at the Java Plattform documenation.
This gem is released under the MIT License. See the LICENSE file for further details.
FAQs
Unknown package
We found that java-properties demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.