Skip to content

Commit

Permalink
Painless: ensure type "UnmodifiableMap" for params
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Ashiwal <rashiwal@amazon.com>
  • Loading branch information
r1walz committed May 31, 2024
1 parent 6c9603a commit 84817c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Allow clearing `remote_store.compatibility_mode` setting ([#13646](https://github.com/opensearch-project/OpenSearch/pull/13646))
- Fix ReplicaShardBatchAllocator to batch shards without duplicates ([#13710](https://github.com/opensearch-project/OpenSearch/pull/13710))
- Pass parent filter to inner hit query ([#13903](https://github.com/opensearch-project/OpenSearch/pull/13903))
- Painless: ensure type "UnmodifiableMap" for params ([#13885](https://github.com/opensearch-project/OpenSearch/pull/13885))

### Security

Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/script/Script.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public Script(StreamInput in) throws IOException {
@SuppressWarnings("unchecked")
Map<String, String> options = (Map<String, String>) (Map) in.readMap();
this.options = options;
this.params = in.readMap();
this.params = Collections.unmodifiableMap(in.readMap());
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion server/src/main/java/org/opensearch/script/UpdateScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.script;

import java.util.Collections;
import java.util.Map;

/**
Expand All @@ -53,7 +54,7 @@ public abstract class UpdateScript {
private final Map<String, Object> ctx;

public UpdateScript(Map<String, Object> params, Map<String, Object> ctx) {
this.params = params;
this.params = Collections.unmodifiableMap(params);
this.ctx = ctx;
}

Expand Down

0 comments on commit 84817c7

Please sign in to comment.