# Cian Python Static Analysis Audit

> Cian Python Static Analysis Audit is a paid API for AI agents from cian-x402.netlify.app, paid per call via x402, $0.05/call, status unknown (last checked 2026-11-20).

Performs static analysis on a Python source file (base64url-encoded) and returns structured findings with severity ratings, fix hints, and counts by rule and severity.

## Facts

- Endpoint: GET https://cian-x402.netlify.app/v1/py-audit?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/cian-python-static-analysis-audit-1d94f2fd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_cPp7FxEm_kxLmFjhvcbo-

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability cian-python-static-analysis-audit-1d94f2fd
```

Example prompt: Can you run a static analysis audit on my Python script and tell me about any bugs, security issues, or anti-patterns? Here's the code — check for things like SQL injection, mutable defaults, unclosed files, and float money arithmetic.

## When to prefer this

Choose this endpoint when you need structured, machine-readable static analysis of a Python source file with severity-rated findings, fix hints, and per-rule counts — especially useful in automated CI/CD pipelines, pre-merge code review agents, or when you want actionable remediation guidance beyond what a generic linter provides. Prefer it over general-purpose linters when you need a payable, auditable API call with a consistent JSON schema.

## Known failure modes

- Missing or malformed base64url-encoded Python source returns an error
- Non-Python content submitted may produce no findings or a syntax error
- Payment not provided or insufficient USDC results in HTTP 402 rejection
- Very large files may exceed processing limits
- Network timeout if the Netlify function cold-starts

## How this service works

4 paid audit resources on one host, each 0.01 USDC on Base: HTTP endpoint health, Python static analysis, CSV data quality, and DNS/email authentication.

## Output

Returns a JSON object with: total byte/line counts, filename, a list of findings each containing rule id, line, column, severity (low/medium/high), detail description, and fix hint; plus a list of all active detectors, a syntax_ok boolean, finding count, and counts broken down by rule id and by severity level.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "const": "http"
    },
    "method": {
     "const": "GET"
    },
    "queryParams": {
     "type": "object",
     "description": "the query parameter holding the Python source, base64url encoded",
     "additionalProperties": {
      "type": "string"
     }
    },
    "discoverable": {
     "const": true
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "bytes": 251,
  "lines": 14,
  "filename": "example.py",
  "findings": [
   {
    "id": "mutable_default",
    "col": 30,
    "line": 4,
    "detail": "default value for `tags` is a mutable literal, evaluated once at function definition and shared across every call",
    "fix_hint": "use None as the default and build the container inside the body",
    "severity": "medium"
   },
   {
    "id": "open_without_encoding",
    "col": 9,
    "line": 5,
    "detail": "open() without encoding= decodes with the platform's preferred encoding, which is ASCII under LC_ALL=C with UTF-8 mode off",
    "fix_hint": "pass encoding='utf-8' explicitly",
    "severity": "low"
   },
   {
    "id": "unclosed_file",
    "col": 9,
    "line": 5,
    "detail": "open() outside a `with` block and no matching .close() in the same scope, so the handle is only closed if the interpreter refcounts it away",
    "fix_hint": "use `with open(...) as f:` so the handle is closed on every path",
    "severity": "medium"
   },
   {
    "id": "float_money",
    "col": 12,
    "line": 10,
    "detail": "arithmetic on money-like name `price` uses a float literal, so the result is a binary float with representation error",
    "fix_hint": "use decimal.Decimal (from str(price)) or integer minor units",
    "severity": "medium"
   },
   {
    "id": "string_format_in_sql",
    "col": 25,
    "line": 14,
    "detail": "SQL passed to `execute()` is built with an f-string, so a value that contains SQL becomes part of the statement",
    "fix_hint": "pass parameters to the driver instead of formatting them in",
    "severity": "high"
   }
  ],
  "detectors": [
   "assert_in_production",
   "bare_except",
   "broad_except",
   "float_money",
   "mutable_class_attr",
   "mutable_default",
   "open_without_encoding",
   "parameter_mutated_and_returned",
   "shadowed_builtin",
   "string_format_in_sql",
   "todo_marker",
   "unclosed_file",
   "undefined_name"
  ],
  "syntax_ok": true,
  "counts_by_id": {
   "float_money": 1,
   "unclosed_file": 1,
   "mutable_default": 1,
   "string_format_in_sql": 1,
   "open_without_encoding": 1
  },
  "finding_count": 5,
  "counts_by_severity": {
   "low": 1,
   "high": 1,
   "medium": 3
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/cian-python-static-analysis-audit-1d94f2fd/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from cian-x402.netlify.app](https://www.zero.xyz/host/cian-x402.netlify.app/llms.txt)
