Skip to content

Commit 62bf0ef

Browse files
authored
Merge pull request #63 from SentriusLLC/copilot/fix-62
Add JIRA proxy for agent integration and compliance automation
2 parents 23b429a + 405c0a7 commit 62bf0ef

36 files changed

+828
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sub-projects:
99
core – Handles the core functionalities (e.g., SSH session management, zero trust policy enforcement).
1010
api – Provides a RESTful API layer to interface with the core module.
1111
dataplane – Offers dataplane functionality for secure data transfer and processing.
12-
llm-proxy – A proxy service that integrates with large language models (LLMs) to enhance security and compliance in SSH sessions.
12+
integration-proxy – A proxy service that integrates with large language models (LLMs) to enhance security and compliance in SSH sessions.
1313
llm-dataplane – A data processing layer that leverages LLMs for advanced analysis and decision-making in SSH sessions.
1414
ops-scripts – Contains operational scripts for deployment and management tasks.
1515
ai-agent – Java-based intelligent agent framework for monitoring and controlling SSH sessions.

build-images.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ update_sentrius_ssh=false
7474
update_sentrius_keycloak=false
7575
update_sentrius_agent=false
7676
update_sentrius_ai_agent=false
77-
update_llmproxy=false
77+
update_integrationproxy=false
7878
update_launcher=false
7979

8080
while [[ "$#" -gt 0 ]]; do
@@ -85,8 +85,8 @@ while [[ "$#" -gt 0 ]]; do
8585
--sentrius-agent) update_sentrius_agent=true ;;
8686
--sentrius-ai-agent) update_sentrius_ai_agent=true ;;
8787
--sentrius-launcher-service) update_launcher=true ;;
88-
--sentrius-llmproxy) update_llmproxy=true ;;
89-
--all) update_sentrius=true; update_sentrius_ssh=true; update_sentrius_keycloak=true; update_sentrius_agent=true; update_sentrius_ai_agent=true; update_llmproxy=true; update_launcher=true ;;
88+
--sentrius-integration-proxy) update_integrationproxy=true ;;
89+
--all) update_sentrius=true; update_sentrius_ssh=true; update_sentrius_keycloak=true; update_sentrius_agent=true; update_sentrius_ai_agent=true; update_integrationproxy=true; update_launcher=true ;;
9090
--no-cache) NO_CACHE=true ;;
9191
*) echo "Unknown flag: $1"; exit 1 ;;
9292
esac
@@ -138,11 +138,11 @@ if $update_sentrius_ai_agent; then
138138
rm docker/sentrius-launchable-agent/agent.jar
139139
fi
140140

141-
if $update_llmproxy; then
142-
cp llm-proxy/target/sentrius-llm-proxy-*.jar docker/llmproxy/llmproxy.jar
141+
if $update_integrationproxy; then
142+
cp integration-proxy/target/sentrius-integration-proxy-*.jar docker/integrationproxy/llmproxy.jar
143143
LLMPROXY_VERSION=$(increment_patch_version $LLMPROXY_VERSION)
144-
build_image "sentrius-llmproxy" "$LLMPROXY_VERSION" "./docker/llmproxy"
145-
rm docker/llmproxy/llmproxy.jar
144+
build_image "sentrius-integration-proxy" "$LLMPROXY_VERSION" "./docker/integrationproxy"
145+
rm docker/integrationproxy/llmproxy.jar
146146
update_env_var "LLMPROXY_VERSION" "$LLMPROXY_VERSION"
147147
fi
148148

deprecated-build-images-local.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ update_sentrius_ssh=false
5959
update_sentrius_keycloak=false
6060
update_sentrius_agent=false
6161
update_sentrius_ai_agent=false
62-
update_llmproxy=false
62+
update_integrationproxy=false
6363
no_cache=false # Default: use cache
6464

6565

@@ -70,8 +70,8 @@ while [[ "$#" -gt 0 ]]; do
7070
--sentrius-keycloak) update_sentrius_keycloak=true ;;
7171
--sentrius-agent) update_sentrius_agent=true ;;
7272
--sentrius-ai-agent) update_sentrius_ai_agent=true ;;
73-
--sentrius-llmproxy) update_llmproxy=true ;;
74-
--all) update_sentrius=true; update_sentrius_ssh=true; update_sentrius_keycloak=true; update_sentrius_agent=true; update_sentrius_ai_agent=true; update_llmproxy=true ;;
73+
--sentrius-integration-proxy) update_integrationproxy=true ;;
74+
--all) update_sentrius=true; update_sentrius_ssh=true; update_sentrius_keycloak=true; update_sentrius_agent=true; update_sentrius_ai_agent=true; update_integrationproxy=true ;;
7575
--no-cache) no_cache=true ;; # Set no_cache to true if the flag is passed
7676
*) echo "Unknown flag: $1"; exit 1 ;;
7777
esac
@@ -140,14 +140,14 @@ if $update_sentrius_ai_agent; then
140140
#minikube image load sentrius-ai-agent:latest
141141
fi
142142

