Skip to content

[Security] Reference picker endpoints (getReferenceTree/findCheckbox/findTabTree) skip the @EruptScope data-scope filter, cross-scope read (CWE-285/639) #516

Backlog

Description

@HieuPenguinnn

Hello erupt maintainer,

I found a security issue in erupts/erupt during a static source review. Details below.

Details

erupt generates a runtime admin UI and REST API for any JPA entity annotated with @Erupt. Release 2.4.0 added @EruptScope, a row-level data permission that filters every record query to the scope (workspace, knowledge base, tenant) the current user is allowed to pick. EruptScopeService.conditions(eruptModel) turns the caller's allowed scope into query conditions (erupt-core/src/main/java/xyz/erupt/core/scope/EruptScopeService.java:265), and a caller cannot select a scope they are not offered, so the filter is enforced server-side.

The guarded read endpoints add that filter. The list path adds it in EruptService.assembleQuery (erupt-core/src/main/java/xyz/erupt/core/service/EruptService.java:186). The single-tree endpoint adds it directly (EruptDataController.java:125). The reference-table picker inherits it by routing through EruptService.getEruptData, which runs assembleQuery against the referenced model (EruptDataController.java:332, EruptService.java:65-76).

Four sibling picker endpoints in EruptDataController do not add the scope condition. They build their query from the field's static @Filter values and an optional depend condition only, then call PreEruptDataService.geneTree or createColumnQuery on the referenced entity:

  • FINDING 1: getReferenceTree, GET /erupt-api/data/{erupt}/reference-tree/{fieldName} (EruptDataController.java:394-414).
  • FINDING 2: findCheckbox, GET /erupt-api/data/{erupt}/checkbox/{fieldName} for CHECKBOX and TRANSFER fields (EruptDataController.java:286-316).
  • FINDING 3: findTabTree, GET /erupt-api/data/tab/tree/{erupt}/{tabFieldName} (EruptDataController.java:265-274), where the per-record power check is present only as a commented-out line, which shows a check was expected and is absent.
  • FINDING 4: getDependTree, GET /erupt-api/data/depend-tree/{erupt} (EruptDataController.java:374-381), which delegates to the unsafe getReferenceTree for a reference field.

Class: CWE-285 Improper Authorization, CWE-639 Authorization Bypass Through User-Controlled Key, CWE-862 Missing Authorization. Proposed severity Medium.

Attacker model: an authenticated admin user who owns the menu for an erupt that references a scoped entity through a REFERENCE_TREE, REFERENCE_TABLE-adjacent CHECKBOX, TRANSFER or TAB_TREE field. The interceptor EruptSecurityInterceptor.preHandle authorizes the menu of the erupt named in the path (the form erupt the caller owns), not the referenced entity (erupt-security/src/main/java/xyz/erupt/security/interceptor/EruptSecurityInterceptor.java:124-166), and it applies no row scope. The row scope is the data service's job, and these four handlers skip it. This is not pre-authentication and not anonymous.

Impact: an admin confined to one @EruptScope value reads the id, label and parent-id (tree pickers) or id, label and remark (checkbox and transfer pickers) of every row of the referenced scoped entity across all scopes, including scopes the caller was never offered. The list view and the reference-table view of the same entity remain correctly scoped, so this is a cross-scope read of the projected picker columns, not a full-row read and not a write. The sink still honors static @Filter and DataProxy.beforeFetch, so a data permission wired that way is unaffected, and a deployment that does not use @EruptScope is unaffected.

Boundary crossed: between two different admin users who are offered different scope options under the same @EruptScope, which is exactly the separation the feature enforces everywhere except these four endpoints.

Suggested fix: add eruptScopeService.conditions(referencedModel) to each of the four picker handlers, matching the single-tree sibling at EruptDataController.java:125, then centralize the scope condition inside PreEruptDataService.geneTree and createColumnQuery so every caller inherits it. Add a regression test that configures a @EruptScope bound entity referenced by a second erupt and asserts the picker endpoints return only in-scope rows.

Verification (static only, no repository cloned, no code built or executed, no live deployment contacted): the full chain from the interceptor through the controller handlers to the PreEruptDataService sink was confirmed at the pinned commit, the guarded siblings were checked to confirm they add the scope condition, and @EruptScope was confirmed to be new in 2.4.0 via pull request #416. The runtime row count and column values were not observed and are inferred from the source path.

Detailed write-up: https://hackmd.io/@hieund/erupt-reference-picker-missing-eruptscope-datascope

Full report

https://hackmd.io/@hieund/erupt-reference-picker-missing-eruptscope-datascope

Reported by hieuPenguinnn

Activity

  1. github-actions commented on Dec 1, 2026

    @github-actions

    Thanks for opening your first issue in Erupt!

    A few things that speed up a reply:

    • Usage questions are best asked in Discussions; the docs and FAQ answer most "how do I" questions.
    • For bugs, a minimal entity with its annotations plus the Erupt / Spring Boot / database versions is usually all we need.
    • You can try the latest version on the live demo to confirm the behaviour.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions