Module: Gitlab::Regex::Packages::Protection::Rules

Defined in:
lib/gitlab/regex/packages/protection/rules.rb

Class Method Summary collapse

Class Method Details

.protection_rules_npm_package_name_pattern_regexObject

Regex for NPM package name patterns in protection rules. Accepts package names with optional wildcards, including standalone ‘*’ to match all packages.

Examples:

- '*' (matches all packages)
- '@scope/package-*' (matches packages with wildcard at end)
- '@scope/*-package' (matches packages with wildcard at start)


15
16
17
18
# File 'lib/gitlab/regex/packages/protection/rules.rb', line 15

def self.protection_rules_npm_package_name_pattern_regex
  @protection_rules_npm_package_name_pattern_regex ||=
    %r{\A(?:\*|#{Gitlab::Regex.npm_package_name_regex('*')})\z}
end

.protection_rules_pypi_package_name_pattern_regexObject

Regex for PyPI package name patterns in protection rules. Accepts package names with optional wildcards, including standalone ‘*’ to match all packages.

Examples:

- '*' (matches all packages)
- 'package-*' (matches packages with wildcard at end)
- '*-package' (matches packages with wildcard at start)


27
28
29
30
# File 'lib/gitlab/regex/packages/protection/rules.rb', line 27

def self.protection_rules_pypi_package_name_pattern_regex
  @protection_rules_pypi_package_name_pattern_regex ||=
    %r{\A(?:\*|#{Gitlab::Regex.package_name_regex('*')})\z}
end