Skip to content

Commit e1c9644

Browse files
committed
[secure-mode] make allowlist interface
1 parent 4f53236 commit e1c9644

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

plugins/secure-mode/src/main/java/ai/djl/serving/plugins/securemode/SecureModeAllowList.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
import java.util.Set;
1616

1717
/** A class for properties that are allowlisted in Secure Mode. */
18-
final class SecureModeAllowList {
18+
interface SecureModeAllowList {
1919

2020
public static final Set<String> PROPERTIES_ALLOWLIST =
2121
Set.of(
2222
"engine",
2323
"job_queue_size",
24+
"max_idle_time",
25+
"batch_size",
26+
"max_batch_delay",
27+
"minWorkers",
28+
"maxWorkers",
2429
"option.entryPoint",
2530
"option.task",
2631
"option.model_id",
@@ -61,6 +66,4 @@ final class SecureModeAllowList {
6166
"option.max_lora_rank",
6267
"option.lora_extra_vocab_size",
6368
"option.max_cpu_loras");
64-
65-
private SecureModeAllowList() {}
6669
}

plugins/secure-mode/src/main/java/ai/djl/serving/plugins/securemode/SecureModeUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public static void validateSecurity(ModelInfo<?, ?> modelInfo) throws IOExceptio
108108
*/
109109
private static void validateProperties(ModelInfo<?, ?> modelInfo, Set<String> allowedKeys) {
110110
Properties prop = modelInfo.getProperties();
111-
Set<String> allowedKeysSet = new HashSet<>(allowedKeys);
111+
allowedKeys = new HashSet<>(allowedKeys);
112112
for (String key : prop.stringPropertyNames()) {
113-
if (!allowedKeysSet.contains(key)) {
113+
if (!allowedKeys.contains(key)) {
114114
throw new IllegalConfigurationException(
115115
"Property " + key + " is prohibited from being set in Secure Mode.");
116116
}

0 commit comments

Comments
 (0)