Security review against the OWASP lists

Date: 2026-10-28 (version 0.4.307). Method: reading the code, a static scan (bandit, 45 000 lines), a dependency audit (pip-audit), probing the live instance (headers, CORS, anonymous access, API documentation), and tests written for every fix. Frameworks used:

  • OWASP Top 10:2021 (web application risks)
  • OWASP API Security Top 10:2023 (Netlens is mostly an API)
  • OWASP Top 10 for LLM Applications (Netlens has AI features: Ask, the digital engineer, the AI report, the assistant and MCP)
  • OWASP ASVS is the checklist behind it; sections are named where they matter.

Status words: in place (already good), fixed now (changed in 0.4.307 with a test), open (known, planned), n/a.

Summary

No injection, broken-authorisation or secret-leak vulnerability was found in the application code. Two real flaws were found and fixed: a webhook address could be altered by a device name (injection), and outbound addresses typed by an administrator had no guard against the cloud metadata service and file: (SSRF, an item on the security roadmap). Two gaps were closed: request bodies had no size limit, and the weakest passwords were accepted. What remains open is mostly supply-chain hygiene (pinned requirements, signed images) and built-in TLS, both already on the security roadmap.

OWASP Top 10:2021

# Risk Status Evidence and notes
A01 Broken access control in place Deny by default for everyone but administrators (a path allow-list for viewers, operators and customer views); a test per role. Scoped viewers are limited to their groups and sites. A restricted user (second factor required, not set up) reaches only the set-up pages. Assistant tokens have a hard “never” list (users, vault, shares, SSO, backups, terminal, remote, central, MCP, ingest). The terminal, remote desktop and every action on hosts with stored logins are limited to the local network by default. Step-up (Enterprise) guards the privileged routes, and a test walks every route and fails when a sensitive one is undecided.
A02 Cryptographic failures in place Secrets encrypted with AES-256-GCM (key from the environment, a secret file or next to the data, with a visible warning); passwords with scrypt; session, API and share tokens are 192 to 256 bits and stored as hashes; recovery codes as hashes; TOTP seeds encrypted. TLS is the reverse proxy’s job (HSTS is sent over https). Open: built-in TLS ; key rotation and an external key service . The SNMPv3 DES privacy protocol exists only for old devices (AES preferred): marked and explained.
A03 Injection fixed now (one) SQL: every statement uses placeholders; what is formatted into SQL comes from fixed lists or the code itself (bandit flags 99 such statements: the ones that could carry user input, the sort order of a question, the columns of an update, a direction, were each read and come from whitelists), and a test enforces the portable-SQL rules. Commands: no shell, argument lists, process names validated. Fixed: the remediation webhook put the device name, event and detail into the address unescaped, so a device that chose a name like x/../admin?y= could change which URL was called (and a quote in a name could break a JSON body); values are now percent-encoded in the address and escaped in a JSON body. XSS: data is always set as text (innerHTML is not used to render anything), and the content security policy is strict (script-src 'self').
A04 Insecure design in place / partly Read-only probes, an “information only” engineer, an optional plugin runner without secrets, the host-agent listener with mutual TLS and an allow-list, step-up, break-glass design. Threat models exist for the host agents and for privileged access (the design documents). Open: a written threat model of the whole application (STRIDE) is not done.
A05 Security misconfiguration fixed now (one) Strong headers (CSP, X-Frame-Options: DENY, nosniff, Referrer-Policy: no-referrer, COOP, Permissions-Policy, HSTS over https), no CORS, API documentation off by default, non-root read-only container, default-deny. Fixed: the Server: uvicorn header is no longer sent. Open: style-src 'unsafe-inline' remains (the interface sets some inline styles); XML from the network was parsed by the standard library: a shared safe parser now refuses a DOCTYPE or entities (UPnP descriptions, WinRM answers).
A06 Vulnerable and outdated components partly The dependency audit finds no vulnerability in the runtime packages (fastapi, uvicorn, asyncssh, cryptography, zeroconf, h11); it flags certifi, filelock and pip in the development environment (the image installs the newest at build time). Fixed now: CI runs pip-audit and a bandit high-severity scan on every push and blocks publishing on a finding; an SBOM of every installation and a build-time SBOM and provenance attestation exist (0.4.306). Open: pinned requirements with hashes, Trivy and CodeQL, image signing, base image by digest .
A07 Identification and authentication failures in place, strengthened Rate-limited sign-in per address and per user with alarms, scrypt, OIDC with PKCE and nonce, TOTP (free) with recovery codes, requiring it by policy, step-up, session limits and a session list, the access token can be switched off, break-glass accounts. Fixed now: the most used passwords and trivial patterns are refused (a few hundred entries), a password may not be the user name, and the minimum length can be raised by policy (Enterprise). Open: a full breached-password check, WebAuthn (planned).
A08 Software and data integrity failures partly Plugins are installed by SHA-256 from the index, scanned statically, can run in a separate runner without secrets, and carry a review level; plugin zips are checked (no links, no .., size and file count). No deserialisation of untrusted data (no pickle, no YAML load). Backups are validated before a restore. Open: a signed image and signed releases.
A09 Security logging and monitoring failures partly Audit log of every change and every refusal (credentials use, probes, host agents, step-up, resets), forwarded to a SIEM, with alarms on sign-in attacks. Open: the audit log is not tamper-evident (roadmap 6: hash chain with anchors).
A10 Server-side request forgery fixed now Outbound requests to an address somebody typed (notification webhooks, remediation webhooks, the language model, the identity provider, the secrets server, the central Netlens, a registry’s token address) now refuse a scheme other than http(s), credentials in the address, and a host that is or resolves to a link-local address (this includes the metadata service of AWS, Azure, GCP and OpenStack), an unspecified, multicast or reserved address, and the metadata names; every redirect is checked too, and the name is resolved again at the moment of use. Private addresses stay allowed (a webhook to Home Assistant is the normal use). Already in place: the UPnP fetch only talks to the host that announced it, service checks refuse link-local addresses and do not follow redirects.

