apache / apache/answer

Security: Deleted content exposure + revision history IDOR via sequential IDs

Open
#1,506 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
15.7k
Forks
1.4k
Avg merge
3d 8h
Merged PRs (30d)
7

Description

## Summary

Two information disclosure issues allow access to deleted/pending content:

### 1. Deleted Answer Content via GET /answer/api/v1/answer/info (Low-Medium)

\`AnswerService.Get()\` calls \`answerRepo.GetByID()\` which fetches answers by raw ID with no \`status != deleted\` filter. Deleted answers are returned with full content to unauthenticated callers.

**Secure comparison:** \`SearchList\` correctly filters: \`session.Where("status != ?", entity.AnswerStatusDeleted)\`

### 2. Revision History IDOR via GET /answer/api/v1/activity/timeline/detail (Medium)

\`GetObjectTimelineDetail\` fetches revision content by sequential integer ID (\`autoincr BIGINT\`). No check for whether the associated question/answer is deleted or pending. Any authenticated user can enumerate \`revision_id=1,2,3...\` to read full content of deleted/pending questions and answers.

**Secure comparison:** \`GetRevisionList\` correctly checks \`objInfo.IsDeleted()\` before showing history. \`GetQuestion\` blocks access to deleted/pending content.

### Impact

- Bypasses content moderation (admin-deleted content remains accessible)
- Reveals pending-review content before publication
- Sequential revision IDs make enumeration trivial

## Discovery

Found through automated security research comparing content visibility controls across endpoints.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with AnswerService.Get and GetObjectTimelineDetail for the two affected endpoints, then compare their access checks with SearchList, GetRevisionList, and GetQuestion. Trace how deleted and pending questions, answers, and revisions are loaded. Done means unauthenticated deleted answers and authenticated deleted or pending revision content are no longer exposed, while permitted content remains accessible.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.