Repository navigation
Conversation
… variable Port of dtq-dev-93 PR 1650 (commit f08abc4).
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change to bind request-supplied node IDs as XPath variables.
No open issues 🎉
What changed in this PR
This PR hardens controlled-vocabulary lookups against XPath injection by binding request-supplied node IDs as variables instead of inserting them into expressions.
Changes:
- Uses
$nodeIdbinding for choice, child, and parent lookups, replacing the old XPath helper. - Adds regression coverage for injection attempts and valid hierarchy lookups.
- Adds a nested
pondnode to the test vocabulary.
| File | Description |
|---|---|
| dspace-api/src/test/java/org/dspace/content/authority/DSpaceControlledVocabularyTest.java | Tests literal node-ID handling and valid parent/child results. |
| dspace-api/src/test/data/dspaceFolder/config/controlled-vocabularies/farm.xml | Adds pond beneath s40 for hierarchy tests. |
| dspace-api/src/main/java/org/dspace/content/authority/DSpaceControlledVocabulary.java | Binds node IDs through XPath variable resolvers. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
Port of dtq-dev-93 PR 1650 (commit f08abc4). dspace-customers issue 1083, finding V4.
Upstream commit aa419b9 (DSpace#11964).
Upstream: DSpace#13386 (
dspace-9_x) and DSpace#13387 (dspace-8_x) port the same node id fix (open).Description
DSpaceControlledVocabularyput the node id from the request straight into the XPath expression, so a'could change the query. The id is now the XPath variable$nodeId. The label search already uses XPath variables on 9.3 (DSpace#11075).Instructions for Reviewers
getChoice,getChoicesByParentandgetParentChoiceevaluate//node[@id = $nodeId]with anXPathVariableResolver.getNodeFromXPathis removed.testNodeIdIsNotEvaluatedAsXPath. The testfarm.xmlgets apondnode unders40.DSpaceControlledVocabularyTest. Locally on this branch (9.3):Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Checkstyle passes.Checklist