OWASP API Security Top 10:2023

# Risk Status Notes
API1 Broken object-level authorisation in place Device, group and site scoping is checked per object for scoped viewers (device in scope, site in scope), with a test; credentials are private to their owner unless shared.
API2 Broken authentication in place See A07. API tokens are hashed, can be read-only, and (Enterprise) have a lifetime and an address list.
API3 Broken object property level authorisation in place Responses are built field by field; secrets are never returned (only “is set”); request bodies are typed models; a partial update changes only the named fields.
API4 Unrestricted resource consumption fixed now Request bodies are capped before the framework reads them (4 MiB default; 16 KiB for sign-in and share unlock; a plugin 3 MiB; a restore 1 GiB; remote-site reports 64 MiB), also for chunked bodies. The terminal and remote sessions are capped (5), AI questions have a fixed number of tool steps, the ingest listener has per-agent and global limits. Open: a general per-user request rate limit for the API (sign-in and the listeners have one).
API5 Broken function-level authorisation in place Roles are enforced centrally per route, not per handler; the route inventory test (step-up) and the role tests catch a new route.
API6 Unrestricted access to sensitive business flows in place Sensitive flows (restore, remote-session tickets, enrolment tokens, the master key) are admin-only, local-network-only by default, audited, and (Enterprise) step-up protected.
API7 Server-side request forgery fixed now See A10.
API8 Security misconfiguration fixed now See A05.
API9 Improper inventory management in place The API has no hidden or old versions; documentation is off by default; the route inventory is tested; plugins and the plugin index have their own version contract.
API10 Unsafe consumption of APIs in place / partly Responses of other systems are size-limited and validated (every plugin’s output goes through a contract with types, limits and allow-lists); XML from the network refuses DOCTYPE and entities; ID tokens are verified (signature, issuer, audience, nonce, expiry).

OWASP Top 10 for LLM applications

Netlens sends data about the user’s network to a language model only when the administrator switches that on, with names, addresses and (by default) host names replaced by placeholders before they leave.

# Risk Status Notes
LLM01 Prompt injection fixed now (hardened) Names, messages and log lines that devices on the network wrote can reach a prompt. By default they are replaced by placeholders before they go to the model (which also removes them as an injection channel). Added: all three system prompts (Ask, the digital engineer, the AI report) now say that such text is data and never an instruction. The real protection is what the model can do: see LLM06.
LLM02 Sensitive information disclosure in place Redaction of names and addresses on by default, host-probe names kept from the model unless allowed, secrets never in a prompt, private-findings handling.
LLM03 Supply chain partly The model is the administrator’s choice of provider; the model check (“six exams”) tests it. See A06 for the software supply chain.
LLM04 Data and model poisoning n/a Netlens does not train or fine-tune.
LLM05 Improper output handling in place The reply must be one JSON object that is parsed strictly; answers are shown as text (never as HTML); a recommended rule id must be in the administrator’s list, or it is dropped.
LLM06 Excessive agency in place Ask can only call fixed read-only tools with checked arguments. The digital engineer can only recommend a rule that the administrator wrote; an automatic approval needs high confidence, the rule’s own conditions and its guardrails. The assistant and MCP use a token with an explicit boundary: read-only by default, a hard never list, change mode needs an administrator and a licence, and (Enterprise) step-up and token governance. Nothing the model says is run as a command.
LLM07 System prompt leakage n/a The prompts are in the open-source tree and contain no secret.
LLM08 Vector and embedding weaknesses n/a No vector store.
LLM09 Misinformation in place The answers cite the tool results; the digital engineer reports its confidence; the model-check exams include “does not invent what the data cannot tell”.
LLM10 Unbounded consumption in place A fixed number of tool steps per question, a fixed timeout, and the model is the administrator’s own account.

What changed in 0.4.307 for this assessment

  • app/safenet.py: the outbound-address guard (SSRF), a redirect guard installed at start-up. app/safexml.py: a parser that refuses DOCTYPE and entities.
  • app/security.py: request-body limits; main.py: no Server header.
  • app/remediation.py: escaping of values put into a webhook address or JSON body.
  • app/passwords.py and the minimum-length policy.
  • Prompt hardening in the three system prompts.
  • CI: pip-audit and bandit (high severity) must pass before an image is published.
  • Tests: test_safenet.py, test_body_limit.py, test_passwords.py, and the existing suite (3 200+ tests).

Open items, in the order I would do them

  1. Pinned requirements with hashes, Trivy and CodeQL in CI, image signing, base image by digest .
  2. Tamper-evident audit log and built-in TLS .
  3. A per-user API request rate limit and a breached-password check.
  4. A whole-application threat model (STRIDE) and an external penetration test before a large enterprise roll-out; automated scanners (ZAP) are no substitute.
  5. style-src 'unsafe-inline': move the remaining inline styles to the stylesheet and drop it.