def call_secrets(code_path: str, port: int = 50052) -> str:
"""
Secrets Agent 서버를 호출하여 하드코딩된 시크릿을 스캔하는 함수
Args:
code_path: 분석할 코드 파일 경로
port: Secrets Agent 서버 포트 (기본값: 50052)
Returns:
str: Secrets Agent의 분석 결과 요약
"""
# insecure 채널을 사용하여 localhost의 지정된 포트로 연결
with grpc.insecure_channel(f"localhost:{port}") as channel:
# SecretsService의 스텁 생성
stub = agents_pb2_grpc.SecretsServiceStub(channel)
# CodeRequest 생성 및 전송
req = agents_pb2.CodeRequest(code_path=code_path)
resp = stub.Scan(req)
return resp.summary