Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
5df8e24
Update pipeline-config.yaml (#440)
bkaiserinfosec Dec 30, 2023
c3fb035
Update tox.ini (#441)
bkaiserinfosec Dec 30, 2023
57a681a
Feature/fix toxi (#443)
bkaiserinfosec Dec 30, 2023
b3d741c
Feature/fix toxi (#445)
bkaiserinfosec Dec 30, 2023
f62e0d1
Feature/fix toxi (#447)
bkaiserinfosec Dec 31, 2023
5c40b88
Feature/fix toxi (#449)
bkaiserinfosec Jan 1, 2024
b8d2775
Update Jenkinsfile (#452)
bkaiserinfosec Jan 4, 2024
9e4030d
Feature/jenkinsfile updates (#453)
bkaiserinfosec Jan 8, 2024
fb5d50f
Feature/jenkinsfile updates (#455)
bkaiserinfosec Jan 8, 2024
deaed40
Merge branch 'main' into release/0.2.0-beta/Test-1
bkaiserinfosec Jan 8, 2024
22fc757
Feature/jenkinsfile updates (#457)
bkaiserinfosec Jan 8, 2024
48869b8
Feature/jenkinsfile updates (#459)
bkaiserinfosec Jan 8, 2024
b88f33e
Feature/jenkinsfile updates (#461)
bkaiserinfosec Jan 8, 2024
3058cc8
Feature/jenkinsfile updates (#463)
bkaiserinfosec Jan 8, 2024
eae9cfd
Feature/jenkinsfile updates (#465)
bkaiserinfosec Jan 8, 2024
b1d3586
Feature/jenkinsfile updates (#467)
bkaiserinfosec Jan 10, 2024
a688f72
Feature/jenkinsfile updates (#469)
bkaiserinfosec Jan 10, 2024
d0edd8f
Update Jenkinsfile
bkaiserinfosec Jan 13, 2024
6bc2607
Update pipeline-config.yaml
bkaiserinfosec Jan 13, 2024
4e2bc4a
Update values.yaml
bkaiserinfosec Jan 13, 2024
fba2f2b
Update values.yaml
bkaiserinfosec Jan 13, 2024
1a298c0
Update Jenkinsfile
bkaiserinfosec Jan 15, 2024
ef00ba5
Update values.yaml
bkaiserinfosec Jan 15, 2024
f497be3
Update pipeline-config.yaml
bkaiserinfosec Jan 17, 2024
ee6d9dd
Feature/jenkinsfile updates (#473)
bkaiserinfosec Jan 17, 2024
22a872b
Feature/jenkinsfile updates (#474)
bkaiserinfosec Feb 27, 2024
64ed436
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Feb 27, 2024
1169457
Feature/jenkinsfile updates (#476)
bkaiserinfosec Feb 27, 2024
4b6af0b
Feature/jenkinsfile updates (#478)
bkaiserinfosec Feb 28, 2024
cebffc6
Update pipeline-config.yaml
bkaiserinfosec Feb 28, 2024
38282ba
Feature/jenkinsfile updates (#481)
bkaiserinfosec Feb 28, 2024
86da6a0
Feature/jenkinsfile updates (#483)
bkaiserinfosec Feb 28, 2024
e019ade
Feature/jenkinsfile updates (#485)
bkaiserinfosec Mar 9, 2024
33e0b20
Feature/jenkinsfile updates (#487)
bkaiserinfosec Mar 9, 2024
509a6f1
Update pipeline-config.yaml
bkaiserinfosec Mar 9, 2024
a52196c
Feature/jenkinsfile updates (#490)
bkaiserinfosec Mar 9, 2024
716c878
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 9, 2024
0f39204
Update pipeline-config.yaml
bkaiserinfosec Mar 9, 2024
ce79251
Update Jenkinsfile (#493)
bkaiserinfosec Mar 10, 2024
686ae51
Update security_quality_gate.py (#495)
bkaiserinfosec Mar 13, 2024
b4c8b1d
Feature/update jenkins config (#497)
bkaiserinfosec Mar 13, 2024
0cc02a4
Feature/update security gate config (#499)
bkaiserinfosec Mar 13, 2024
1b2577e
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 13, 2024
0cab74c
Feature/update settings function (#501)
bkaiserinfosec Mar 18, 2024
a598136
Feature/update release based db settings (#503)
bkaiserinfosec Mar 18, 2024
bc17dcc
Feature/update release based db settings (#505)
bkaiserinfosec Mar 18, 2024
14e819d
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 18, 2024
334bc68
Feature/fix db syntax (#507)
bkaiserinfosec Mar 18, 2024
24a95b3
Feature/fix db syntax (#509)
bkaiserinfosec Mar 18, 2024
74b26f7
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 18, 2024
0b07ab0
Feature/fix syntax error (#511)
bkaiserinfosec Mar 18, 2024
e246ba0
Feature/fix syntax error (#513)
bkaiserinfosec Mar 18, 2024
4cf2ebf
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 18, 2024
f98f329
Feature/fix syntax error (#515)
bkaiserinfosec Mar 20, 2024
e50317f
Feature/fix syntax error (#517)
bkaiserinfosec Mar 22, 2024
6eb3118
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
9edb485
Feature/jenkins updates (#519)
bkaiserinfosec Mar 22, 2024
76926b3
Feature/jenkins updates (#521)
bkaiserinfosec Mar 22, 2024
5399fad
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
7dd90fa
Feature/jenkins updates (#523)
bkaiserinfosec Mar 22, 2024
8428000
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
3422a4f
Feature/jenkins updates (#525)
bkaiserinfosec Mar 22, 2024
07cb6a7
Feature/jenkins updates (#527)
bkaiserinfosec Mar 22, 2024
4a11094
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
7319eb2
Feature/jenkins updates (#529)
bkaiserinfosec Mar 22, 2024
2319495
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
e5e42ed
Feature/jenkins updates (#531)
bkaiserinfosec Mar 22, 2024
6f14d86
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
feebb21
Feature/jenkins updates (#533)
bkaiserinfosec Mar 22, 2024
137ec5a
Merge branch 'main' into release/0.1.0-beta/Prod-azure
bkaiserinfosec Mar 22, 2024
3a610b5
Feature/add app profile update function (#535)
bkaiserinfosec Mar 23, 2024
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
26 changes: 19 additions & 7 deletions src/vr/api/vulns/jenkins_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,21 @@ def add_application_sla_policy(app_id):
# Global dictionary to keep track of report statuses
report_statuses = {}

# Create a logger object for this module or function
logger = logging.getLogger('add_new_scan')
logger.setLevel(logging.INFO) # Set the desired log level

# Create a stream handler to output logs to stdout
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.INFO)

# Optionally, set a formatter for the handler
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
stream_handler.setFormatter(formatter)

# Add the handler to the logger
logger.addHandler(stream_handler)
def add_new_scan(git_url, branch_name, report_id):
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

try:
stage_str = _determine_stages_for_app(git_url, branch_name)
Expand All @@ -232,13 +244,13 @@ def add_new_scan(git_url, branch_name, report_id):
url = f"{app.config['JENKINS_HOST']}/job/{app.config['JENKINS_PROJECT']}/buildWithParameters"
resp = requests.post(url, headers=headers, data=data, auth=HTTPBasicAuth(app.config['JENKINS_USER'], app.config['JENKINS_KEY']))
# Log the response details
logging.info(f"Request URL: {url}")
logging.info(f"Response Status Code: {resp.status_code}")
logging.info(f"Response Text: {resp.text}")
logger.info(f"Request URL: {url}")
logger.info(f"Response Status Code: {resp.status_code}")
logger.info(f"Response Text: {resp.text}")
except requests.exceptions.Timeout:
logging.error('Processing Error: Timeout')
logger.error('Processing Error: Timeout')
except Exception as e:
logging.error(f'Unexpected error: {str(e)}')
logger.error(f'Unexpected error: {str(e)}')


def _determine_stages_for_app(git_url, branch_name):
Expand Down
20 changes: 14 additions & 6 deletions src/vr/templates/vulns/application_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ <h3 class="has-filters mb-0">
Application Profile
</h3>





</div>
</div>

Expand All @@ -57,7 +53,18 @@ <h3 class="modal-title" id="updateAppProfileModalLabel">Update Application Profi
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="/update_application_profile" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="app_name" value="{{ app_data.ApplicationName }}"/>
<div class="form-group">
<label for="gitUrl" style="margin-right: 64px;">Git URL:</label>
<input type="text" class="form-control" id="gitUrl" name="gitUrl" value="{{ app_data.RepoURL }}">
</div>
<div class="form-group">
<label for="gitBranch" style="margin-right: 42px;">Git Branch:</label>
<input type="text" class="form-control" id="gitBranch" name="gitBranch" value="main">
</div>
<div class="modal-body">
<div class="form-group">
<label for="emailDistributionUpdate">Email Distribution List (optional):</label>
<input type="text" class="form-control" id="emailDistributionUpdate" placeholder="Enter email distribution list">
Expand All @@ -66,8 +73,9 @@ <h3 class="modal-title" id="updateAppProfileModalLabel">Update Application Profi
<p>NOTE: This will perform an Application Profile Assessment on the OnDemand Security Pipeline. This process can take up to 1 hour to complete and the results will be emailed to your registered email in addition to the optional Email distribution list entered above.</p>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Submit</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
Expand Down
41 changes: 40 additions & 1 deletion src/vr/vulns/web/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,45 @@ def on_demand_testing():
return redirect(request.referrer)


@vulns.route("/update_application_profile", methods=['POST'])
@login_required
def update_application_profile():
NAV['curpage'] = {"name": "Vulnerability Scans"}
admin_role = 'Application Admin'
role_req = ['Application Admin', 'Application Viewer']
perm_entity = 'Application'
user, status, user_roles = _auth_user(session, NAV['CAT']['name'], role_requirements=role_req,
permissions_entity=perm_entity)
status = _entity_page_permissions_filter(id, user_roles, session, admin_role)

if status == 401:
return redirect(url_for('admin.login'))
elif status == 403:
return render_template('403.html', user=user, NAV=NAV)

git_url = request.form.get('gitUrl')
git_branch = request.form.get('gitBranch')
app_name = request.form.get('app_name')
tests_to_run = 'NONE,'

headers = {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
'token': app.config['JENKINS_TOKEN'],
'GIT_URL': git_url,
'TESTS': tests_to_run.upper(),
'GIT_BRANCH': git_branch,
'APP_NAME': app_name,
'PROFILE_APPLICATION': 'Y'
}
url = f"{app.config['JENKINS_HOST']}/job/{app.config['JENKINS_PROJECT']}/buildWithParameters"
resp = requests.post(url, headers=headers, data=data, auth=HTTPBasicAuth(app.config['JENKINS_USER'], app.config['JENKINS_KEY']))

return redirect(request.referrer)


@vulns.route("/application_profile/<app_id>")
@login_required
def application_profile(app_id):
Expand All @@ -145,7 +184,7 @@ def application_profile(app_id):
filter(lambda t: t.ID != '', assets_all)
)
app = BusinessApplications.query.filter(text(f'ID={app_id}')).first()
app_data = {'ID': app_id, 'ApplicationName': app.ApplicationName, 'Component': app.ApplicationAcronym}
app_data = {'ID': app_id, 'ApplicationName': app.ApplicationName, 'Component': app.ApplicationAcronym, 'RepoURL': app.RepoURL}
NAV['appbar'] = 'settings'
return render_template('vulns/application_profile.html', entities=assets, user=user,
NAV=NAV, app_data=app_data)
Expand Down