workspacesField() defaults to a field no resource index maps

Open Beginner friendly
#6,524 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend, security

Research direction

Start with ResourceProvider.java:96 and ResourceSharingDlsUtils.java:85-87, then inspect the plugin mappings listed in the issue. Confirm how the default field reaches the DLS terms clause and how an opt-in plugin configures it. Done means the default is opt-in only and the required keyword mapping is stated wherever plugins enable it.

Written by the indexing model from the issue text.

Description

bug untriaged

ResourceProvider.workspacesField() defaults to "workspaces" (ResourceProvider.java:96), and the DLS restriction adds terms(<workspacesField>, <user workspaces>) for each resolved index (ResourceSharingDlsUtils.java:85-87).

No resource index in the onboarded plugins maps a workspaces field, and most of those mappings are dynamic: false:

Mapping workspaces mapped dynamic: false
ml-commons ml_model_group.json no no
alerting scheduled-jobs.json no yes
anomaly-detection config.json no yes
flow-framework global-context.json, workflow-state.json no yes
reporting report-definitions-mapping.yml, report-instances-mapping.yml no yes
notifications notifications-config-mapping.yml no yes
security-analytics detectors.json no yes
security-analytics correlation-rules.json no no

A value written to that field would therefore not be indexed on eight of the ten indices, and the clause could not match. The defect is latent rather than active: only the sample plugin implements resolveWorkspacesForUser, so the user's workspace set is empty in real deployments today and the clause is omitted entirely.

Suggested: default workspacesField() to null so it is opt-in, and state the keyword-mapping requirement wherever a plugin is told to opt in.

Dominant language
Java
Stars
252
Forks
395
Avg merge
1d 11h
Merged PRs (30d)
74

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opensearch-project/security

All issues in opensearch-project/security

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.