Skip to content

Fix interactive API explorer authentication - #296

Merged
quarj0 merged 1 commit into
mainfrom
fix/281-pr220-api-explorer
Aug 13, 2026
Merged

Fix interactive API explorer authentication#296
quarj0 merged 1 commit into
mainfrom
fix/281-pr220-api-explorer

Conversation

@quarj0

@quarj0 quarj0 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Refs #281

Summary

  • allow X-Client-Id and Idempotency-Key in browser CORS preflights while preserving environment extensions
  • use the validated legacy NEXT_PUBLIC_API_URL fallback in the developer portal CSP
  • model X-Client-Id as a companion OpenAPI API-key security scheme so Swagger Authorize configures both client credentials once
  • disable Swagger authorization persistence so API secrets do not survive reloads or browser sessions

Historical review threads addressed

Verification

  • DJANGO_SETTINGS_MODULE=config.settings.testing PYTHONPATH=backend/django backend/.venv/bin/python backend/django/manage.py test apps common config --verbosity 1 — 392 passed
  • focused CORS/OpenAPI contract suite — 6 passed
  • developer portal Node unit test, tsc --noEmit, ESLint, and Prettier checks — passed
  • targeted Ruff and git diff --check — passed
  • OpenAPI YAML parse — 35 paths, combined apiClient + apiClientId security confirmed
  • live Chrome/Playwright smoke — both authorization schemes rendered; credentials absent from localStorage and empty after reload
  • live response smoke — CSP connect-src contained the configured API origin and /api/openapi served the combined schemes

Validation boundaries

  • local Next production build is blocked by this host losing stdout from detached Node children, leaving Next unable to parse otherwise-valid tsc --showConfig; direct TypeScript, lint, development compilation, and browser smoke passed, and CI will run the production build
  • generated SDK model drift already fails identically on untouched origin/main with formatting-only output; this change modifies security metadata but no schemas, so generated model files are intentionally unchanged

Security notes

  • the client secret and client ID are never written to persistent browser storage
  • anonymous and workspace-authenticated OpenAPI exceptions remain explicit and unchanged
  • required API-client headers remain case-insensitively accepted without replacing operator-configured CORS extensions

@quarj0
quarj0 marked this pull request as ready for review August 13, 2026 13:13
@quarj0

quarj0 commented Aug 13, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@quarj0
quarj0 merged commit c1fc9b3 into main Aug 13, 2026
38 checks passed
@quarj0
quarj0 deleted the fix/281-pr220-api-explorer branch August 13, 2026 13:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9795b6e93

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/developer-portal/src/lib/api-origin.ts
quarj0 added a commit that referenced this pull request Aug 13, 2026
Refs #281

## Summary
- preserve Next.js build-time inlining by reading both public API
variables directly in `proxy.ts`
- keep normalization and production validation centralized in
`configuredApiOrigin`
- remove the helper's `process.env` default so future callers cannot
accidentally hide public variables from the compiler

## Review evidence
Fixes the delayed post-merge finding from PR #296:
#296 (comment)

## Verification
- `node --test src/lib/api-origin.test.js`
- developer-portal `tsc --noEmit`
- targeted developer-portal ESLint
- Prettier check
- `git diff --check`

## Merge gate
This PR remains draft until CI is green and every review thread is
implemented or answered with evidence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant