Skip to content

Commit e248a72

Browse files
committed
Bump lightspeed-stack to authorization commit
Bump lightspeed-stack submodule to include the authorization changes from lightspeed-core/lightspeed-stack#356 Use the new authorization features to restrict access to the assisted-chat service to, for now, Red Hat employees only. In the future we can open this up to all authenticated users. Also bumped to a version that no longer requires the patching of llama-stack / lightspeed-stack to support postgres SSL, so removed the patching steps from the Containerfile.
1 parent d839c04 commit e248a72

4 files changed

Lines changed: 43 additions & 9 deletions

File tree

Containerfile.assisted-chat

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
# vim: set filetype=dockerfile
2-
# This is the digest of quay.io/lightspeed-core/lightspeed-stack:dev-20250814-7a531cb
3-
FROM quay.io/lightspeed-core/lightspeed-stack@sha256:90deb575e0c18bdcf9721aa7614826653ad13b717c992f12b89b6e1f0413179c
2+
# This is the digest of quay.io/lightspeed-core/lightspeed-stack:dev-20250826-913b5a6
3+
FROM quay.io/lightspeed-core/lightspeed-stack@sha256:09d6e2222eb058d85bfdc4e1283b18cee086182a711d71e2c983f355af6dc7b7
44

55
RUN python3 -m ensurepip --default-pip && pip install --upgrade pip
66

77
COPY requirements.txt .
88
RUN python3 -m pip install --no-cache-dir -r requirements.txt
99

10-
11-
USER root
12-
RUN microdnf install -y patch
13-
RUN curl -L https://github.com/meta-llama/llama-stack/commit/49c34dd0d49a960fec23d0be854890f219d917e7.patch | patch -p1 -d $(dirname $(dirname $(python3 -c "import llama_stack; print(llama_stack.__file__)")))
14-
RUN curl -L https://github.com/lightspeed-core/lightspeed-stack/commit/c59ea53ccfe1c6e0fb53d3ac880f925d1d3ede68.patch | patch -p1 -d $(dirname $(dirname $(python3 -c "import lightspeed_stack; print(lightspeed_stack.__file__)")))
15-
1610
USER 1001
1711

1812
EXPOSE 8080

lightspeed-stack

scripts/query.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ if [[ -n "$CONVERSATION_ID" ]]; then
218218
else
219219
# Only select model for new conversations
220220
echo "Selecting model for new conversation..."
221+
222+
if ! get_ocm_token; then
223+
echo "Failed to get OCM token for query"
224+
return 1
225+
fi
226+
221227
MODELS=$(get_available_models)
222228
model_selection=$(select_model "$MODELS")
223229
MODEL_NAME=$(echo "$model_selection" | cut -d'|' -f1)

template.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,40 @@ objects:
165165
jwt_configuration:
166166
user_id_claim: ${USER_ID_CLAIM}
167167
username_claim: ${USERNAME_CLAIM}
168+
role_rules:
169+
- jsonpath: "$.realm_access.roles[*]"
170+
operator: "contains"
171+
value: "redhat:employees"
172+
roles: ["redhat_employee"]
173+
authorization:
174+
access_rules:
175+
- role: redhat_employee
176+
actions:
177+
- get_models
178+
# Temporarily we only want redhat employees to be able to use the service,
179+
# uncomment when we want to allow all authenticated users
180+
# - role: "*"
181+
# actions:
182+
- query
183+
- streaming_query
184+
- get_conversation
185+
- list_conversations
186+
- delete_conversation
187+
- feedback
188+
- get_metrics
189+
- info
190+
# "nobody" is a made up role, doesn't do anything but just good for being explicit
191+
# about what is not allowed by anyone
192+
- role: nobody
193+
actions:
194+
# This exposes the database password - once LSC fixes this issue we
195+
# can allow this for employees
196+
- get_config
197+
# For now we don't want to let even administrators / employees access other users conversations
198+
- query_other_conversations
199+
- delete_other_conversations
200+
- list_other_conversations
201+
- read_other_conversations
168202
mcp_servers:
169203
- name: mcp::assisted
170204
url: "${MCP_SERVER_URL}"

0 commit comments

Comments
 (0)