Skip to content
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
3 changes: 3 additions & 0 deletions .github/tests/deploy-static-lock-validator.test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@
"unknown private manifest package" => ["@cellarnode/internal-secrets", "1.0.0", false],
"aliased unknown private manifest package" => ["hidden-package", "npm:@cellarnode/internal-secrets@1.0.0", false],
"allowed private manifest package" => ["@cellarnode/ui", "1.0.0", true],
"frozen renderer registry alias" => ["@cellarnode/ui-renderer-0-154", "npm:@cellarnode/ui@0.154.0", true],
"frozen renderer alias to public target" => ["@cellarnode/ui-renderer-0-154", "npm:leftpad@1.0.0", false],
"allowed alias with path traversal version" => ["@cellarnode/ui", "npm:@cellarnode/ui@0.154.0/../../evil", false],
"allowed public registry range" => ["public-package", "^1.0.0", true],
"aliased public manifest package" => ["@cellarnode/ui", "npm:evil-package@1.0.0", false],
"git manifest package" => ["public-package", "git+https://evil.example/package.git", false],
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/deploy-static-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ jobs:
finance
i18n
ui
ui-renderer-0-154
].freeze
# A version-pinned npm: alias is registry-sourced, but only aliases
# that TARGET an allowed @cellarnode package are exempt from the
# protocol check (e.g. @cellarnode/ui-renderer-0-154 ->
# npm:@cellarnode/ui@0.154.0, the frozen e-label public renderer,
# CEL-1522). An npm: alias pointing anywhere else still fails.
allowed_registry_alias = /\Anpm:@cellarnode\/(?:#{Regexp.union(allowed_private_packages).source})@[^\s\/\\]+\z/
failures = []
manifests = []
Find.find(".") do |path|
Expand Down Expand Up @@ -221,8 +228,12 @@ jobs:
value.scan(private_package).flatten.each do |package|
failures << "#{path}:#{keys.join('.')}" unless allowed_private_packages.include?(package.downcase)
end
# An allowed registry alias is exempt from BOTH source checks: its
# scope slash would otherwise trip the path heuristic.
if keys.any? { |key| dependency_sections.include?(key) } &&
(protocol_dependency_source.match?(value) || path_or_archive_dependency_source.match?(value))
!allowed_registry_alias.match?(value) &&
(protocol_dependency_source.match?(value) ||
path_or_archive_dependency_source.match?(value))
failures << "#{path}:#{keys.join('.')}"
end
end
Expand Down Expand Up @@ -261,6 +272,7 @@ jobs:
finance
i18n
ui
ui-renderer-0-154
].freeze
failures = []
validate_private_packages = lambda do |text, keys|
Expand Down
Loading