Skip to content

Student problem-set payload exposes reference_solution and full function_signature for every problem (incl. probeable oracle) #159

Open

Description

@CoffeePoweredComputers

Summary

GET /api/problem-sets/<slug>/ returns reference_solution and function_signature for every problem, with no gating on the handler's display config. For probeable_code / probeable_spec the reference solution is the hidden oracle: a student can read it in browser devtools and skip probing entirely. function_signature (with parameter types) is likewise sent even when show_function_signature=False.

Code path

  • purplex/problems_app/repositories/problem_set_membership_repository.py:148-153 — problem_data["function_signature"] = getattr(problem, "function_signature", None) and problem_data["reference_solution"] = getattr(problem, "reference_solution", None), unconditionally.
  • purplex/problems_app/services/student_service.py:157-158 — copied verbatim.
  • purplex/problems_app/views/student_views.py:78-82 — ProblemSetDetailView.get returns it as data["problems"].

Who is affected

Handlers that set show_reference_code: False in get_problem_config yet still receive the field: probeable_code (handlers/probeable_code/handler.py:207), probeable_spec (:275), debug_fix (:162), prompt (:213), mcq (:275). EiPL and Refute set it True and legitimately consume it (ProblemSet.vue:393,600), so a blanket removal would break them.

Suggested fix

Gate in the repository/service layer: only include reference_solution when the problem's handler display config has show_reference_code: True, and only include function_signature when show_function_signature is True (or strip types, matching what the handlers already do for the probe panel). Add an integration test per handler asserting presence/absence in the student payload. Audit ProblemSerializer/other student-facing serializers for the same fields.

Found while researching #135.

Activity

  1. CoffeePoweredComputers commented on Oct 15, 2026

    @CoffeePoweredComputers
    OwnerAuthor

    Partial fix on branch e2e/probeable-workflows (PR to follow, stacked on #178): StudentService.get_problem_set_problems now nulls function_signature when the instructor hid it and sends reference_solution only when the student UI actually renders it (EiPL's code-to-explain, or spec problems with segment analysis). Probeable oracles and debug-fix answers no longer ship in the problem-set payload; integration tests cover each case.

    Still open after that: ProblemDetailView (GET /api/problems/<slug>/, views/student_views.py) returns ProblemSerializer to any authenticated user, which includes both fields. That path needs the same treatment or a student-specific serializer.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-senior-reviewMust be reviewed/paired with a maintainer before mergesecuritySecurity-sensitive change

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions