Skip to content

4.0.0-rc2

Pre-release
Pre-release

Choose a tag to compare

@lsmith77 lsmith77 released this 23 Nov 20:47
· 163 commits to dev since this release

The second release candidate of 4.0.0. It closes the gaps a security and correctness review of rc1 found: an LLM route open to anyone in production, CORS that let other sites use an operator's cached password, and guardrail requests without a size limit. It also moves to new major versions of redis-py, pandas, gunicorn and secure, pins the base images by digest, and ships editor 2.7.0 on the /textarea page. Pull requests #1286 to #1295; see the 4.0.0-rc1 notes for everything else in 4.0.0.

Before you upgrade

Operators

  • A DEFAULT_API_KEY that is not a valid key stops the start (#1295). It needs at least 20 letters, digits, - or _, as for POST /api_key. The change-me that .env.example used to ship is refused; mint a key with python3 -c 'import secrets; print(secrets.token_urlsafe(32))', or leave it empty.
  • The development helpers answer 404 in production (#1295). With ENVIRONMENT_TYPE=production, /debug/check, /debug/rule, /debug/spacy, /debug/displacy, /debug/german_noun, /lemmatize, /tokenize, /parse-word-types and /save_openapi_json are gone. They stay available elsewhere.
  • Guardrail requests have limits (#1295), answered with 422. Each is a setting:
    • GUARDRAIL_MESSAGES_MAX_COUNT, 1000 messages by default;
    • GUARDRAIL_TEXTS_MAX_COUNT, 20 texts to check in one answer;
    • GUARDRAIL_CHECK_MAX_LENGTH, 40,000 characters checked;
    • GUARDRAIL_REQUEST_MAX_LENGTH, 1,000,000 characters of text in all.
  • LanguageTool is pinned in languagetool/Dockerfile (#1291). LT_VERSION is no longer read: remove it from .env and build with docker compose --profile languagetool build.

Clients

  • /debug/rephrase is removed, and with it choosing the model per request (#1295). Use /v1.0/rephrase, which uses the deployment's model.
  • CORS no longer allows credentials (#1295). A browser no longer sends cookies or a cached password with a cross-origin request. Clients that send x-key or Authorization themselves, as Witty's do, are unaffected.

Security

  • /debug/rephrase was open to anyone in production (#1295). Its only guard was the docs password, off by default, and a caller could name any model, so the deployment's LLM key could be sent to a provider of the caller's choice.
  • Other sites could call the API with an operator's cached password (#1295). CORS echoed any origin with credentials allowed, so a page an operator visited could use the management password their browser had cached.
  • One guardrail request could keep the server busy (#1295), with any number of texts to check. The limits above bound it.
  • CI: the test workflow no longer leaves its GitHub token in the checkout, where the packages it installs could read it (#1295). Dependabot proposes updates to the GitHub Actions and to the base images, which are pinned by digest (#1291).

Changed

  • Dependencies: redis-py 8 (#1290), pandas 3 (#1289), gunicorn 27 (#1287), secure 2 (#1288) and sentry-sdk 2.75 with other minor updates (#1286). The Redis client stays on the RESP2 protocol, as before, because redis-py 8 starts connections in a way Redis before 6 and some proxies refuse (#1295).
  • The /textarea page uses editor 2.7.0 (#1294), whose toolbar buttons show what they are named.
  • bin/api_key.py rehash no longer reports keys stored as digests as possible plaintext keys (#1295).
  • CI: SonarCloud skips Dependabot's runs, which get no secrets (#1293); the GitHub Actions are updated (#1292).

Image: ghcr.io/witty-works/nlp_api:4.0.0-rc2, digest sha256:66304cd9497074c37a43a5b042e0b4096e81b9fceb901c2b63a2fda17970c9ec.