Back to skill

Security audit

CodeAlive Context Engine

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real CodeAlive search and Q&A helper, but it needs Review because its API key handling can expose the key or send it to an untrusted endpoint.

Install only if you trust CodeAlive with the indexed repositories and queries you plan to use. Prefer hidden interactive setup, avoid pasting API keys into chat or command lines, do not set CODEALIVE_BASE_URL unless it is a trusted HTTPS CodeAlive endpoint, and rotate any key that was already pasted into a transcript, shell history, or logs.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/lib/api_client.py:121
Finding

API Credential Can Be Transmitted to an Arbitrary Configurable Origin

Content
View full analysis
Dict[str, Any]: """ Make an HTTP request to the CodeAlive API. Args: method: HTTP method (GET, POST, etc.) endpoint: API endpoint path params: URL query parameters body: Request body for POST requests Returns: Parsed JSON response """ url = f"{self.base_url}{endpoint}" # Add query parameters if params: query_string = urllib.parse.urlencode(params, doseq=True) url = f"{url}?{query_string}" # Prepare request headers = { "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json" } data = None if body: data = json.dumps(body).encode("utf-8") request = urllib.request.Request(url, data=data, headers=headers, method=method) # Make request try: with urllib.request.urlopen(request, timeout=self.timeout) as response: ``` `setup.py:138-145` and `setup.py:179`: ```python def verify_key(api_key: str, base_url: str = DEFAULT_BASE_URL) -> tuple[bool, str]: """Test the API key by fetching data sources. Returns (success, message).""" url = f"{base_url}/api/datasources/alive" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", } req = urllib.request.Request(url, headers=headers, method="GET") try: with urllib.request.urlopen(req, timeout=15) as re ...[truncated 2603 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
setup.py:110
Finding

API Key Exposure Through Process Arguments and Plaintext Terminal Output

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill’s top-level description emphasizes code search and Q&A, but the content also instructs users to configure API keys, use OS credential stores, and perform authenticated remote operations. Omitting these operational and secret-handling behaviors from the primary description can mislead users and agents about the trust boundary, making it easier to expose credentials or send sensitive code context to a remote service without informed consent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill’s top-level description emphasizes code search and Q&A, but the content also instructs users to configure API keys, use OS credential stores, and perform authenticated remote operations. Omitting these operational and secret-handling behaviors from the primary description can mislead users and agents about the trust boundary, making it easier to expose credentials or send sensitive code context to a remote service without informed consent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill’s top-level description emphasizes code search and Q&A, but the content also instructs users to configure API keys, use OS credential stores, and perform authenticated remote operations. Omitting these operational and secret-handling behaviors from the primary description can mislead users and agents about the trust boundary, making it easier to expose credentials or send sensitive code context to a remote service without informed consent.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/api_client.py (reported line 19)May include surrounding context.

python
"""Client for interacting with the CodeAlive API."""

    @staticmethod
    def _get_key_from_keychain() -> Optional[str]:
        """Try to read the API key from OS credential store."""
        import platform
        system = platform.system()

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/api_client.py (reported line 104)May include surrounding context.

python
"""Client for interacting with the CodeAlive API."""

    @staticmethod
    def _get_key_from_keychain() -> Optional[str]:
        """Try to read the API key from OS credential store."""
        import platform
        system = platform.system()

Direct flow: os.getenv (credential/environment) → subprocess.run (code execution)

High
Category
Data Flow
Confidence
80% confidence
Finding

Data flows directly from a source (env vars, files, network) to a sink (network output, exec, file write) without intermediate validation.

Content

Scanner excerpt · scripts/lib/api_client.py (reported line 26)May include surrounding context.

python
try:
            if system == "Darwin":
                import subprocess
                result = subprocess.run(
                    ["security", "find-generic-password", "-a", os.getenv("USER", ""), "-s", "codealive-api-key", "-w"],
                    capture_output=True, text=True, timeout=5
                )

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/api_client.py (reported line 101)May include surrounding context.

python
api_key: CodeAlive API key. Resolution order:
                     1. Explicit api_key parameter
                     2. CODEALIVE_API_KEY environment variable
                     3. macOS Keychain (service: codealive-api-key)
            base_url: Base URL for the API. Defaults to https://app.codealive.ai
        """
        self.api_key = api_key or os.getenv("CODEALIVE_API_KEY") or self._get_key_from_keychain()

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · setup.py (reported line 239)May include surrounding context.

python
api_key: CodeAlive API key. Resolution order:
                     1. Explicit api_key parameter
                     2. CODEALIVE_API_KEY environment variable
                     3. macOS Keychain (service: codealive-api-key)
            base_url: Base URL for the API. Defaults to https://app.codealive.ai
        """
        self.api_key = api_key or os.getenv("CODEALIVE_API_KEY") or self._get_key_from_keychain()

Direct flow: os.getenv (credential/environment) → subprocess.run (code execution)

High
Category
Data Flow
Confidence
80% confidence
Finding

Data flows directly from a source (env vars, files, network) to a sink (network output, exec, file write) without intermediate validation.

Content

Scanner excerpt · setup.py (reported line 39)May include surrounding context.