143-
if $update_llmproxy; then
144-
cp llm-proxy/target/sentrius-llm-proxy-*.jar docker/llmproxy/llmproxy.jar
143+
if $update_integrationproxy; then
144+
cp integration-proxy/target/sentrius-integration-proxy-*.jar docker/integrationproxy/llmproxy.jar
145145
LLMPROXY_VERSION=$(increment_patch_version $LLMPROXY_VERSION)
146-
build_image "sentrius-llmproxy" "$LLMPROXY_VERSION" "./docker/llmproxy"
147-
rm docker/llmproxy/llmproxy.jar
146+
build_image "sentrius-integration-proxy" "$LLMPROXY_VERSION" "./docker/integrationproxy"
147+
rm docker/integrationproxy/llmproxy.jar
148148
update_env_var "LLMPROXY_VERSION" "$LLMPROXY_VERSION"
149149
## for local, replace minikube with docker
150-
docker tag sentrius-llmproxy:$LLMPROXY_VERSION sentrius-llmproxy:latest
150+
docker tag sentrius-integration-proxy:$LLMPROXY_VERSION sentrius-integration-proxy:latest
151151
echo "Loading image into minikube"
152152
#minikube image load sentrius-ai-agent:LLMPROXY_VERSION
153153
#minikube image load sentrius-ai-agent:latest
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# JIRA Proxy API Documentation
2+
3+
The JIRA Proxy Controller provides a secure interface to interact with JIRA instances through the Sentrius platform. It mirrors key JIRA REST API endpoints while maintaining the platform's authentication and authorization mechanisms.
4+
5+
## Overview
6+
7+
The JIRA proxy is implemented in the `integration-proxy` module and provides authenticated access to JIRA functionality for agents and compliance tools. It follows the same security patterns as the existing OpenAI proxy.
8+
9+
## Authentication
10+
11+
All endpoints require:
12+
- Valid JWT token in the `Authorization` header (format: `Bearer <token>`)
13+
- User must have `CAN_LOG_IN` application access
14+
- At least one JIRA integration must be configured in the system
15+
16+
## Endpoints
17+
18+
### 1. Search Issues
19+
20+
**GET** `/api/v1/jira/rest/api/3/search`
21+
22+
Search for JIRA issues using JQL or simple text queries.
23+
24+
**Parameters:**
25+
- `jql` (optional): JIRA Query Language string
26+
- `query` (optional): Simple text search query
27+
28+
**Example:**
29+
```bash
30+
curl -X GET \
31+
"https://your-instance/api/v1/jira/rest/api/3/search?query=bug" \
32+
-H "Authorization: Bearer <jwt-token>"
33+
```
34+
35+
**Response:** Array of TicketDTO objects containing issue information.
36+
37+
### 2. Get Issue
38+
39+
**GET** `/api/v1/jira/rest/api/3/issue/{issueKey}`
40+
41+
Retrieve information about a specific JIRA issue.
42+
43+
**Parameters:**
44+
- `issueKey` (path): JIRA issue key (e.g., "PROJECT-123")
45+
46+
**Example:**
47+
```bash
48+
curl -X GET \
49+
"https://your-instance/api/v1/jira/rest/api/3/issue/PROJECT-123" \
50+
-H "Authorization: Bearer <jwt-token>"
51+
```
52+
53+
**Response:** Issue status information.
54+
55+
### 3. Add Comment
56+
57+
**POST** `/api/v1/jira/rest/api/3/issue/{issueKey}/comment`
58+
59+
Add a comment to a JIRA issue.
60+
61+
**Parameters:**
62+
- `issueKey` (path): JIRA issue key
63+
- Request body: Comment object with `text` or `body` field
64+
65+
**Example:**
66+
```bash
67+
curl -X POST \
68+
"https://your-instance/api/v1/jira/rest/api/3/issue/PROJECT-123/comment" \
69+
-H "Authorization: Bearer <jwt-token>" \
70+
-H "Content-Type: application/json" \
71+
-d '{"text": "This is a comment from the compliance agent"}'
72+
```
73+
74+
**Response:** Success/failure message.
75+
76+
### 4. Assign Issue
77+
78+
**PUT** `/api/v1/jira/rest/api/3/issue/{issueKey}/assignee`
79+
80+
Assign a JIRA issue to a user.
81+
82+
**Parameters:**
83+
- `issueKey` (path): JIRA issue key
84+
- Request body: Assignee object with `accountId` field
85+
86+
**Example:**
87+
```bash
88+
curl -X PUT \
89+
"https://your-instance/api/v1/jira/rest/api/3/issue/PROJECT-123/assignee" \
90+
-H "Authorization: Bearer <jwt-token>" \
91+
-H "Content-Type: application/json" \
92+
-d '{"accountId": "user-account-id"}'
93+
```
94+
95+
**Response:** HTTP 204 (No Content) on success.
96+
97+
## Configuration
98+
99+
### JIRA Integration Setup
100+
101+
Before using the proxy, ensure a JIRA integration is configured:
102+
103+
1. Use the existing `/api/v1/integrations/jira/add` endpoint to add JIRA integration
104+
2. Provide required fields: `baseUrl`, `username`, `apiToken`
105+
106+
### Security Model
107+
108+
The proxy uses the existing security infrastructure:
109+
- JWT validation through Keycloak
110+
- User authentication via `BaseController.getOperatingUser()`
111+
- Access control through `@LimitAccess` annotations
112+
- OpenTelemetry tracing for monitoring
113+
114+
## Implementation Details
115+
116+
### Error Handling
117+
118+
- **401 Unauthorized**: Invalid or missing JWT token
119+
- **404 Not Found**: No JIRA integration configured
120+
- **400 Bad Request**: Missing required parameters
121+
- **500 Internal Server Error**: JIRA operation failed
122+
123+
### Integration Token Selection
124+
125+
Currently, the proxy uses the first available JIRA integration found for the connection type "jira". In production environments, you may want to extend this to allow users to specify which integration to use.
126+
127+
### Tracing
128+
129+
All operations are traced using OpenTelemetry with the tracer name `io.sentrius.sso`. Trace spans include:
130+
- Operation type (search, get-issue, add-comment, assign-issue)
131+
- Query parameters
132+
- Result counts
133+
- Success/failure status
134+
135+
## Future Enhancements
136+
137+
1. **Multi-integration Support**: Allow specifying which JIRA instance to use
138+
2. **Enhanced JQL Support**: Full JQL query validation and optimization
139+
3. **Bulk Operations**: Support for bulk issue updates and assignments
140+
4. **Webhook Support**: Real-time notifications from JIRA
141+
5. **Custom Field Support**: Access to JIRA custom fields
142+
6. **Project-specific Operations**: Project creation, configuration management
143+
144+
## Usage with Compliance Agents
145+
146+
This proxy is designed to support compliance agents that need to:
147+
- Search for compliance-related issues
148+
- Create comments with compliance findings
149+
- Assign issues to appropriate team members
150+
- Track compliance status across JIRA projects
151+
152+
Example agent workflow:
153+
1. Search for open compliance issues: `GET /api/v1/jira/rest/api/3/search?jql=project = COMPLIANCE AND status = Open`
154+
2. Add compliance assessment: `POST /api/v1/jira/rest/api/3/issue/COMPLIANCE-123/comment`
155+
3. Assign for remediation: `PUT /api/v1/jira/rest/api/3/issue/COMPLIANCE-123/assignee`
156+
157+
## Testing
158+
159+
Comprehensive test coverage is provided in `JiraProxyControllerTest.java`, including:
160+
- Authentication validation
161+
- Authorization checks
162+
- Error handling scenarios
163+
- Request/response validation
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<version>1.0.0-SNAPSHOT</version>
99
</parent>
1010

11-
<artifactId>sentrius-llm-proxy</artifactId>
11+
<artifactId>sentrius-integration-proxy</artifactId>
1212

1313

1414
<properties>

llm-proxy/src/main/java/io/sentrius/sso/LLMProxyApplication.java renamed to integration-proxy/src/main/java/io/sentrius/sso/LLMProxyApplication.java

File renamed without changes.

0 commit comments

Comments
 (0)