Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -92,7 +92,7 @@ public static void setUpBeforeClass() throws Exception {
};
addRangePathIndex(dbName, rangePaths);

createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri", "xdbc:invoke", "xdmp-login");
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri", "xdbc:invoke");
createRESTUser("eval-user", "x", "test-eval", "rest-admin", "rest-writer", "rest-reader", "rest-extension-user", "manage-user");
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,7 +54,7 @@ public static void tearDownAfterClass() throws Exception {
@BeforeEach
public void setUp() throws Exception {
// create new connection for each test below
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri", "xdbc:invoke", "xdmp-login");
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri", "xdbc:invoke");
createRESTUser("eval-user", "x", "test-eval", "rest-admin", "rest-writer", "rest-reader");
client = newClientAsUser("eval-user", "x");
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,7 +112,7 @@ public String deleteJSON(String docUri) {

@BeforeAll
public static void setUpBeforeClass() throws Exception {
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:value", "xdmp:eval", "xdmp:eval-in", "any-uri", "xdbc:invoke", "xdmp-login");
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:value", "xdmp:eval", "xdmp:eval-in", "any-uri", "xdbc:invoke");
createRESTUser("eval-user", "x", "test-eval", "rest-admin", "rest-writer", "rest-reader", "rest-extension-user");
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -121,7 +121,7 @@ public static void tearDownAfterClass() throws Exception {
@BeforeEach
public void setUp() throws Exception {
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri",
"xdbc:invoke", "temporal:statement-set-system-time", "xdmp-login");
"xdbc:invoke", "temporal:statement-set-system-time");
createRESTUser("eval-user", "x", "test-eval", "rest-admin", "rest-writer", "rest-reader", "temporal-admin");

adminClient = getDatabaseClient("rest-admin", "x", getConnType());
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,16 @@
"privilege-name": "term-query",
"action": "http://marklogic.com/xdmp/privileges/term-query",
"kind": "execute"
},
{
"privilege-name": "unprotected-uri",
"action": "http://marklogic.com/xdmp/privileges/unprotected-uri",
"kind": "execute"
},
{
"privilege-name": "unprotected-collections",
"action": "http://marklogic.com/xdmp/privileges/unprotected-collections",
"kind": "execute"
}
]
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,16 @@
"privilege-name": "xdbc:eval-in",
"action": "http://marklogic.com/xdmp/privileges/xdbc-eval-in",
"kind": "execute"
},
{
"privilege-name": "unprotected-uri",
"action": "http://marklogic.com/xdmp/privileges/unprotected-uri",
"kind": "execute"
},
{
"privilege-name": "unprotected-collections",
"action": "http://marklogic.com/xdmp/privileges/unprotected-collections",
"kind": "execute"
}
]
}

This file was deleted.

18 changes: 14 additions & 4 deletions test-app/src/main/ml-config/security/roles/test-rest-writer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,13 +18,23 @@
"kind": "execute"
},
{
"privilege-name": "xdmp-login",
"action": "http://marklogic.com/xdmp/privileges/xdmp-login",
"privilege-name": "xdmp:invoke",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for this PR, but I think it'd be good to next try a PR where this is removed from this role and see what fails. And then create an additional role - e.g. "test-invoke" - that only grants this privilege and give it a user that is only used for tests where we know this privilege is required. It should be granted for a "rest writer" who typically does not need invoke (or eval) privileges.

"action": "http://marklogic.com/xdmp/privileges/xdmp-invoke",
"kind": "execute"
},
{
"privilege-name": "xdmp:invoke",
"action": "http://marklogic.com/xdmp/privileges/xdmp-invoke",
"privilege-name": "xdmp:xslt-invoke",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for these privileges - I would do a follow up PR where I remove these and see what breaks.

@jonmillejonmilleAug 12, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the removal of xdmp:xslt-invoke, xdmp:xslt-eval, and xdmp:value the 3 test failures from the first Jenkins run are shown: https://ml-clt-jenkins.progress.com/blue/organizations/jenkins/devexp%2FJava-Client%2Fjava-client-api/detail/PR-1966/1/tests

xsltTransformWithoutParam() – com.marklogic.client.test.rows.TransformDocTest

  • com.marklogic.client.ForbiddenUserException: Local message: User is not allowed to apply resource at rows/update. Server Message: You do not have permission to this method and URL.

xsltTransformWithParam() – com.marklogic.client.test.rows.TransformDocTest

  • com.marklogic.client.ForbiddenUserException: Local message: User is not allowed to apply resource at rows/update. Server Message: You do not have permission to this method and URL.

testUsingFromParamAndSchematron() – com.marklogic.client.test.rows.ValidateDocTest

  • com.marklogic.client.ForbiddenUserException: Local message: User is not allowed to apply resource at rows/update. Server Message: You do not have permission to this method and URL.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • TransformDocTest#xsltTransformWithoutParam — XSLT stylesheet invoked by URI; needs xdmp:xslt-invoke
  • TransformDocTest#xsltTransformWithParam — XSLT stylesheet invoked by URI; needs xdmp:xslt-invoke
  • ValidateDocTest#testUsingFromParamAndSchematron — schematron compiled to XSLT (xdmp:xslt-invoke + xdmp:xslt-eval) then written via fromParam (xdmp:value)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great - I wouldn't address those in this PR, but I would do a follow up where I make a new test user that has those additional privileges. That way, the other tests run as a rest-writer user that doesn't have those privileges. That provides a better regression suite that can catch a bug where a server change ends up requiring a new privilege.

"action": "http://marklogic.com/xdmp/privileges/xslt-invoke",
"kind": "execute"
},
{
"privilege-name": "xdmp:xslt-eval",
"action": "http://marklogic.com/xdmp/privileges/xslt-eval",
"kind": "execute"
},
{
"privilege-name": "xdmp:value",
"action": "http://marklogic.com/xdmp/privileges/xdmp-value",
"kind": "execute"
},
{
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"user-name": "rest-admin",
"description": "rest-admin user",
"role": ["rest-admin", "java-test-delete-temporal", "java-test-xdmp-login"],
"role": ["rest-admin", "java-test-delete-temporal"],
"password": "x"
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"user-name": "rest-evaluator",
"description": "Test user for the java-client-api-project",
"role": ["java-test-evaluator", "java-test-xdmp-login"],
"role": ["java-test-evaluator"],
"password": "x"
}

This file was deleted.

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"user-name": "rest-writer",
"description": "rest-writer user",
"role": ["rest-writer", "java-test-delete-graph", "java-test-xdmp-login"],
"role": ["rest-writer", "java-test-delete-graph"],
"password": "x"
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,7 @@
"test-rest-writer",
"java-test-delete-graph",
"rest-extension-user",
"rest-reader",
"java-test-xdmp-login"
"rest-reader"
],
"password": "x"
}
Loading