
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Simple Pathname
wrapper that provides convenient
and safe interface for filesystem traversal.
Useful in situations where you need to accept parameters from external sources (like HTTP request) or read data from potentially unsafe directory structure (containing symbolic links).
Restrict access to directory:
root = Dire.root 'path/to/dir'
=> #<Dire::Dir>
Basic Dire::Dir
methods:
dir = root.get 'path/to/subdir'
=> #<Dire::Dir>
dir.dirs
=> [#<Dire::Dir>, #<Dire::Dir>, ...]
dir.files
=> [#<Dire::File>, #<Dire::File>, ...]
root.list
=> [#<Dire::Dir>, #<Dire::File>, ...]
Basic Dire::File
methods:
file = dir.get 'path/to/file.txt'
=> #<Dire::File>
# check data encoding
file.binary?
=> false
# get MimeMagic (mimemagic gem)
file.mime
=> #<MimeMagic>
# inverse of binary
file.text?
=> true
Common Dire::Node
methods:
# associated Pathname (for IO use)
file.path
=> #<Pathname>
# alias of path
file.absolute_path
=> #<Pathname>
# relative as string
file.param
=> #<String>
# relative to root
file.relative_path
=> #<Pathname>
Ignore patterns:
Dire::IGNORE << 'globbing/pattern'
# raises Dire::Error::InvalidPath
dir.get 'path/matching/pattern'
For more information check lib and test.
Add dire
gem.
Add route:
get 'controller_path(/:path_parameter)',
as: 'route_name',
to: 'controller_name#action_name',
constraints: { path: /.+/ },
format: false
Force HTML:
before_action :force_html, only: 'action_name'
def force_html
request.format = :html
end
FAQs
Unknown package
We found that dire 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
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.