open-notebook/open_notebook
Luis Novo e5381b0c49
feat(api): limit CORS to localhost and the same host when no password is set (#1556)
* feat(api): allow only localhost CORS origins when no password is set

Without OPEN_NOTEBOOK_PASSWORD the API has no authentication, and the
default CORS wildcard let any web page the user visits call it through
their browser and read the answers. While CORS_ORIGINS is unset and no
password is set, the default now admits only localhost, 127.0.0.1 and
[::1] origins. With a password the default stays '*', and an explicit
CORS_ORIGINS always wins. The shipped UI goes through its own origin and
is unaffected. Recorded in ADR-014.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(api): allow same-host CORS origins when no password is set

The localhost-only default broke the default UI opened from another
machine: with API_URL unset, /config points the browser at
<host>:5055 from the page on port 8502, which is cross-origin. Without
a password, the default now also admits origins whose host name equals
the request's Host, so LAN and VPS installs keep working while other
sites still can't read the API's answers.

Also treats a blank CORS_ORIGINS as unset, adds positive preflight and
same-host tests, names OPEN_NOTEBOOK_PASSWORD_FILE in the docs, and
states that CORS is not authentication.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFiTN3BrhD1rr799jJfi5S

* docs(cors): state same-host and DNS-rebinding limits of the no-password default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFiTN3BrhD1rr799jJfi5S

* docs(cors): say an explicit CORS_ORIGINS replaces the default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFiTN3BrhD1rr799jJfi5S

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 21:07:58 -03:00
..
ai docs: refresh stale provider-registry, cubic.yaml and Ollama example rules (#1474) (#1544) 2026-11-07 15:22:26 -03:00
database fix(search): order and limit after grouping in vector and text search (#1503) 2026-11-07 20:33:09 -03:00
domain fix(worker): a source deleted before processing must fail permanently, not starve the queue (#1364) 2026-10-04 05:59:34 -03:00
graphs Merge commit from fork 2026-11-03 21:23:42 -03:00
podcasts style: ruff format the Python codebase and gate it in CI (#1429) 2026-10-03 07:12:25 -03:00
utils fix: error hints, Italian in the language menu and dev fallbacks (docs review) (#1457) 2026-10-04 22:51:31 -03:00
__init__.py refactor: move environment variables loading to application entry point (#283) 2025-12-01 14:59:50 -03:00
AGENTS.md feat(api): limit CORS to localhost and the same host when no password is set (#1556) 2026-11-07 21:07:58 -03:00
CLAUDE.md docs: restructure documentation around AGENTS.md, VISION.md and decision records (#1032) 2026-07-10 15:33:19 -03:00
config.py docs: drop settings that do nothing; fix Docker env guidance (#1456) 2026-10-04 22:35:44 -03:00
exceptions.py fix(transformations): reject truncated and empty model output (#1385) 2026-09-30 23:05:16 -03:00