Skip to content

Commit 50b6729

Browse files
committed
fix deployment and enable pluggable rule feature
1 parent ad503d2 commit 50b6729

File tree

11 files changed

+343
-9
lines changed

11 files changed

+343
-9
lines changed

.azure.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
SENTRIUS_VERSION=1.1.54
1+
SENTRIUS_VERSION=1.1.55
22
SENTRIUS_SSH_VERSION=1.1.11
33
SENTRIUS_KEYCLOAK_VERSION=1.1.14
44
SENTRIUS_AGENT_VERSION=1.1.23
55
SENTRIUS_AI_AGENT_VERSION=1.1.4
66
LLMPROXY_VERSION=1.1.4
77
LAUNCHER_VERSION=1.1.4
8-
AGENTPROXY_VERSION=1.1.5
8+
AGENTPROXY_VERSION=1.1.4
99
SSHPROXY_VERSION=1.1.4
1010
RDPPROXY_VERSION=1.1.4
1111
GITHUB_MCP_VERSION=1.1.4

agent-proxy/dynamic.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ systemLogoName=Sentrius
88
AccessTokenAuditor.rule.4=io.sentrius.sso.automation.auditing.rules.OpenAISessionRule;Malicious AI Monitoring
99
AccessTokenAuditor.rule.5=io.sentrius.sso.automation.auditing.rules.TwoPartyAIMonitor;AI Second Party Monitor
1010
AccessTokenAuditor.rule.6=io.sentrius.sso.automation.auditing.rules.SudoApproval;Sudo Approval
11+
AccessTokenAuditor.rule.7=io.sentrius.sso.automation.auditing.rules.PluggableRuleEvaluator;Custom Pluggable Rule
1112
allowProxies=true
1213
AccessTokenAuditor.rule.2=io.sentrius.sso.automation.auditing.rules.DeletePrevention;Delete Prevention
1314
AccessTokenAuditor.rule.3=io.sentrius.sso.automation.auditing.rules.TwoPartySessionRule;Require Second Party Monitoring

api/dynamic.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ systemLogoName=Sentrius
88
AccessTokenAuditor.rule.4=io.sentrius.sso.automation.auditing.rules.OpenAISessionRule;Malicious AI Monitoring
99
AccessTokenAuditor.rule.5=io.sentrius.sso.automation.auditing.rules.TwoPartyAIMonitor;AI Second Party Monitor
1010
AccessTokenAuditor.rule.6=io.sentrius.sso.automation.auditing.rules.SudoApproval;Sudo Approval
11+
AccessTokenAuditor.rule.7=io.sentrius.sso.automation.auditing.rules.PluggableRuleEvaluator;Custom Pluggable Rule
1112
allowProxies=true
1213
AccessTokenAuditor.rule.2=io.sentrius.sso.automation.auditing.rules.DeletePrevention;Delete Prevention
1314
AccessTokenAuditor.rule.3=io.sentrius.sso.automation.auditing.rules.TwoPartySessionRule;Require Second Party Monitoring

api/src/main/java/io/sentrius/sso/controllers/api/RuleApiController.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import io.sentrius.sso.core.services.RuleService;
2424
import io.sentrius.sso.core.services.UserService;
2525
import io.sentrius.sso.core.services.agents.LLMService;
26+
import io.sentrius.sso.core.services.security.IntegrationSecurityTokenService;
2627
import io.sentrius.sso.core.utils.AccessUtil;
2728
import com.fasterxml.jackson.databind.ObjectMapper;
2829
import com.fasterxml.jackson.databind.JsonNode;
@@ -48,17 +49,19 @@ public class RuleApiController extends BaseController {
4849
final HostGroupService hostGroupService;
4950
final RuleService ruleService;
5051
final LLMService llmService;
52+
private final IntegrationSecurityTokenService integrationSecurityTokenService;
5153
final ObjectMapper objectMapper;
5254

5355
protected RuleApiController(
5456
UserService userService, SystemOptions systemOptions,
5557
ErrorOutputService errorOutputService,
56-
HostGroupService hostGroupService, RuleService ruleService,
57-
LLMService llmService, ObjectMapper objectMapper) {
58+
HostGroupService hostGroupService, RuleService ruleService,
59+
LLMService llmService, IntegrationSecurityTokenService integrationSecurityTokenService, ObjectMapper objectMapper) {
5860
super(userService, systemOptions, errorOutputService);
5961
this.hostGroupService = hostGroupService;
6062
this.ruleService = ruleService;
6163
this.llmService = llmService;
64+
this.integrationSecurityTokenService = integrationSecurityTokenService;
6265
this.objectMapper = objectMapper;
6366
}
6467

@@ -294,9 +297,16 @@ public ResponseEntity<Map<String, Object>> generateRule(
294297
// Note: Using empty builder as LLM service will use system authentication
295298
// If LLM requires user-specific tokens, this would need to be enhanced
296299
TokenDTO token = TokenDTO.builder().build();
297-
300+
301+
var authToken = integrationSecurityTokenService
302+
.selectToken(systemOptions.getDefaultLlmProvider())
303+
.orElse(null);
304+
305+
if (authToken == null) throw new RuntimeException("Authentication required");
306+
298307
try {
299-
String llmResponse = llmService.askQuestion(token, llmRequest);
308+
String llmResponse = llmService.askQuestion(token, systemOptions.getIntegrationProxyUrl(),
309+
llmRequest);
300310
log.info("LLM response: {}", llmResponse);
301311

302312
// Parse the response

api/src/main/java/io/sentrius/sso/controllers/view/ZeroTrustRuleController.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.ArrayList;
44
import java.util.List;
55
import io.sentrius.sso.automation.auditing.rules.CommandEvaluator;
6+
import io.sentrius.sso.automation.auditing.rules.PluggableRuleEvaluator;
67
import io.sentrius.sso.automation.auditing.rules.RuleConfiguration;
78
import io.sentrius.sso.core.config.SystemOptions;
89
import io.sentrius.sso.core.controllers.BaseController;
@@ -99,5 +100,12 @@ public String customRuleChat() {
99100
return "sso/rules/custom_rule_chat";
100101
}
101102

103+
@GetMapping("/config/pluggable_rule")
104+
public String configurePluggableRule(@RequestParam("ruleName") String ruleName, Model model) {
105+
model.addAttribute("ruleName", ruleName);
106+
model.addAttribute("ruleClass", PluggableRuleEvaluator.class.getCanonicalName());
107+
return "sso/rules/pluggable_rule";
108+
}
109+
102110

103111
}

api/src/main/resources/static/js/rules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ $(document).ready(function () {
192192
} else if (ruleClass.includes("AllowedCommandsRule")) {
193193
url = "/sso/v1/zerotrust/rules/config/allowed_commands_rule?ruleName=" + encodeURIComponent(ruleName);
194194
} else if (ruleClass.includes("PluggableRuleEvaluator")) {
195-
// Redirect to custom rule chat interface for PluggableRuleEvaluator
196-
url = "/sso/v1/zerotrust/rules/custom-chat";
195+
// Redirect to pluggable rule configuration form
196+
url = "/sso/v1/zerotrust/rules/config/pluggable_rule?ruleName=" + encodeURIComponent(ruleName);
197197
window.location.href = url;
198198
return;
199199
} else if (ruleClass.includes("DeletePrevention")) {

0 commit comments

Comments
 (0)