Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that we don't have a vulnerability from cabal #737

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- Ensure homepage string is not too long in cabal.rb to avoid DOS attack

## 4.5.0

### Changed
Expand Down
6 changes: 6 additions & 0 deletions lib/licensed/sources/cabal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ def package_docs_dirs(package)
# Returns a homepage url that enforces https and removes url fragments
def safe_homepage(homepage)
return unless homepage
# Ensure there's no denial of service issue with a long homepage
# 1000 characters is likely enough for any real project homepage
# See https://github.com/github/licensed/security/code-scanning/1
if homepage.length > 1000
raise ArgumentError, "Input too long"
end
# use https and remove url fragment
homepage.gsub(/http:/, "https:")
.gsub(/#[^?]*\z/, "")
Expand Down
Loading