python
system = platform.system()
    try:
        if system == "Darwin":
            r = subprocess.run(
                ["security", "find-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME, "-w"],
                capture_output=True, text=True, timeout=5,
            )

Direct flow: os.getenv (credential/environment) → subprocess.run (code execution)

High
Category
Data Flow
Confidence
80% confidence
Finding

Data flows directly from a source (env vars, files, network) to a sink (network output, exec, file write) without intermediate validation.

Content

Scanner excerpt · setup.py (reported line 106)May include surrounding context.

python
try:
        if system == "Darwin":
            # Delete existing entry first (ignore errors if it doesn't exist)
            subprocess.run(
                ["security", "delete-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME],
                capture_output=True, timeout=5,
            )

Direct flow: os.getenv (credential/environment) → subprocess.run (code execution)

High
Category
Data Flow
Confidence
80% confidence
Finding

Data flows directly from a source (env vars, files, network) to a sink (network output, exec, file write) without intermediate validation.

Content

Scanner excerpt · setup.py (reported line 110)May include surrounding context.

python
["security", "delete-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME],
                capture_output=True, timeout=5,
            )
            r = subprocess.run(
                ["security", "add-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME, "-w", api_key],
                capture_output=True, text=True, timeout=5,
            )

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents shell commands, environment-variable use, credential-store interaction, and remote API access, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates an avoidable trust gap: an agent may invoke shell/network-capable actions without clear least-privilege boundaries, increasing the chance of unintended secret handling or data exfiltration during normal use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill encourages semantic search, chat, fetch, and MCP-backed operations against indexed repositories, but it does not prominently warn that user queries and potentially codebase content may be transmitted to a remote CodeAlive service. In a code-analysis context, this is significant because source code, identifiers, architecture details, or proprietary snippets may be sensitive; users may disclose them under the assumption the skill is purely local.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This script forwards user-provided queries and selected data source identifiers to external API methods (client.search and client.chat) without any explicit notice, confirmation, or data-sensitivity guardrails. In a code exploration tool, those inputs may contain proprietary project names, internal architecture details, incident descriptions, or sensitive code context, creating a real risk of unintended external disclosure.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/lib/api_client.py (reported line 26)May include surrounding context.

python
try:
            if system == "Darwin":
                import subprocess
                result = subprocess.run(
                    ["security", "find-generic-password", "-a", os.getenv("USER", ""), "-s", "codealive-api-key", "-w"],
                    capture_output=True, text=True, timeout=5
                )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/lib/api_client.py (reported line 34)May include surrounding context.

python
return result.stdout.strip()
            elif system == "Linux":
                import subprocess
                result = subprocess.run(
                    ["secret-tool", "lookup", "service", "codealive-api-key"],
                    capture_output=True, text=True, timeout=5
                )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The client sends user queries, repository/workspace names, and artifact identifiers to a remote service, and other methods can retrieve and transmit full code artifacts. In a code-search skill, this is expected, but it is still a real privacy and data-exposure risk if users are not clearly informed that potentially sensitive codebase metadata or contents are leaving the local environment.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · setup.py (reported line 39)May include surrounding context.

python
system = platform.system()
    try:
        if system == "Darwin":
            r = subprocess.run(
                ["security", "find-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME, "-w"],
                capture_output=True, text=True, timeout=5,
            )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · setup.py (reported line 46)May include surrounding context.

python
if r.returncode == 0 and r.stdout.strip():
                return r.stdout.strip()
        elif system == "Linux":
            r = subprocess.run(
                ["secret-tool", "lookup", "service", SERVICE_NAME],
                capture_output=True, text=True, timeout=5,
            )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · setup.py (reported line 106)May include surrounding context.

python
try:
        if system == "Darwin":
            # Delete existing entry first (ignore errors if it doesn't exist)
            subprocess.run(
                ["security", "delete-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME],
                capture_output=True, timeout=5,
            )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · setup.py (reported line 110)May include surrounding context.

python
["security", "delete-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME],
                capture_output=True, timeout=5,
            )
            r = subprocess.run(
                ["security", "add-generic-password", "-a", os.getenv("USER", ""), "-s", SERVICE_NAME, "-w", api_key],
                capture_output=True, text=True, timeout=5,
            )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · setup.py (reported line 116)May include surrounding context.

python
)
            return r.returncode == 0
        elif system == "Linux":
            r = subprocess.run(
                ["secret-tool", "store", "--label=CodeAlive API Key", "service", SERVICE_NAME],
                input=api_key, capture_output=True, text=True, timeout=10,
            )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
83% confidence
Finding

On Windows, the API key is passed directly on the cmdkey command line as /pass:{api_key}. Command-line arguments can often be observed by other local processes, shell history tooling, EDR products, or diagnostic logs, which can expose the secret during setup.

Content

Scanner excerpt · setup.py (reported line 122)May include surrounding context.

python
)
            return r.returncode == 0
        elif system == "Windows":
            r = subprocess.run(
                ["cmdkey", f"/generic:{SERVICE_NAME}", "/user:codealive", f"/pass:{api_key}"],
                capture_output=True, text=True, timeout=10,
            )

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest describes semantic code search and codebase Q&A, but does not mention local credential discovery from environment variables, macOS Keychain, Linux secret-tool, or Windows Credential Manager. While authentication to the remote CodeAlive service is expected, implementing OS-specific secret-store access is an additional local capability not justified by the stated purpose alone.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring says API key resolution uses the explicit parameter, environment variable, and 'macOS Keychain', but the implementation calls _get_key_from_keychain(), which also reads Linux secret-tool and Windows Credential Manager. This is not merely missing detail elsewhere; the stated resolution order actively understates what local credential sources are accessed.

Content

No source excerpt is available for this finding.