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