
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
Query your logs using good old ActiveRecord.
Add this line to your application's Gemfile:
gem 'queryable_logs'
And then execute:
$ bundle
Or install it yourself as:
$ gem install queryable_logs
Run
rails g queryable_logs
.
This will generate a migration file.
class CreateTrailLogs < ActiveRecord::Migration
def change
create_table :trail_logs do |t|
t.integer :user_id
t.string :ip_address
t.string :controller
t.string :action
t.string :format
t.string :http_verb
t.text :params_hash
t.datetime :logged_at
t.string :response_code
t.string :request_url
t.string :sig
t.timestamps null: false
end
end
end
and an initializer file.
class Trail
cattr_accessor :current_user_method, :logger, :saving_logs
LogFile = Rails.root.join('log', 'trail.log')
delegate :debug, :info, :warn, :error, :fatal, :to => :logger
end
Trail.logger = Logger.new(Trail::LogFile)
Trail.logger.level = 'info' # could be debug, info, warn, error or fatal
Trail.current_user_method = :current_user
queryable_logs also logs the current user id. Let the gem know which method you are using to get the current user. Default is set to current_user
.
Finally, include the QueryableLogs::WriteLog
in the base controller, typically the ApplicationController
.
class ApplicationController < ActionController::Base
include QueryableLogs::WriteLog
end
Enter the following task to your crontab rake parse:logs_to_db
eg: 0 * * * * cd /Users/akshaytakkar/sample_rails_app && /Users/akshaytakkar/.rvm/wrappers/ruby-3.1.0/rake db:parse_log_and_save_trails >> /Users/akshaytakkar/sample_rails_app/log/worker.log 2>&1
This will run the rake parse:logs_to_db
rake task every hour and log any errors or output from the task to worker.log
file.
Use QueryableLogs::TrailLog
like any ActiveRecord object.
eg: query how many requests you got for the posts
controller index
action. QueryableLogs::TrailLog.where(controller: 'posts', action: 'index').count
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the QueryableLogs project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that queryable_logs demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.