Skip to content

feat: data deletion workflow, enterprise admin guide, role compatibility tests, org IP allowlist - #754

Merged
Ayinkx merged 4 commits into
AyinkxLab:mainfrom
Kameelsulyman:feat/phase11-gov-ipallow
Nov 22, 2026
Merged

Ayinkx merged 4 commits into
AyinkxLab:mainfrom
Kameelsulyman:feat/phase11-gov-ipallow

Conversation

@Kameelsulyman

Copy link
Copy Markdown
Contributor

Summary

Phase 11 governance and security work: a user data deletion/anonymization workflow, an enterprise admin guide, role backward-compatibility tests, and a per-organization IP allowlist.

Closes #615
Closes #640
Closes #637
Closes #620

#615 — user data deletion and anonymization

  • user_deletion_requests model with requested -> confirmed -> completed plus cancelled, and two modes: deletion and anonymization.
  • app/services/data_deletion.py mirrors the existing export workflow: per-user rate limit (3 per 24 h), owner-only lookups, explicit confirmation phrase delete my data checked before any state change, audit entry on request/confirm/cancel/complete.
  • deletion removes personal content (conversations and messages, prompts and versions, provider API keys, GitHub connections, stale export rows) then anonymizes the profile. anonymization keeps content and only clears the profile.
  • Neither mode deletes the User row or any audit_logs row: the account row is retained because audit entries reference it and deleting it would cascade-delete owned workspaces. Profile fields are cleared, the account is disabled, and memberships are soft-removed.
  • Routes under /auth/api/data-deletion with structured catalog errors. docs/user-data-deletion.md documents the field-by-field contract of what is cleared versus retained.

#640 — enterprise admin guide

  • docs/enterprise-admin-guide.md: organization model, setup, members/invitations, role matrix, SSO, audit, retention, user-data requests, operational checklist.
  • SCIM is stated plainly as not implemented rather than invented.
  • Linked from README, the admin nav in base.html, and the organization dashboard.
  • tests/test_enterprise_admin_guide.py verifies every documented route against app.url_map, every documented CLI command/option against the Click tree, and the doc/README/template links.

#637 — role backward compatibility

  • tests/test_role_backward_compatibility.py covers owner, contributor, viewer and outsider on member list/add, settings, audit, pricing, activity, heartbeat, the members page, the audit page and workspace detail, including fail-closed behavior for removed members.
  • API denials assert catalog codes; HTML denials assert status. No production regression found, so production code is unchanged.

#620 — per-organization IP allowlist

  • workspace_ip_allowlists model (one row per workspace, canonical CIDR list, capped at 100).
  • app/services/ip_allowlist.py validates and canonicalizes with stdlib ipaddress, masks host bits, dedupes, and rejects malformed input.
  • Request guard resolves workspace_id directly or through project_id, and fails closed: enabled with no usable entries, unparseable client address, or no matching range all deny. Exemptions are /static/, /health, /healthz, /metrics, /favicon.ico.
  • Owner-only GET/PUT /workspaces/api/workspaces/<id>/ip-allowlist; changes are audited as ip_allowlist_updated.
  • docs/ip-allowlist.md covers configuration, exemptions, the lockout warning, remote_addr/proxy behavior, and limitations.

Verification

python -m ruff check .                 -> All checks passed
python -m black --check .              -> 566 files unchanged
pytest <new + related tests>           -> 184 passed
flask --app wsgi db heads              -> f2a1b0c9d8e7 (head)

Limitations

  • The full test suite was not run; it is slow and has pre-existing failures on main (tests/test_openapi_generation.py, tests/test_admin_usage_report.py::...test_admin_navigation_link_is_visible_only_to_admins).
  • The IP allowlist is API-only for now — no settings UI form.
  • The guard trusts only request.remote_addr; forwarded headers are deliberately not trusted, and proxy configuration is documented.
  • /workspaces/ is not workspace-scoped, so workspace names stay visible to signed-in users.
  • Deletion does not transfer workspace ownership; the guide documents this.

…ab#615)

Add explicit request/confirm/cancel/complete state machine, owner-only API, rate limiting, structured errors, audit on every transition, and a documented deleted/anonymized/retained contract. Audit rows and the account row are retained; profile fields are anonymized and content is removed in deletion mode.
…tus (AyinkxLab#640)

Document organization setup, members, roles, SSO, audit, retention, and user data requests using the routes that exist. Mark SCIM as not implemented. Link the guide from README and the admin UI, and validate documented routes and CLI commands against the URL map and Click tree.
… routes (AyinkxLab#637)

Prove representative API and HTML routes keep their pre-capability-migration behavior, including catalog-coded denials and fail-closed behavior for removed members and outsiders.
Validate and canonicalize CIDR input with the standard library, store one configuration per workspace, and enforce it in a fail-closed request guard for workspace- and project-scoped routes. Owner-only configuration is audited. Health, static assets, metrics, and favicon are documented exemptions.
@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown

@Kameelsulyman 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

@Kameelsulyman 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 578aeee into AyinkxLab:main Nov 22, 2026
12 of 19 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

2 participants