@@ -213,6 +213,13 @@ public Writeable captureAsWriteable() {
213
213
* For example, a user might not have permission to GET from the tasks index
214
214
* but the tasks API will perform a get on their behalf using this method
215
215
* if it can't find the task in memory.
216
+ *
217
+ * Usage of stashWithOrigin is guarded by a ThreadContextPermission. In order to use
218
+ * stashWithOrigin, the codebase needs to explicitly be granted permission in the JSM policy file.
219
+ *
220
+ * Add an entry in the grant portion of the policy file like this:
221
+ *
222
+ * permission org.opensearch.secure_sm.ThreadContextPermission "stashWithOrigin";
216
223
*/
217
224
public StoredContext stashWithOrigin (String origin ) {
218
225
SecurityManager sm = System .getSecurityManager ();
@@ -228,6 +235,13 @@ public StoredContext stashWithOrigin(String origin) {
228
235
* Removes the current context and resets a new context that contains a merge of the current headers and the given headers.
229
236
* The removed context can be restored when closing the returned {@link StoredContext}. The merge strategy is that headers
230
237
* that are already existing are preserved unless they are defaults.
238
+ *
239
+ * Usage of stashAndMergeHeaders is guarded by a ThreadContextPermission. In order to use
240
+ * stashAndMergeHeaders, the codebase needs to explicitly be granted permission in the JSM policy file.
241
+ *
242
+ * Add an entry in the grant portion of the policy file like this:
243
+ *
244
+ * permission org.opensearch.secure_sm.ThreadContextPermission "stashAndMergeHeaders";
231
245
*/
232
246
public StoredContext stashAndMergeHeaders (Map <String , String > headers ) {
233
247
SecurityManager sm = System .getSecurityManager ();
0 commit comments