Skip to content

Exclude retraction presentations from Discovery Service search#4193

Open
reinkrul wants to merge 1 commit intomasterfrom
fix/discovery-search-excludes-retractions
Open

Exclude retraction presentations from Discovery Service search#4193
reinkrul wants to merge 1 commit intomasterfrom
fix/discovery-search-excludes-retractions

Conversation

@reinkrul
Copy link
Copy Markdown
Member

Summary

  • Retraction VPs (type RetractedVerifiablePresentation) were leaking through GET /internal/discovery/v1/{serviceID} when the query was empty, because sqlStore.search only joins discovery_credential for non-empty queries.
  • Added a post-query IsType(retractionPresentationType) skip in the result-assembly loop. SQL-level filtering would require a schema migration (no retraction column exists on presentationRecord).
  • Server-side Get() timeline still returns retraction markers (required for replication).

Fixes #4192

Test plan

  • New test TestModule_Search/retracted_presentations_are_not_returned fails before the fix and passes after.
  • go test ./discovery/... passes.
  • Verify the other search() caller (subject-scoped query in store.go:585) is unaffected — retraction VPs have no credentials so they never matched its credentialSubject.id filter.

🤖 Generated with Claude Code

Retraction markers are stored on the timeline so Get() can replicate
them, but must not surface from Search(). With an empty query, no
credential join was applied, so retraction VPs (which have no
credentials) were returned to API callers.

Fixes #4192

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 15, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
discovery/store.go100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

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.

Discovery Service returns retraction presentations in search results

1 participant