Skip to content

Commit 8f4ef13

Browse files
paullizerclarked-msftBionic711
authored
Development to Staging - v0.237.003 (#655)
* updated the logging logic when running retention delete with archiving enabled (#642) * Corrected version to 0.236.011 (#645) * v0.237.001 (#649) * Use Microsoft python base image * Add python ENV vars * Add python ENV vars * Install deps to systme * Add temp dir to image and pip conf support * Add custom-ca-certificates dir * Logo bug fix (#654) * release note updating for github coplilot * fixed logo bug issue * added 2,3,4,5,6,14 days to rentention policy * added retention policy time updates --------- Co-authored-by: Ed Clark <clarked@microsoft.com> Co-authored-by: Bionic711 <13358952+Bionic711@users.noreply.github.com>
1 parent 42a7673 commit 8f4ef13

28 files changed

Lines changed: 521 additions & 1801 deletions
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
applyTo: '**'
3+
---
4+
5+
# Release Notes Update Instructions
6+
7+
## When to Update Release Notes
8+
9+
After completing a code change (bug fix, new feature, enhancement, or breaking change), always ask the user:
10+
11+
**"Would you like me to update the release notes in `docs/explanation/release_notes.md`?"**
12+
13+
## If the User Confirms Yes
14+
15+
Update the release notes file following these guidelines:
16+
17+
### 1. Location
18+
Release notes are located at: `docs/explanation/release_notes.md`
19+
20+
### 2. Version Placement
21+
- Add new entries under the **current version** from `config.py`
22+
- If the version has changed, create a new version section at the TOP of the file
23+
- Format: `### **(vX.XXX.XXX)**`
24+
25+
### 3. Entry Categories
26+
27+
Organize entries under the appropriate category:
28+
29+
#### New Features
30+
```markdown
31+
#### New Features
32+
33+
* **Feature Name**
34+
* Brief description of what the feature does and its benefits.
35+
* Additional details about functionality or configuration.
36+
* (Ref: relevant files, components, or concepts)
37+
```
38+
39+
#### Bug Fixes
40+
```markdown
41+
#### Bug Fixes
42+
43+
* **Fix Name**
44+
* Description of what was broken and how it was fixed.
45+
* Impact or affected areas.
46+
* (Ref: relevant files, functions, or components)
47+
```
48+
49+
#### User Interface Enhancements
50+
```markdown
51+
#### User Interface Enhancements
52+
53+
* **Enhancement Name**
54+
* Description of UI/UX improvements.
55+
* (Ref: relevant templates, CSS, or JavaScript files)
56+
```
57+
58+
#### Breaking Changes
59+
```markdown
60+
#### Breaking Changes
61+
62+
* **Change Name**
63+
* Description of what changed and why.
64+
* **Migration**: Steps users need to take (if any).
65+
```
66+
67+
### 4. Entry Format Guidelines
68+
69+
- **Bold the title** of each entry
70+
- Use bullet points for details
71+
- Include a `(Ref: ...)` line with relevant file names, functions, or concepts
72+
- Keep descriptions concise but informative
73+
- Focus on user-facing impact, not implementation details
74+
75+
### 5. Example Entry
76+
77+
```markdown
78+
* **Custom Logo Display Fix**
79+
* Fixed issue where custom logos uploaded via Admin Settings would only display on the admin page but not on other pages (chat, sidebar, landing page).
80+
* Root cause was overly aggressive sanitization removing logo URLs from public settings.
81+
* (Ref: logo display, settings sanitization, template conditionals)
82+
```
83+
84+
### 6. Checklist Before Updating
85+
86+
- [ ] Confirm the current version in `config.py`
87+
- [ ] Determine the correct category (New Feature, Bug Fix, Enhancement, Breaking Change)
88+
- [ ] Write a clear, user-focused description
89+
- [ ] Include relevant file/component references
90+
- [ ] Place entry under the correct version section

application/single_app/Dockerfile

Lines changed: 53 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,72 @@
1-
# Stage 1: System dependencies and ODBC driver install
2-
ARG PYTHON_MAJOR_VERSION_ARG="3"
3-
ARG PYTHON_MINOR_VERSION_ARG="13"
4-
ARG PYTHON_PATCH_VERSION_ARG="11"
5-
FROM debian:12-slim AS builder
1+
# Create nonroot user/group with a stable UID/GID (choose values consistent with your org)
2+
ARG UID=65532
3+
ARG GID=65532
64

7-
ARG PYTHON_MAJOR_VERSION_ARG
8-
ARG PYTHON_MINOR_VERSION_ARG
9-
ARG PYTHON_PATCH_VERSION_ARG
5+
FROM mcr.microsoft.com/azurelinux/base/python:3.12 AS builder
6+
7+
ARG UID
8+
ARG GID
9+
10+
# Setup pip.conf if has content
11+
COPY pip.conf.d/ /etc/pip.conf.d
12+
13+
# CA
14+
# copy certs to /etc/pki/ca-trust/source/anchors
15+
COPY custom-ca-certificates/ /etc/ssl/certs
16+
RUN mkdir -p /etc/pki/ca-trust/source/anchors/ \
17+
&& update-ca-trust enable \
18+
&& cp /etc/ssl/certs/*.crt /etc/pki/ca-trust/source/anchors/ \
19+
&& update-ca-trust extract
20+
21+
ENV PYTHONUNBUFFERED=1
22+
23+
RUN set -eux; \
24+
echo "nonroot:x:${GID}:" >> /etc/group; \
25+
echo "nonroot:x:${UID}:${GID}:nonroot:/home/nonroot:/bin/bash" >> /etc/passwd; \
26+
mkdir -p /home/nonroot; \
27+
chown ${UID}:${GID} /home/nonroot; \
28+
mkdir -p /app; \
29+
chown ${UID}:${GID} /app; \
30+
chmod 744 /app
31+
32+
RUN mkdir -p /app/flask_session && chown -R ${UID}:${GID} /app/flask_session
33+
RUN mkdir /sc-temp-files && chown -R ${UID}:${GID} /sc-temp-files
1034

11-
ENV DEBIAN_FRONTEND=noninteractive \
12-
PYTHONIOENCODING=utf-8 \
13-
LANG=C.UTF-8 \
14-
LC_ALL=C.UTF-8
15-
16-
# Build deps for CPython and pip stdlib modules
17-
WORKDIR /deps
18-
RUN apt-get update && apt-get install -y --no-install-recommends \
19-
build-essential \
20-
wget ca-certificates \
21-
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
22-
libncursesw5-dev libffi-dev liblzma-dev uuid-dev tk-dev && \
23-
rm -rf /var/lib/apt/lists/*
24-
25-
# Build and install Python from source
26-
# Example: https://www.python.org/ftp/python/3.13.11/Python-3.13.11.tgz
27-
WORKDIR /tmp
28-
RUN wget https://www.python.org/ftp/python/${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG}.${PYTHON_PATCH_VERSION_ARG}/Python-${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG}.${PYTHON_PATCH_VERSION_ARG}.tgz && \
29-
tar -xzf Python-${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG}.${PYTHON_PATCH_VERSION_ARG}.tgz && \
30-
cd Python-${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG}.${PYTHON_PATCH_VERSION_ARG} && \
31-
LDFLAGS="-Wl,-rpath,/usr/local/lib" ./configure --enable-optimizations --enable-shared --with-ensurepip=install --prefix=/usr/local && \
32-
make -j"$(nproc)" && \
33-
make altinstall
34-
35-
USER root
3635
WORKDIR /app
37-
RUN groupadd -g 65532 nonroot && useradd -m -u 65532 -g nonroot nonroot
3836

39-
RUN python${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG} -m venv /app/venv
40-
RUN python${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG} -m pip install wheel
37+
# Copy requirements and install them to system
38+
COPY --chown=${UID}:${GID} application/single_app/requirements.txt .
39+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
4140

42-
# Copy requirements and install them into the virtualenv
43-
ENV PATH="/app/venv/bin:$PATH"
44-
COPY application/single_app/requirements.txt /app/requirements.txt
45-
RUN python${PYTHON_MAJOR_VERSION_ARG}.${PYTHON_MINOR_VERSION_ARG} -m pip install --no-cache-dir -r /app/requirements.txt
41+
FROM mcr.microsoft.com/azurelinux/distroless/python:3.12
4642

47-
# Fix permissions so nonroot can use everything
48-
RUN chown -R 65532:65532 /app
43+
ARG UID
44+
ARG GID
4945

50-
RUN mkdir -p /app/flask_session && chown -R 65532:65532 /app/flask_session
51-
RUN mkdir /sc-temp-files && chown -R 65532:65532 /sc-temp-files
52-
USER 65532:65532
46+
COPY --from=builder /etc/pki /etc/pki
47+
COPY --from=builder /home/nonroot /home/nonroot
48+
COPY --from=builder /etc/passwd /etc/passwd
49+
COPY --from=builder /etc/group /etc/group
50+
COPY --from=builder /usr/lib/python3.12 /usr/lib/python3.12
5351

54-
#Stage 2: Final containter
55-
FROM gcr.io/distroless/base-debian12:latest
56-
ARG PYTHON_MAJOR_VERSION_ARG
57-
ARG PYTHON_MINOR_VERSION_ARG
58-
ARG PYTHON_PATCH_VERSION_ARG
52+
USER ${UID}:${GID}
5953

60-
ENV PYTHONIOENCODING=utf-8 \
54+
COPY --from=builder --chown=${UID}:${GID} /app /app
55+
COPY --from=builder --chown=${UID}:${GID} /sc-temp-files /sc-temp-files
56+
57+
ENV HOME=/home/nonroot \
58+
PATH="/home/nonroot/.local/bin:$PATH" \
59+
PYTHONIOENCODING=utf-8 \
6160
LANG=C.UTF-8 \
6261
LC_ALL=C.UTF-8 \
63-
PYTHONUNBUFFERED=1 \
64-
PATH="/app/venv/bin:/usr/local/bin:$PATH" \
65-
LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
62+
PYTHONUNBUFFERED=1
6663

6764
WORKDIR /app
6865

69-
USER root
70-
71-
# Copy only the built Python interpreter (venv entrypoint handles python/python3)
72-
# Copy the full CPython installation so stdlib modules (e.g., encodings) are available
73-
COPY --from=builder /usr/local/ /usr/local/
74-
75-
# Copy system libraries for x86_64
76-
COPY --from=builder /lib/x86_64-linux-gnu/ \
77-
/lib64/ld-linux-x86-64.so.2 \
78-
/usr/lib/x86_64-linux-gnu/
79-
#/usr/share/ca-certificates \
80-
#/etc/ssl/certs \
81-
#/usr/bin/ffmpeg \
82-
#/usr/share/zoneinfo /usr/share/
83-
8466
# Copy application code and set ownership
85-
COPY --chown=65532:65532 application/single_app/ /app/
86-
87-
# Copy the virtualenv from the builder stage
88-
COPY --from=builder --chown=65532:65532 /app/venv /app/venv
89-
COPY --from=builder --chown=65532:65532 /app/flask_session /app/flask_session
90-
COPY --from=builder --chown=65532:65532 /sc-temp-files /sc-temp-files
67+
COPY --chown=${UID}:${GID} application/single_app ./
9168

9269
# Expose port
9370
EXPOSE 5000
9471

95-
USER 65532:65532
96-
97-
98-
ENTRYPOINT ["/app/venv/bin/python", "-c", "import runpy; runpy.run_path('/app/app.py', run_name='__main__')"]
72+
ENTRYPOINT [ "python3", "/app/app.py" ]

application/single_app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
EXECUTOR_TYPE = 'thread'
8989
EXECUTOR_MAX_WORKERS = 30
9090
SESSION_TYPE = 'filesystem'
91-
VERSION = "0.237.001"
91+
VERSION = "0.237.003"
9292

9393

9494
SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production')

application/single_app/functions_settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,15 @@ def sanitize_settings_for_user(full_settings: dict) -> dict:
794794
else:
795795
sanitized[k] = v
796796

797+
# Add boolean flags for logo/favicon existence so templates can check without exposing base64 data
798+
# These fields are stripped by the base64 filter above, but templates need to know if logos exist
799+
if 'custom_logo_base64' in full_settings:
800+
sanitized['custom_logo_base64'] = bool(full_settings.get('custom_logo_base64'))
801+
if 'custom_logo_dark_base64' in full_settings:
802+
sanitized['custom_logo_dark_base64'] = bool(full_settings.get('custom_logo_dark_base64'))
803+
if 'custom_favicon_base64' in full_settings:
804+
sanitized['custom_favicon_base64'] = bool(full_settings.get('custom_favicon_base64'))
805+
797806
return sanitized
798807

799808
def sanitize_settings_for_logging(full_settings: dict) -> dict:
172 Bytes
Loading
-302 Bytes
Loading
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)