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 mountable blog engine for Rails.
Add this line to your application's Gemfile:
```bash
gem 'chive'
```
Run the rake task for a complete installation:
```bash
$ rake chive:complete
```
The complete installation includes Devise for user authentication. Alternatively, you can run rake chive:install
to get the minimum requirements without Devise.
Next, run the database migrations:
```bash
$ rake db:migrate
```
If you installed with rake:complete
, you can seed the database with an example user and article:
```bash
$ rake db:seed
```
Start the server:
```bash
$ rails s
```
Browse to http://localhost:3000/chive
. You should see the article index page.
If you installed with rake:complete
, go to http://localhost:3000/users/sign_in
and log in with email example@example.com
and password password
.
If you don't have user authentication configured, you'll still be able to test the admin features in development mode. For security purposes, you're required to supply an authentication implementation for the admin pages to work in production.
If you want to customize Chive or to integrate it into an existing app, you can follow these steps to get it working.
Install the minimum dependencies:
$ rails g chive:dependencies
$ bundle install
The default:
$ rails g chive:ckeditor
$ rake active_storage:install
The default CKEditor configuration uses ActiveRecord and ActiveStorage to store images and attachments. You can select different options by running rails g ckeditor:install
instead. See the CKEditor gem for more information.
To use Chive's default authorization for uploading files through CKEditor, add this line to config/initializers/ckeditor.rb
:
config.authorize_with :chive
rails g chive:initializer
rake chive:install:migrations
rake acts_as_taggable_on_engine:install:migrations
Chive requires a users table for authors. The default installation uses Devise. To install Devise with Chive's defaults:
rails g chive:devise
If you want to use an existing Devise setup or an alternative user system, update config/initializers/chive.rb
to point to your user model. Note that Chive requires the user model to include a name
attribute.
If you're using Devise you can get quick and easy authentication with the use_devise
option in config/initializers/chive.rb
:
config.use_devise = true
To customize authentication, you'll need to modify the controllers. Add them to your app/controllers
directory:
rails g chive:controllers
The default routes in config/routes.rb
:
Rails.application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
mount Chive::Engine => "/chive"
# ...etc.
end
You can make the blog your home page by changing the Chive::Engine
path to /
:
Rails.application.routes.draw do
# [...etc.]
# If you mount Chive on the home page, make sure it's the last route you
# define. Otherwise `Chive::Engine#index` will process all your website's
# paths before the other routes have a chance to evaluate them.
mount Chive::Engine => '/'
end
There are a few different options for modifying the look and feel of Chive pages.
The config.public_layout
setting in config/initializers/chive.rb
lets you change the layout used by public pages (i.e., Chive::Articles#index
and Chive::Articles#show
). This is useful for applying your own style to the main site while still using the standard admin pages for content management.
To modify the views, add them to your app/views
directory:
rails generate chive:views
Another option for customizing your blog is to create a custom resource.
Make your own controller, e.g., apps/controller/blog_controller.rb
:
class BlogController < Chive::ArticlesController
layout 'application'
end
The layout
call makes your controller use your app/views/layout/application
layout instead of the engine's.
Add a new path to config/routes.rb
:
Rails.application.routes.draw do
# ...
resources :blog, path: '/blog', controller: 'blog', only: [:index, :show]
# ...
end
The only: [:index, :show]
option limits the resource to the public pages.
Now you can make your own views at app/views/blog/index.html.erb
and app/views/blog/show.html.erb
.
Chive uses the following libraries and plugins:
FAQs
Unknown package
We found that chive 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.