Skip to content

feat: domain verification and SSO enforcement, public API docs, public API v1 - #749

Merged
Ayinkx merged 3 commits into
AyinkxLab:mainfrom
Engr-Able:feat/phase11-sso-api-docs
Nov 22, 2026
Merged

Ayinkx merged 3 commits into
AyinkxLab:mainfrom
Engr-Able:feat/phase11-sso-api-docs

Conversation

@Engr-Able

Copy link
Copy Markdown
Contributor

Phase 11/12: domain verification and SSO enforcement, public API docs, public API v1

Closes #590
Closes #655
Closes #646

Summary

Three commits, one per issue.

#590 Domain verification and SSO enforcement

  • app/models/workspace_domain.py: new workspace_domains table (unique domain, verification token, expiring challenge, verified timestamp, enforce_sso).
  • app/services/domain_verification.py: domain normalization, 24-hour challenge TTL, DNS TXT lookup with a 5-second lifetime, conflict/expiry/failure handling, manage_settings permission checks, and the enforcement lookup used by login.
  • app/auth/routes.py: JSON endpoints for challenge, verify, list, and enforcement; password login is blocked for accounts on a verified, enforcing domain with a clear message, and the blocked attempt is audited (sso_enforced).
  • Migration 590a1b2c3d4e plus a merge revision c9d1e2f3a4b5 for the two heads that existed on main. flask db heads now reports exactly one head.
  • Tests cover verification success/failure, expiry, duplicate claim, permission failures, structured 400/401/403, enforcement requiring verification, the password block, and that logins from other domains still work.

#655 Public API documentation site

  • scripts/render_api_docs.py: dependency-free generator that builds an OpenAPI 3.1 document from the Flask URL map and renders a single self-contained HTML reference.
  • docs/openapi.json and docs/api/index.html are generated artifacts; the page covers authentication, pagination, errors, webhook verification, endpoints, and an explicit coverage/stability note.
  • Served at /api/docs, linked from the README and the app footer.
  • Tests assert required sections, route coverage, and the README/footer links.

#646 Public API v1 resources

  • app/api/v1.py: GET /api/v1/projects, /projects/<id>, /reviews, /reviews/<id>, /usage.
  • Authorization matches the web UI: projects and reviews are owner-scoped and another user's row is a uniform 404, never a 403 existence oracle. Usage is always caller-scoped.
  • Reuses the existing pagination helpers and usage-ledger export; structured catalog errors, page/limit/cursor validation, and workspace/project/source/kind/status filters.
  • Usage is page-based; passing a cursor returns a structured 400 rather than silently ignoring it.
  • Tests cover auth, owner scoping, pagination and cursors, filters, foreign-resource 404s, and invalid input.

Verification

python -m ruff check .            -> All checks passed
python -m black --check .         -> 530 files would be left unchanged
python -m flask --app wsgi db heads -> 590a1b2c3d4e (head)
python -m pytest tests/test_domain_verification.py tests/test_api_v1.py \
  tests/test_api_docs.py tests/test_docs_links.py tests/test_auth.py \
  tests/test_api_error_catalog.py -o addopts="" -q
  -> 141 passed in 95.84s

The migration tests (head is latest, workspace_domains upgrade/downgrade) also pass.

Limitations

  • DNS verification uses dns.resolver, currently present transitively via email-validator but not pinned directly. If it disappears, verification fails closed with a clear error.
  • No SSO identity-provider flow is implemented; enforcement only blocks password login for verified domains.
  • DNS behaviour was tested through injected resolvers, not against a live domain.
  • The generated reference freezes schemas only for /api/v1; other discovered paths are listed with their existing web-UI contracts, and the page says so.
  • The full test suite was not run (it is slow and has two pre-existing budget/usage-ledger failures on main).

@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown

@Engr-Able is attempting to deploy a commit to the Ayinkx Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 22, 2026

Copy link
Copy Markdown

@Engr-Able Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Ayinkx
Ayinkx merged commit 49777b0 into AyinkxLab:main Nov 22, 2026
13 of 17 checks passed
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.

Phase 12: Add a public API documentation site Phase 12: Add public API v1 resource endpoints Phase 11: Add domain verification and SSO enforcement

2 participants