Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 60bf715

Browse files
authored
Merge pull request #19 from vinaybyrappa/main
MYSQL-7 : Password Values not redacted in the shell logs , MYSQL-18 Environment refresh and discovery operation shows passwords/sensitive data
2 parents 07bb1dc + c432302 commit 60bf715

File tree

14 files changed

+133
-100
lines changed

14 files changed

+133
-100
lines changed

.github/workflows/codeql.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '24 4 * * 2'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2
73+
with:
74+
category: "/language:${{matrix.language}}"

src/common/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#
2+
# Copyright (c) 2021, 2023 by Delphix. All rights reserved.
3+
#
4+
15
import logging
26
import random
37
import time

src/dboperations/dboperations.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#
2+
# Copyright (c) 2021, 2023 by Delphix. All rights reserved.
3+
#
4+
15
import logging
26
import random
37
import time
@@ -37,7 +41,6 @@ def stop_mysql(port,connection,baseDir,vdbConn,pwd):
3741
if(port_stat == Status.ACTIVE):
3842
logger.debug("DB is Running. Shutting down.")
3943
shutdown_cmd = "%s/bin/mysqladmin %s'%s' --protocol=TCP --port=%s shutdown" % (baseDir,vdbConn,pwd,port)
40-
logger.debug("Shutdown Command: {}".format(shutdown_cmd))
4144
result = libs.run_bash(connection, shutdown_cmd,environment_vars,check=True)
4245
output = result.stdout.strip()
4346
error = result.stderr.strip()
@@ -46,7 +49,7 @@ def stop_mysql(port,connection,baseDir,vdbConn,pwd):
4649
logger.debug("There was an error trying to shutdown the database : "+error)
4750
raise MySQLShutdownException(error)
4851
else:
49-
logger.debug("Output: "+output)
52+
logger.debug("DB shutdown completed")
5053
time.sleep(25)
5154
if(Status.ACTIVE == get_port_status(port,connection)):
5255
logger.debug("KILL")
@@ -97,7 +100,6 @@ def get_port_status(port,connection):
97100
except Exception as err:
98101
logger.debug("Port Check Failed for second cmd: "+err.message)
99102
logger.debug("Port Status Response >")
100-
logger.debug(output)
101103

102104
if output== "":
103105
logger.debug("MySQL DB is NOT RUNNING at Port:"+myport)
@@ -130,7 +132,6 @@ def start_mysql(installPath,baseDir,mountPath,port,serverId,connection):
130132
if(port_stat == Status.INACTIVE):
131133
logger.debug("DB is not running. Starting the MySQL DB")
132134
start_cmd=get_start_cmd(installPath,baseDir,mountPath,port,serverId)
133-
logger.debug("Startup Command: {}".format(start_cmd))
134135
result = libs.run_bash(connection, start_cmd,environment_vars,check=True)
135136
output = result.stdout.strip()
136137
error = result.stderr.strip()
@@ -139,7 +140,7 @@ def start_mysql(installPath,baseDir,mountPath,port,serverId,connection):
139140
logger.debug("There was an error trying to start the DB : "+error)
140141
raise MySQLStartupException(error)
141142
else:
142-
logger.debug("Output: "+output)
143+
logger.debug("DB Started")
143144
time.sleep(25)
144145
if(Status.ACTIVE == get_port_status(port,connection)):
145146
logger.debug("DB Started Successfully")
@@ -168,12 +169,11 @@ def start_slave(connection,installPath,port,connString,username,pwd,hostIp):
168169
raise Exception("One of the required params for MySQL Connection is empty")
169170
else:
170171
start_slave_cmd=CommandFactory.start_replication(connection,installPath,port,connString,username,pwd,hostIp)
171-
logger.debug("Connection String with {}".format(start_slave_cmd))
172172
try:
173173
logger.debug("Starting Slave")
174174
result = libs.run_bash(connection, start_slave_cmd,environment_vars,check=True)
175175
output = result.stdout.strip()
176-
logger.debug("Start Slave Output: {}".format(output))
176+
logger.debug("Start Slave Completed")
177177
except Exception as err:
178178
logger.debug("Starting Slave Failed: "+err.message)
179179
raise err
@@ -187,17 +187,16 @@ def stop_slave(connection,installPath,port,connString,username,pwd,hostIp):
187187
raise Exception("One of the required params for MySQL Connection is empty")
188188
else:
189189
stop_slave_cmd=CommandFactory.stop_replication(connection,installPath,port,connString,username,pwd,hostIp)
190-
logger.debug("Connection String with {}".format(stop_slave_cmd))
191190
try:
192191
logger.debug("Stopping Replication")
193192
result = libs.run_bash(connection, stop_slave_cmd,environment_vars,check=True)
194193
_output=result.stdout.strip()
195194
_bashErrMsg=result.stderr.strip()
196195
_bashErrCode=result.exit_code
197196
if _bashErrCode!=0:
198-
logger.debug("Stopping Slave was not succesful")
197+
logger.debug("Stopping Slave was not successful")
199198
raise Exception(_bashErrMsg)
200-
logger.debug("Start Slave Response: {}".format(_output))
199+
logger.debug("Stop Replication successful")
201200
except Exception as err:
202201
logger.debug("Stop Replication Failed Due To: "+err.message)
203202
logger.debug("Ignoring and continuing")
@@ -213,7 +212,6 @@ def get_connection_cmd(installPath,port,connString,username,pwd,hostIp):
213212
raise ValueError("One of the required params for MySQL Connection is empty")
214213
else:
215214
connection_cmd=CommandFactory.connect_to_mysql(installPath,port,connString,username,pwd,hostIp)
216-
logger.debug("connaction_cmd >"+connection_cmd)
217215
return connection_cmd
218216

219217
def get_start_cmd(installPath,baseDir,mountPath,port,serverId):

src/plugin_runner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#
2+
# Copyright (c) 2021, 2023 by Delphix. All rights reserved.
3+
#
4+
15
import pkgutil
26
import logging
37
import sys
@@ -105,9 +109,6 @@ def configure(virtual_source, snapshot, repository):
105109
def reconfigure(virtual_source, repository, source_config, snapshot):
106110
logger.debug("virtual.reconfigure > Start")
107111
start(virtual_source, repository, source_config)
108-
logger.debug(source_config)
109-
logger.debug("Snapshot")
110-
logger.debug(snapshot)
111112
#srcConfig = configure(virtual_source,snapshot,repository)
112113
logger.debug("virtual.reconfigure > End")
113114
virtual_status(virtual_source, repository, source_config)
@@ -140,7 +141,6 @@ def virtual_post_snapshot(virtual_source, repository, source_config):
140141
snapshot.snap_backup_path=""
141142
snapshot.snap_time=utils.get_current_time()
142143
logger.debug("SnapShot Definition Created")
143-
logger.debug(snapshot)
144144
return snapshot
145145

146146
@plugin.virtual.start()

0 commit comments

Comments
 (0)