QWED

Type to search pages, engines and advisories.

    Looking for API details?Search the docs

    Security·Advisories·GHSA-4rj3-8wqj-cqwc

    SDK verify_code() uses a local AST blocklist instead of CodeVerifier, admitting code the server blocks

    highFixed in 8.0.0GHSA-4rj3-8wqj-cqwc · Published 26 October 2026

    Summary

    QWEDClient.verify_code() never sends code to the hardened server-side CodeVerifier when qwed_new is importable. Installing the qwed package makes it importable, and the GitHub Action image has it too. The SDK instead runs a local CodeGuard: an AST name blocklist of 8 function names and 7 modules. Code that the server classifies as unsafe (admission BLOCKED) comes back from the SDK as status="VERIFIED", is_verified=True, with the message "Code structure verified safe".

    The server-side bypasses fixed in GHSA-6rxr-gq43-694g and GHSA-4phf-6h72-9xfg are therefore still reachable through the SDK and the Action's engine: code mode.

    Affected components

    Component Location
    QWEDClient.verify_code qwed_sdk/client.py L155-182: try: CodeGuard().verify_safety(...), with the API used only on ImportError
    CodeGuard src/qwed_new/guards/code_guard.py
    GitHub Action verify with engine: code action_entrypoint.py → client.verify_code(...)

    Root cause

    CodeGuard.verify_safety flags only:

    • direct Name calls or .attr calls whose name is in {eval, exec, compile, open, system, popen, __import__, spawn}, and
    • import / from of {os, subprocess, sys, shutil, socket, pickle, pty}.

    Everything else is reported as verified safe. That includes dynamic attribute lookup, builtins access through getattr, dunder/subclass traversal, importlib, string-built names and aliasing. The SDK treats this heuristic result as an authoritative VERIFIED.

    Proof of concept (local, synthetic, inert payloads)

    from qwed_new.guards.code_guard import CodeGuard
    from qwed_new.core.code_verifier import CodeVerifier
    from qwed_new.core.diagnostics import admission_decision
    
    for code in ["getattr(__builtins__, 'ev'+'al')('1')",
                 "().__class__.__base__.__subclasses__()"]:
        print(CodeGuard().verify_safety(code)["verified"],                     # True
              admission_decision(CodeVerifier().verify_code(code)).value)      # BLOCKED
    

    Through the client, QWEDClient(api_key=..).verify_code(code) returns VerificationResult(status='VERIFIED', is_verified=True, ...) without making any network call.

    Impact

    Integrity of code admission. An application, agent framework or CI job that uses QWEDClient.verify_code (or the Action's code engine) to decide whether LLM-generated code may run will accept code the QWED server rejects. That code can reach eval/exec and arbitrary modules. Attacker capability: control over the code being verified (model output). No credentials are needed.

    Affected versions

    • qwed on PyPI: 3.0.1 to 7.3.0. The local-first CodeGuard path was added in fd863c8, first published in 3.0.1 (3.0.0 was not published to PyPI). Confirmed at runtime on 7.3.0.
    • GitHub Action verify mode with engine: code: v7.1.0 to v7.3.0, where the Action gates on is_verified.

    Patches

    Fixed in 8.0.0 (88bda3d):

    • QWEDClient.verify_code (sync and async) always calls the server's /verify/code, and is_verified follows the server's admission (GHSA-jppc-7r58-7pjh). A server that cannot be reached gives UNVERIFIABLE, never VERIFIED.
    • CodeGuard also rejects reflective calls (getattr, setattr, globals, locals, vars), __builtins__, dunder attribute access, dotted imports, and importlib, builtins, ctypes and marshal. Its pass is marked advisory; it is never reported as a verification.

    Upgrade with pip install -U qwed (8.0.0 or later) and pin the Action to QWED-AI/qwed-verification@v8.0.0.

    Workarounds

    Call the server's /verify/code directly and gate on admission == "ADMIT", or use CodeVerifier().verify_code() with admission_decision() in process.

    Related

    GHSA-6rxr-gq43-694g, GHSA-4phf-6h72-9xfg (server CodeVerifier); GHSA-4v5r-g7f4-vvgc (the same pattern for SDK local math); GHSA-v8qq-v427-qrqc (QWEDLocal.verify_code). The SQL counterpart is GHSA-45jv-2j44-4c2q.

    All advisories