Skip to content

Add global privacy compliance controls#32

Closed
Destinea wants to merge 1 commit into
masterfrom
compliance/global-privacy-readiness
Closed

Add global privacy compliance controls#32
Destinea wants to merge 1 commit into
masterfrom
compliance/global-privacy-readiness

Conversation

@Destinea

Copy link
Copy Markdown
Contributor

Summary

  • add authenticated privacy export and deletion-request endpoints for API users
  • add retention metadata and privacy request storage
  • document global privacy obligations for API-operated data

Validation

  • python -m py_compile routers\v2\privacy.py routers\v2\auth.py utils\utils.py

Copilot AI review requested due to automatic review settings July 17, 2026 15:44
@Destinea

Copy link
Copy Markdown
Contributor Author

Closing because the compliance work needs to be rebased onto feat/golang+sql instead of master.

@Destinea Destinea closed this Jul 17, 2026

@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: ea128a6132

ℹ️ 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 routers/v2/privacy.py
Comment on lines +34 to +35
{"username": username, "type": request_type, "status": {"$in": ["received", "in_progress"]}},
{"$set": record, "$setOnInsert": {"created_at": now}},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve in-progress privacy requests on retries

When a user resubmits a deletion request after an operator has moved the existing record to in_progress, the filter matches that record but $set applies record, whose status is always received and whose received_at is the current time. This can downgrade an active case back to the received queue and reset the timestamp used for the compliance deadline; preserve the existing status/timestamp when matching an open request or only create a new received record on insert.

Useful? React with 👍 / 👎.

Copilot AI 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.

Pull request overview

Adds privacy compliance controls to the ClashKing API by introducing authenticated endpoints for data export and deletion-request intake, along with a retention-policy disclosure endpoint and supporting persistence for privacy requests.

Changes:

  • Add privacy_requests Mongo collection wiring to DBClient.
  • Introduce new routers/v2/privacy.py router with authenticated export and deletion-request endpoints plus a public retention endpoint.
  • Add docs/privacy_compliance.md to document privacy controls and operational expectations.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
utils/utils.py Adds privacy_requests collection handle to the shared DB client.
routers/v2/privacy.py Implements privacy export, deletion-request recording, and retention disclosure endpoints.
docs/privacy_compliance.md Documents the new privacy endpoints and operational/compliance guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread routers/v2/privacy.py
Comment on lines +33 to +37
await db_client.privacy_requests.update_one(
{"username": username, "type": request_type, "status": {"$in": ["received", "in_progress"]}},
{"$set": record, "$setOnInsert": {"created_at": now}},
upsert=True,
)
Comment thread routers/v2/privacy.py
Comment on lines +57 to +60
@router.delete("/auth/me")
@router.post("/privacy/delete-request")
async def request_current_user_deletion(current_user: User = Depends(get_current_user)) -> dict[str, Any]:
"""Register an erasure request for the authenticated API account.
@Destinea
Destinea deleted the compliance/global-privacy-readiness branch July 17, 2026 16:09
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.

2 participants