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

feat(version): centralize version management in web/reNgine/version.txt #131

Merged
merged 1 commit into from
Jul 24, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ web/custom_engines*
Pipfile*
resume.cfg
*.txt
!version.txt
*.log
*.pot
*.pyc
Expand Down
3 changes: 0 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=${POSTGRES_HOST}
# THIS IS A MUST FOR CHECKING UPDATE, EVERYTIME A COMMIT IS MERGED INTO
# MASTER, UPDATE THIS!!! MAJOR.MINOR.PATCH https://semver.org/
- RENGINE_CURRENT_VERSION='2.0.6'
volumes:
- ./web:/usr/src/app
- github_repos:/usr/src/github
Expand Down
8 changes: 3 additions & 5 deletions web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from reNgine.celery import app
from reNgine.common_func import *
from reNgine.definitions import ABORTED_TASK
from reNgine.settings import RENGINE_CURRENT_VERSION
from reNgine.tasks import *
from reNgine.gpt import GPTAttackSuggestionGenerator
from reNgine.utilities import is_safe_path
Expand Down Expand Up @@ -799,11 +800,8 @@ def get(self, request):

# get current version_number
# remove quotes from current_version
current_version = ((os.environ['RENGINE_CURRENT_VERSION'
])[1:] if os.environ['RENGINE_CURRENT_VERSION'
][0] == 'v'
else os.environ['RENGINE_CURRENT_VERSION']).replace("'", "")

current_version = (RENGINE_CURRENT_VERSION[1:] if RENGINE_CURRENT_VERSION[0] == 'v' else RENGINE_CURRENT_VERSION).replace("'", "")

# for consistency remove v from both if exists
latest_version = re.search(r'v(\d+\.)?(\d+\.)?(\*|\d+)',
((response[0]['name'
Expand Down
8 changes: 4 additions & 4 deletions web/dashboard/templates/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% endblock custom_js_css_link %}

{% block breadcrumb_title %}
<span class="badge badge-soft-info">reNgine 2.0.6</span>
<span class="badge badge-soft-info">reNgine-ng {{ RENGINE_CURRENT_VERSION }}</span>
{% endblock breadcrumb_title %}

{% block main_content %}
Expand All @@ -39,7 +39,7 @@ <h2 class="text-primary my-3 text-center"><span data-plugin="counterup">{{domain
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-12 col-12">
<div class="card" id="tooltip-container1">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Total Number of Subdomains discovered by reNgine across all targets."></i>
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Total Number of Subdomains discovered by reNgine-ng across all targets."></i>
<h4 class="mt-0 font-16">Total Subdomains</h4>
<h2 class="text-primary my-3 text-center"><span data-plugin="counterup">{{subdomain_count|intcomma}}</span></h2>
<div id="subdomains_chart"></div>
Expand All @@ -53,7 +53,7 @@ <h2 class="text-primary my-3 text-center"><span data-plugin="counterup">{{subdom
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-12 col-12">
<div class="card" id="tooltip-container2">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Total Endpoints/URLs discovered by reNgine across all targets & subdomains."></i>
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Total Endpoints/URLs discovered by reNgine-ng across all targets & subdomains."></i>
<h4 class="mt-0 font-16">Total Endpoints</h4>
<h2 class="text-primary my-3 text-center">{{endpoint_count|intcomma}}</h2>
<div id="endpoint_chart"></div>
Expand All @@ -67,7 +67,7 @@ <h2 class="text-primary my-3 text-center">{{endpoint_count|intcomma}}</h2>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-12 col-12">
<div class="card" id="tooltip-container3">
<div class="card-body">
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Total Vulnerabilities discovered by reNgine across all targets, subdomains & endpoints."></i>
<i class="fa fa-info-circle text-muted float-end" data-bs-container="#tooltip-container3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Total Vulnerabilities discovered by reNgine-ng across all targets, subdomains & endpoints."></i>
<h4 class="mt-0 font-16 text-danger">Total Vulnerabilities</h4>
<h2 class="text-danger my-3 text-center"><span data-plugin="counterup">{{total_vul_count|intcomma}}</span></h2>
<div id="vuln_chart"></div>
Expand Down
4 changes: 4 additions & 0 deletions web/reNgine/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dashboard.models import *
from . import settings

def projects(request):
projects = Project.objects.all()
Expand All @@ -11,3 +12,6 @@ def projects(request):
'projects': projects,
'current_project': project
}

def version(request):
return {"RENGINE_CURRENT_VERSION": settings.RENGINE_CURRENT_VERSION}
7 changes: 6 additions & 1 deletion web/reNgine/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mimetypes
import os
from pathlib import Path

from reNgine.init import first_run
from reNgine.utilities import RengineTaskFormatter
Expand All @@ -18,6 +19,9 @@
RENGINE_RECORD_ENABLED = bool(int(os.environ.get('RENGINE_RECORD_ENABLED', '1')))
RENGINE_RAISE_ON_ERROR = bool(int(os.environ.get('RENGINE_RAISE_ON_ERROR', '0')))

with open(Path(RENGINE_HOME) / 'reNgine' / 'version.txt', 'r', encoding="utf-8") as f:
RENGINE_CURRENT_VERSION = f.read().strip()

# Debug env vars
UI_DEBUG = bool(int(os.environ.get('UI_DEBUG', '0')))
UI_REMOTE_DEBUG = bool(int(os.environ.get('UI_REMOTE_DEBUG', '0')))
Expand Down Expand Up @@ -101,7 +105,8 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'reNgine.context_processors.projects'
'reNgine.context_processors.projects',
'reNgine.context_processors.version'
],
},
}]
Expand Down
1 change: 1 addition & 0 deletions web/reNgine/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.6
8 changes: 4 additions & 4 deletions web/templates/base/_items/top_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,18 @@ <h6 class="text-overflow m-0">Welcome {{user.get_username}}!</h6>
<div class="logo-box">
<a href="{% url 'dashboardIndex' current_project.slug %}" class="logo logo-dark text-center">
<span class="logo-sm">
<h3 class="text-logo vertical-center">reNgine-ng&nbsp;<small>2.0.6</small></h3>
<h3 class="text-logo vertical-center">reNgine-ng&nbsp;<small>{{ RENGINE_CURRENT_VERSION }}</small></h3>
</span>
<span class="logo-lg">
<h3 class="text-logo vertical-center">reNgine-ng&nbsp;<small>2.0.6</small></h3>
<h3 class="text-logo vertical-center">reNgine-ng&nbsp;<small>{{ RENGINE_CURRENT_VERSION }}</small></h3>
</span>
</a>
<a href="{% url 'dashboardIndex' current_project.slug %}" class="logo logo-light text-center">
<span class="logo-sm">
<h3 class="text-sm-logo vertical-center">reNgine-ng&nbsp;<small>2.0.6</small></h3>
<h3 class="text-sm-logo vertical-center">reNgine-ng&nbsp;<small>{{ RENGINE_CURRENT_VERSION }}</small></h3>
</span>
<span class="logo-lg">
<h3 class="text-lg-logo vertical-center">reNgine-ng&nbsp;<small>2.0.6</small></h3>
<h3 class="text-lg-logo vertical-center">reNgine-ng&nbsp;<small>{{ RENGINE_CURRENT_VERSION }}</small></h3>
</span>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/templates/base/login.html