Skip to content

GET /documents/:id/risk has no ownership check and mutates data on a GET #1473

Closed

Description

@mftee

RiskAssessmentController.getRisk calls riskService.assessDocument(id) for any authenticated user and any document id. assessDocument also writes the new score and flags (documentsService.updateRisk), so a read-only looking GET changes stored data, and a stranger can overwrite another user's risk score by calling it repeatedly. :id is not validated as a UUID.

Where

  • backend/src/risk-assessment/risk-assessment.controller.ts (getRisk)
  • backend/src/risk-assessment/risk-assessment.service.ts (assessDocument)

Suggested fix
Check ownership, validate :id, and make the GET return the stored assessment; recompute only from the queue job or an explicit POST /documents/:id/risk/reassess.

Acceptance criteria

  • GET does not write to the database
  • Non-owners are denied
  • Reassessment is an explicit, authorised action

Activity

  1. Ajibola6921 commented on Oct 17, 2026

    @Ajibola6921

    @Ajibola6921 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello, I'd like to work on this issue please boss.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Ajibola6921 to this issue.

  2. walexjnr commented on Oct 17, 2026

    @walexjnr
    Contributor

    @walexjnr has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi i will like to work on this task? Kindly assign

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @walexjnr to this issue.

  3. drips-wave commented on Oct 17, 2026

    @drips-wave

    Congratulations, @walexjnr! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @walexjnr: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  4. added a commit that references this issue on Oct 17, 2026
    f999112
  5. grantfox-oss commented on Oct 17, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @walexjnr's PR #1545 was approved and merged by @mftee.

    🏆 @walexjnr: You earned 40 FoxPoints for this contribution! Your current tier: Builder (2,308 total points). Track your full progress on GrantFox.

    👏 Great work, @walexjnr! Keep contributing to CodeGirlsInc.

  6. drips-wave commented on Oct 17, 2026

    @drips-wave

    This issue has been completed by @walexjnr as part of the Stellar Wave Program's 10th Wave 🥳

    😎 @walexjnr: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendbugSomething isn't workingnestjs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions