Skip to content

Commit 9068cd6

Browse files
committed
ujpdates
1 parent a72186d commit 9068cd6

File tree

13 files changed

+46
-14
lines changed

13 files changed

+46
-14
lines changed

.gcp.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SENTRIUS_VERSION=1.0.39
1+
SENTRIUS_VERSION=1.0.44
22
SENTRIUS_SSH_VERSION=1.0.4
33
SENTRIUS_KEYCLOAK_VERSION=1.0.7
4-
SENTRIUS_AGENT_VERSION=1.0.17
4+
SENTRIUS_AGENT_VERSION=1.0.18

analyagents/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<groupId>org.projectlombok</groupId>
6868
<artifactId>lombok</artifactId>
6969
</dependency>
70+
<dependency>
71+
<groupId>net.snowflake</groupId>
72+
<artifactId>snowflake-ingest-sdk</artifactId>
73+
<version>${snowflake-ingest-version}</version>
74+
</dependency>
7075
</dependencies>
7176

7277
<build>

analyagents/src/main/java/io/sentrius/agent/analysis/agents/sessions/SessionAnalyticsAgent.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ public void processSessions() {
6161
List<TerminalSessionMetadata> unprocessedSessions = sessionMetadataService.getSessionsByState("CLOSED").stream()
6262
.filter(session -> !processedSessionIds.contains(session.getId()))
6363
.collect(Collectors.toList());
64-
64+
long count = 0;
6565
for (TerminalSessionMetadata session : unprocessedSessions) {
66+
count++;
6667
try {
6768
processSession(session);
6869
// ACTIVE -> INACTIVE -> CLOSED -> PROCESSED
@@ -75,7 +76,7 @@ public void processSessions() {
7576
sessionMetadataService.saveSession(session);
7677
}
7778

78-
log.info("Finished processing sessions");
79+
log.info("Finished processing {} sessions ", count);
7980
}
8081
/* TODO - Implement this
8182
@Scheduled(fixedDelay = 60000) // Waits 60 seconds after the previous run completes
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.sentrius.agent.analysis.sinks.log;
2+
3+
import java.util.List;
4+
import io.sentrius.sso.core.model.sessions.TerminalLogs;
5+
6+
public interface LogSink {
7+
8+
void process(List<TerminalLogs> logs);
9+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public static String createErrorHash(StackTraceElement[] trace, String t) {
3434
@RequestMapping("/error")
3535
public String handleError(HttpServletRequest request, Model model) {
3636
// Retrieve error details
37-
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
38-
Throwable ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
37+
Integer statusCode = (Integer) request.getAttribute("jakarta.servlet.error.status_code");
38+
Throwable ex = (Throwable) request.getAttribute("jakarta.servlet.error.exception");
3939

4040
// Log error details (optional)
4141
if (ex != null) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
import org.springframework.http.ResponseEntity;
2323
import org.springframework.stereotype.Controller;
2424
import org.springframework.web.bind.annotation.PostMapping;
25+
import org.springframework.web.bind.annotation.RequestBody;
2526
import org.springframework.web.bind.annotation.RequestMapping;
2627
import org.springframework.web.bind.annotation.RequestParam;
28+
import org.springframework.web.bind.annotation.ResponseBody;
2729

2830
@Slf4j
2931
@Controller
@@ -76,9 +78,10 @@ public ResponseEntity<ExternalIntegrationDTO> addJiraIntegration(HttpServletRequ
7678
@LimitAccess(applicationAccess = {ApplicationAccessEnum.CAN_MANAGE_APPLICATION})
7779
public ResponseEntity<ExternalIntegrationDTO> addOpenaiIntegration(HttpServletRequest request,
7880
HttpServletResponse response,
79-
ExternalIntegrationDTO integrationDTO)
81+
@RequestBody ExternalIntegrationDTO integrationDTO)
8082
throws JsonProcessingException {
8183

84+
log.info("ahh");
8285

8386
var json = JsonUtil.MAPPER.writeValueAsString(integrationDTO);
8487
IntegrationSecurityToken token = IntegrationSecurityToken.builder()

api/src/main/resources/templates/sso/integrations/add_openai.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@
6464
const form = event.target;
6565
const formData = new FormData(form);
6666
const jsonData = Object.fromEntries(formData.entries());
67-
67+
var csrf = "[[${_csrf.token}]]"
6868
try {
6969
const response = await fetch(form.action, {
7070
method: "POST",
7171
headers: {
72-
"Content-Type": "application/json"
72+
"Content-Type": "application/json",
73+
"X-CSRF-TOKEN": csrf
7374
},
7475
body: JSON.stringify(jsonData)
7576
});

core/src/main/java/io/sentrius/sso/automation/auditing/rules/TwoPartyAIMonitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ public Optional<Trigger> onMessage(Session.TerminalMessage text) {
183183
analysis.get();
184184

185185
if (llmResponse.get() != null && llmQuestion.get() != null) {
186-
Trigger trg = llmQuestion.get() != null ? new Trigger(TriggerAction.PROMPT_ACTION, llmResponse.get(),
186+
Trigger trg = llmQuestion.get() != null && enableLLMQuestions ? new Trigger(TriggerAction.PROMPT_ACTION,
187+
llmResponse.get(),
187188
llmQuestion.get()) :
188189
new Trigger(TriggerAction.PERSISTENT_MESSAGE, llmResponse.get());
189190
return Optional.of(trg);

core/src/main/java/io/sentrius/sso/core/config/SystemOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public Map<String, SystemOption> getOptions() throws IllegalAccessException {
236236
String fieldName = field.getName();
237237
Object fieldValue = field.get(this);
238238

239-
log.debug("Field: {} Value: {}", fieldName, fieldValue);
239+
log.trace("Field: {} Value: {}", fieldName, fieldValue);
240240

241241
// Create a SystemOption object with the field details
242242
var sysOpt = SystemOption.builder()

core/src/main/java/io/sentrius/sso/core/model/security/AccessControlAspect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import jakarta.servlet.http.HttpServletRequest;
1313
import jakarta.servlet.http.HttpServletResponse;
1414
import lombok.RequiredArgsConstructor;
15+
import lombok.extern.slf4j.Slf4j;
1516
import org.aspectj.lang.annotation.Aspect;
1617
import org.aspectj.lang.annotation.Before;
1718
import org.springframework.stereotype.Component;
@@ -25,6 +26,7 @@
2526

2627
@Aspect
2728
@Component
29+
@Slf4j
2830
@RequiredArgsConstructor
2931
public class AccessControlAspect {
3032

@@ -44,18 +46,21 @@ public void checkLimitAccess(LimitAccess limitAccess) throws SQLException, Gener
4446
// Get the required roles from the annotation
4547
for (var userAccess : accessAnnotation.userAccess()) {
4648
if (!canAccess(operatingUser, userAccess)) {
49+
log.info("Access Denied to {} at {}", operatingUser, userAccess);
4750
canAccess = false;
4851
break;
4952
}
5053
}
5154
for (var appAccess : accessAnnotation.applicationAccess()) {
5255
if (!canAccess(operatingUser, appAccess)) {
56+
log.info("Access Denied to {} at {}", operatingUser, appAccess);
5357
canAccess = false;
5458
break;
5559
}
5660
}
5761

5862
if (!canAccess) {
63+
5964
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "Access Denied to ");
6065
}
6166
}

0 commit comments

Comments
 (0)