Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Content: author endpoints + server-side HTML sanitization (Phase 4.2)

Aperta
#3 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
csharp, html, postgresql

Direzione di ricerca

Per prima cosa, esamina i pattern esistenti di endpoint e workflow del modulo Content, quindi l’entità Post e il workflow della dependency #2. Usa il test harness Members in tests/CommunityPro.Tests/Members/MembersTestHarness.cs come riferimento di test indicato e aggiungi la copertura xUnit per ogni endpoint, inclusi i payload TipTap ostili. Il lavoro è completo quando sono soddisfatti i criteri elencati di autorizzazione, stato, validazione, sanitizzazione, codici di errore e paginazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

content

Scope

Author-facing endpoints on the Content module. Any active member can write; authors can only touch their own posts.

Method Path Auth Notes
GET /posts/mine active member paginated, all statuses, author only
POST /posts/mine active member create draft
PUT /posts/{id} active member edit own Draft/Rejected post (autosave target — must be cheap)
POST /posts/{id}/submit active member Draft → Submitted

Sanitization

On submit, produce ContentHtml from the TipTap payload server-side using HtmlSanitizer. Store both: ContentJson for re-editing, sanitized ContentHtml as the only thing public pages ever render. Never trust or render raw author HTML.

Validation

Title/excerpt length caps, tag whitelist + max count, cover image URL must be an allowed image host (see MemberProfileService.IsAllowedAvatarHttpsUrl for the pattern and host list).

Error codes

content.not_found, content.not_author, content.invalid_state, content.invalid_post

Dependencies

Blocked by #2 (Post entity + workflow).

Acceptance criteria

  • Non-author gets content.not_author (404-shaped, no existence leak, matching project convention)
  • Editing a Submitted/Published post fails with content.invalid_state
  • Submit sanitizes: script tags, event handlers, javascript: URLs stripped (tests with hostile payloads)
  • Pending (non-active) members are rejected by the policy
  • xUnit coverage per endpoint
Conventions (project-wide, non-negotiable)
  • .NET 9, records for immutable shapes, file-scoped namespaces, primary constructors where they read well. Minimal-API endpoints grouped per module via IEndpointModule.MapEndpoints.
  • Result<T> (SharedKernel) instead of exception-driven control flow. Endpoint results map failures to ProblemDetails with the stable error codes listed above — the frontend keys off them.
  • Module owns its EF Core DbContext mapped to its own Postgres schema. Modules never reference each other's internals — cross-module needs go through a public contract interface or an in-process domain event (IEventPublisher).
  • All external calls (GitHub, Stripe, Brevo, Cloudinary, Meilisearch) behind interfaces owned by the consuming module.
  • Every list endpoint paginated (offset is fine). xUnit tests in tests/CommunityPro.Tests/<Module>/ following the existing harness patterns (see Members/MembersTestHarness.cs).
Lingua principale
C#
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommunityPro/community-pro-api

Tutte le issue di CommunityPro/community-pro-api

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.