Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A simple Sinatra app for managing translations stored in YAML files, database or Redis.
Look at this as localeapp hosted in your application.
Add this line to your application's Gemfile:
gem 'autochthon', github: 'asok/autochthon
Add this to your Gemfile:
gem 'i18n-active_record', :require => 'i18n/active_record'
Create file config/initializers/autochthon.rb
with content:
require 'i18n/backend/active_record'
I18n.backend = Autochthon.backend = Autochthon::Backend::ActiveRecord.new
Autochthon.mount_point = "your_mount_point"
Probably you will want to use memoize so you don't generate a bunch of queries on each request:
require 'i18n/backend/active_record'
if I18n::Backend::ActiveRecord::Translation.table_exists?
I18n.backend = Autochthon.backend = Autochthon::Backend::ActiveRecord.new
I18n.backend.class.include(I18n::Backend::Memoize)
end
Autochthon.mount_point = "your_mount_point"
NOTE: this will not work when you have your web server running several ruby processes. That is the process in which you'll update the translation will see the new value for it. But other requests might be served by another process which will have the old value. If that's the case consider:
Create the translations table:
bundle exec rake autochthon:create
Add this to your Gemfile:
gem 'redis-i18n'
Create file config/initializers/autochthon.rb
with content:
require 'i18n/backend/redis'
I18n.backend = Autochthon.backend = Autochthon::Backend::Redis.new
Autochthon.mount_point = "your_mount_point"
NOTE: this backend operates in memory only. Meaning that your translations will not be persisted anywhere.
Create file config/initializers/autochthon.rb
with content:
I18n.backend = Autochthon.backend = Autochthon::Backend::Simple.new
Autochthon.mount_point = "your_mount_point"
Add this to the routes:
mount Autochthon::Web => Autochthon.mount_point, :as => 'autochthon''
Probably you will want to authenticate. In case you are using devise you can do:
authenticate(:admin) do
mount Autochthon::Web => '/autochthon', :as Autochthon.mount_point
end
You can import existing translations from the I18n's simple backend (YAML files):
rake autochthon:import
If you want to only import specific locales you can do so:
LOCALES="en,fr" rake autochthon:import
In your app/assets/javascripts/application.js
file do:
//= require 'autochthon/application'
Now you can right click on the missing translations to fill them in.
In the dir web/
run npm install
fallowed by npm run watch
.
That will compile the js files and put them in public/bundle.js
.
Note: for a release you can run npm run build
.
bundle exec rspec
Bug reports and pull requests are welcome on GitHub at https://github.com/asok/autochthon.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that autochthon 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.