{"uid":"cap_cPp7FxEm_kxLmFjhvcbo-","slug":"cian-python-static-analysis-audit-1d94f2fd","name":"Cian Python Static Analysis Audit","description":"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.","url":"https://cian-x402.netlify.app/v1/py-audit?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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"}}}}},"responseSchema":{"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}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.05","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.05/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_xFnfr7kCT5mqB7Mmldfxk","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.05","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Pre-commit Python code review","prompt":"Before I merge this Python script into main, can you audit it for bugs, security risks, and anti-patterns like SQL injection or unclosed file handles? I'll paste the code and I want a breakdown by severity."},{"title":"Python security scan for payment logic","prompt":"I just wrote a Python function that handles pricing and database inserts — can you check it for float money arithmetic errors and SQL injection vulnerabilities? Give me specific line numbers and fix suggestions."},{"title":"CI pipeline code quality gate","prompt":"Run a static analysis audit on this Python module and tell me if there are any high-severity findings I should block the build on — things like string formatting in SQL or mutable defaults."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-20T00:34:39.310Z","isFirstParty":false,"canonicalSlug":"cian-python-static-analysis-audit-1d94f2fd"}