@@ -213,6 +213,13 @@ public Writeable captureAsWriteable() {
213213 * For example, a user might not have permission to GET from the tasks index
214214 * but the tasks API will perform a get on their behalf using this method
215215 * 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";
216223 */
217224 public StoredContext stashWithOrigin (String origin ) {
218225 SecurityManager sm = System .getSecurityManager ();
@@ -228,6 +235,13 @@ public StoredContext stashWithOrigin(String origin) {
228235 * Removes the current context and resets a new context that contains a merge of the current headers and the given headers.
229236 * The removed context can be restored when closing the returned {@link StoredContext}. The merge strategy is that headers
230237 * 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";
231245 */
232246 public StoredContext stashAndMergeHeaders (Map <String , String > headers ) {
233247 SecurityManager sm = System .getSecurityManager ();
0 commit comments