mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 04:10:49 +08:00
fix: restrict sensitive configuration parameters in CLI arguments
This commit is contained in:
@ -46,7 +46,6 @@ commands = list(command2class.keys())
|
|||||||
class PRAgent:
|
class PRAgent:
|
||||||
def __init__(self, ai_handler: partial[BaseAiHandler,] = LiteLLMAIHandler):
|
def __init__(self, ai_handler: partial[BaseAiHandler,] = LiteLLMAIHandler):
|
||||||
self.ai_handler = ai_handler # will be initialized in run_action
|
self.ai_handler = ai_handler # will be initialized in run_action
|
||||||
self.forbidden_cli_args = ['enable_auto_approval']
|
|
||||||
|
|
||||||
async def handle_request(self, pr_url, request, notify=None) -> bool:
|
async def handle_request(self, pr_url, request, notify=None) -> bool:
|
||||||
# First, apply repo specific settings if exists
|
# First, apply repo specific settings if exists
|
||||||
@ -61,8 +60,11 @@ class PRAgent:
|
|||||||
else:
|
else:
|
||||||
action, *args = request
|
action, *args = request
|
||||||
|
|
||||||
|
forbidden_cli_args = ['enable_auto_approval', 'base_url', 'url', 'app_name', 'secret_provider',
|
||||||
|
'git_provider', 'skip_keys', 'key', 'ANALYTICS_FOLDER', 'uri', 'app_id', 'webhook_secret',
|
||||||
|
'bearer_token', 'PERSONAL_ACCESS_TOKEN', 'override_deployment_type', 'private_key']
|
||||||
if args:
|
if args:
|
||||||
for forbidden_arg in self.forbidden_cli_args:
|
for forbidden_arg in forbidden_cli_args:
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if forbidden_arg in arg:
|
if forbidden_arg in arg:
|
||||||
get_logger().error(
|
get_logger().error(
|
||||||
|
Reference in New Issue
Block a user