modules/exploits/multi/http/gitlab_file_read_rce.rb
File gitlab_file_read_rce.rb
has 444 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
prepend Msf::Exploit::Remote::AutoCheck
Method initialize
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'GitLab File Read Remote Code Execution',
Method read_secret_key_base
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def read_secret_key_base
return datastore['SECRET_KEY_BASE'] if datastore['SECRET_KEY_BASE'].present?
validate_credentials_present!
git_lab_client = GitLabClient.new(self)
Method read_secret_key_base
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def read_secret_key_base
return datastore['SECRET_KEY_BASE'] if datastore['SECRET_KEY_BASE'].present?
validate_credentials_present!
git_lab_client = GitLabClient.new(self)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_issue
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_issue(project:, issue:)
new_issue_path = "#{project['path']}/issues/new"
create_issue_path = "#{project['path']}/issues"
csrf_token = extract_csrf_token(
Method create_project
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_project(user:)
new_project_path = '/projects/new'
create_project_path = '/projects'
csrf_token = extract_csrf_token(
Method move_issue
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def move_issue(issue:, target_project:)
issue_path = issue['path']
move_issue_path = issue['move_path']
csrf_token = extract_csrf_token(
Method sign_in
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def sign_in(username, password)
@http_client.cookie_jar.clear
sign_in_path = '/users/sign_in'
csrf_token = extract_csrf_token(