Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions web/pgadmin/tools/restore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""Implements Restore Utility"""

import json
import re
import secrets

from flask import render_template, request, current_app, Response
Expand All @@ -26,7 +25,7 @@
internal_server_error

from config import PG_DEFAULT_DRIVER
from pgadmin.utils.constants import MIMETYPE_APP_JS, SERVER_NOT_FOUND
from pgadmin.utils.constants import SERVER_NOT_FOUND, RESTRICT_COMMAND
from pgadmin.tools.user_management.PgAdminPermissions import AllPermissionTypes

# set template path for sql scripts
Expand Down Expand Up @@ -75,7 +74,13 @@ def cmd_arg(x):
return ''

for arg in _args:
if arg and len(arg) >= 2 and arg.startswith('--'):
if arg and RESTRICT_COMMAND in arg:
# Find the index where \restrict ends
idx = arg.find(RESTRICT_COMMAND) + len(RESTRICT_COMMAND)
# Keep the prefix and mask everything after it
masked_arg = arg[:idx + 1] + "x" * (len(arg) - idx - 1)
self.cmd += cmd_arg(masked_arg)
elif arg and len(arg) >= 2 and arg.startswith('--'):
self.cmd += ' ' + arg
else:
self.cmd += cmd_arg(arg)
Expand Down
1 change: 1 addition & 0 deletions web/pgadmin/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ class MessageType:

RESTRICTION_TYPE_DATABASES = 'databases'
RESTRICTION_TYPE_SQL = 'sql'
RESTRICT_COMMAND = '\\restrict'
Loading