Skip to content

Commit

Permalink
Merge pull request #131 from Security-Tools-Alliance/70-rework-versio…
Browse files Browse the repository at this point in the history
…n-number-bump

feat(version): centralize version management in web/reNgine/version.txt
  • Loading branch information
AnonymousWP authored Jul 24, 2024
2 parents 7ce72e3 + bb31c36 commit 5fd77ee
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 18 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</a>
</div>
<h3 class="">Login to reNgine-ng</h3>
<p>Current release: v2.0.6</p>
<p>Current release: v{{ RENGINE_CURRENT_VERSION }}</p>
</div>
<div class="alert alert-primary" role="alert">
<a href="https://github.com/Security-Tools-Alliance/rengine-ng/wiki" target="_blank">Learn how to create reNgine-ng account.</a>
Expand Down

0 comments on commit 5fd77ee

Please sign in to comment.