##// END OF EJS Templates
fix(security): hide env details when debug is disabled....
super-admin -
r1181:d7983c1a default
parent child Browse files
Show More
@@ -39,6 +39,7 b' from dulwich.errors import ('
39 39 from dulwich.repo import Repo as DulwichRepo
40 40 from dulwich.server import update_server_info
41 41
42 import rhodecode
42 43 from vcsserver import exceptions, settings, subprocessio
43 44 from vcsserver.str_utils import safe_str, safe_int, safe_bytes, ascii_bytes
44 45 from vcsserver.base import RepoFactory, obfuscate_qs, ArchiveNode, store_archive_in_cache, BytesEnvelope, BinaryEnvelope
@@ -1367,6 +1368,7 b' class GitRemote(RemoteBase):'
1367 1368 @reraise_safe_exceptions
1368 1369 def run_git_command(self, wire, cmd, **opts):
1369 1370 path = wire.get('path', None)
1371 debug_mode = rhodecode.ConfigGet().get_bool('debug')
1370 1372
1371 1373 if path and os.path.isdir(path):
1372 1374 opts['cwd'] = path
@@ -1405,10 +1407,14 b' class GitRemote(RemoteBase):'
1405 1407 return b''.join(proc), b''.join(proc.stderr)
1406 1408 except OSError as err:
1407 1409 cmd = ' '.join(map(safe_str, cmd)) # human friendly CMD
1408 tb_err = ("Couldn't run git command (%s).\n"
1409 "Original error was:%s\n"
1410 "Call options:%s\n"
1411 % (cmd, err, _opts))
1410 call_opts = {}
1411 if debug_mode:
1412 call_opts = _opts
1413
1414 tb_err = ("Couldn't run git command ({}).\n"
1415 "Original error was:{}\n"
1416 "Call options:{}\n"
1417 .format(cmd, err, call_opts))
1412 1418 log.exception(tb_err)
1413 1419 if safe_call:
1414 1420 return '', err
@@ -36,6 +36,7 b' import svn.diff # noqa'
36 36 import svn.fs # noqa
37 37 import svn.repos # noqa
38 38
39 import rhodecode
39 40 from vcsserver import svn_diff, exceptions, subprocessio, settings
40 41 from vcsserver.base import (
41 42 RepoFactory,
@@ -552,6 +553,7 b' class SvnRemote(RemoteBase):'
552 553 @reraise_safe_exceptions
553 554 def run_svn_command(self, wire, cmd, **opts):
554 555 path = wire.get('path', None)
556 debug_mode = rhodecode.ConfigGet().get_bool('debug')
555 557
556 558 if path and os.path.isdir(path):
557 559 opts['cwd'] = path
@@ -573,10 +575,14 b' class SvnRemote(RemoteBase):'
573 575 return '', safe_str(err).strip()
574 576 else:
575 577 cmd = ' '.join(map(safe_str, cmd)) # human friendly CMD
576 tb_err = ("Couldn't run svn command (%s).\n"
577 "Original error was:%s\n"
578 "Call options:%s\n"
579 % (cmd, err, _opts))
578 call_opts = {}
579 if debug_mode:
580 call_opts = _opts
581
582 tb_err = ("Couldn't run svn command ({}).\n"
583 "Original error was:{}\n"
584 "Call options:{}\n"
585 .format(cmd, err, call_opts))
580 586 log.exception(tb_err)
581 587 raise exceptions.VcsException()(tb_err)
582 588
General Comments 0
You need to be logged in to leave comments. Login now