Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/single_app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore

.env.*

Check warning on line 198 in application/single_app/.gitignore

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.

deploy.zip
12 changes: 12 additions & 0 deletions application/single_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from functions_authentication import *
from functions_content import *
from functions_documents import *
from functions_latest_features_nav import should_hide_latest_features_nav
from functions_search import *
from functions_settings import *
from functions_appinsights import *
Expand Down Expand Up @@ -115,6 +116,7 @@
executor.init_app(app)
app.config['SESSION_TYPE'] = SESSION_TYPE
app.config['VERSION'] = VERSION
app.config['IS_DEVELOPMENT'] = IS_DEVELOPMENT
app.config['SECRET_KEY'] = SECRET_KEY
app.config['SESSION_COOKIE_SAMESITE'] = SESSION_COOKIE_SAMESITE
app.config['SESSION_COOKIE_HTTPONLY'] = SESSION_COOKIE_HTTPONLY
Expand Down Expand Up @@ -572,19 +574,29 @@
log_event(f"[CustomPages] Error injecting custom page navigation: {e}", level=logging.ERROR, exceptionTraceback=True)
# Inject per-user settings if logged in
user_settings = {}
latest_features_nav_hidden = IS_DEVELOPMENT

Check warning on line 577 in application/single_app/app.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.
try:
user_id = get_current_user_id()
if user_id:
from functions_settings import get_user_ui_settings
user_settings = get_user_ui_settings(user_id) or {}
latest_features_nav_hidden = should_hide_latest_features_nav(

Check warning on line 583 in application/single_app/app.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.
user_settings,
VERSION,
is_development=IS_DEVELOPMENT
)
except Exception as e:
print(f"Error injecting user settings: {e}")
log_event(f"Error injecting user settings: {e}", level=logging.ERROR)
user_settings = {}
latest_features_nav_hidden = IS_DEVELOPMENT

Check warning on line 592 in application/single_app/app.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.
return dict(
app_settings=public_settings,
user_settings=user_settings,
custom_pages_nav=custom_pages_nav,
latest_features_current_version=VERSION,
latest_features_nav_hidden=latest_features_nav_hidden,

Check warning on line 598 in application/single_app/app.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.
latest_features_nav_hidden_by_development=IS_DEVELOPMENT,

Check warning on line 599 in application/single_app/app.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.
idle_timeout_enabled=idle_timeout_enabled,
idle_timeout_minutes=idle_timeout_minutes,
idle_warning_minutes=idle_warning_minutes
Expand Down
4 changes: 3 additions & 1 deletion application/single_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import glob
import jwt
import pandas
from functions_latest_features_nav import is_development_env_enabled

# Add dotenv import
from dotenv import load_dotenv
Expand Down Expand Up @@ -96,7 +97,8 @@
EXECUTOR_TYPE = 'thread'
EXECUTOR_MAX_WORKERS = 30
SESSION_TYPE = 'filesystem'
VERSION = "0.250.057"
VERSION = "0.250.059"
IS_DEVELOPMENT = is_development_env_enabled()

SESSION_COOKIE_SAMESITE = os.getenv('SESSION_COOKIE_SAMESITE', 'Lax')
SESSION_COOKIE_HTTPONLY = os.getenv('SESSION_COOKIE_HTTPONLY', 'true').lower() != 'false'
Expand Down
50 changes: 50 additions & 0 deletions application/single_app/functions_latest_features_nav.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# functions_latest_features_nav.py

import os


LATEST_FEATURES_HIDDEN_VERSION_SETTING = "latestFeaturesHiddenVersion"

Check warning on line 6 in application/single_app/functions_latest_features_nav.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.


def is_development_env_enabled(value=None):
"""Return True only when the development env flag is explicitly true."""
raw_value = os.getenv("is_development", "") if value is None else value
return str(raw_value or "").strip().lower() == "true"


def normalize_latest_features_hidden_version(value):

Check warning on line 15 in application/single_app/functions_latest_features_nav.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.
"""Normalize a hidden-version setting value for storage and comparison."""

Check warning on line 16 in application/single_app/functions_latest_features_nav.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Moderate - Changed line contains obfuscation, dynamic loading, or hidden payload marker. Recommendation%3A Confirm the changed code is not hiding behavior, decoding payloads, or bypassing normal review.

Check warning on line 16 in application/single_app/functions_latest_features_nav.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
if value is None:
return None

normalized_value = str(value).strip()
return normalized_value or None


def extract_latest_features_hidden_version(user_settings_payload):
"""Extract the hidden-version value from either a settings dict or user settings document."""
if not isinstance(user_settings_payload, dict):
return None

settings = user_settings_payload.get("settings")
if isinstance(settings, dict):
return normalize_latest_features_hidden_version(
settings.get(LATEST_FEATURES_HIDDEN_VERSION_SETTING)
)

return normalize_latest_features_hidden_version(
user_settings_payload.get(LATEST_FEATURES_HIDDEN_VERSION_SETTING)
)


def should_hide_latest_features_nav(user_settings_payload, current_version, is_development=False):
"""Determine whether Latest Features nav entries should be hidden."""
if bool(is_development):
return True

normalized_current_version = normalize_latest_features_hidden_version(current_version)
if not normalized_current_version:
return False

hidden_version = extract_latest_features_hidden_version(user_settings_payload)
return hidden_version == normalized_current_version
2 changes: 2 additions & 0 deletions application/single_app/functions_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from functions_cosmos_throughput import get_default_cosmos_throughput_settings
from functions_document_actions import get_default_document_action_capabilities
from functions_icon_utils import normalize_icon_payload
from functions_latest_features_nav import LATEST_FEATURES_HIDDEN_VERSION_SETTING
from functions_service_health import get_default_service_health
import app_settings_cache
import inspect
Expand All @@ -33,6 +34,7 @@
"notifications_per_page",
"sidebarToggleStyle",
"sidebarMenuState",
LATEST_FEATURES_HIDDEN_VERSION_SETTING,
)
ADMIN_SETTINGS_SECRET_REDACTED_VALUE = "***REDACTED***"
ADMIN_SETTINGS_FORM_SECRET_FIELDS = (
Expand Down
13 changes: 13 additions & 0 deletions application/single_app/route_backend_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
get_user_role_in_group,
update_active_group_for_user,
)
from functions_latest_features_nav import (
LATEST_FEATURES_HIDDEN_VERSION_SETTING,
normalize_latest_features_hidden_version,
)
from functions_public_workspaces import update_active_public_workspace_for_user
from functions_settings import *
from swagger_wrapper import swagger_route, get_auth_security
Expand Down Expand Up @@ -503,6 +507,7 @@ def user_settings():
'navbar_layout', 'chatLayout', 'showChatTitle', 'chatSplitSizes',
'deepResearchDefaultEnabled',
'sidebarToggleStyle', 'sidebarMenuState',
LATEST_FEATURES_HIDDEN_VERSION_SETTING,
# Microphone permission settings
'microphonePermissionPreference', 'microphonePermissionState',
# Text-to-speech settings
Expand Down Expand Up @@ -557,6 +562,14 @@ def user_settings():

settings_to_update["sidebarMenuState"] = normalized_sidebar_menu_state

if LATEST_FEATURES_HIDDEN_VERSION_SETTING in settings_to_update:
hidden_version = normalize_latest_features_hidden_version(
settings_to_update.get(LATEST_FEATURES_HIDDEN_VERSION_SETTING)
)
if hidden_version is not None and hidden_version != VERSION:
return jsonify({"error": "Invalid Latest Features hidden version"}), 400
settings_to_update[LATEST_FEATURES_HIDDEN_VERSION_SETTING] = hidden_version

active_group_updated = False
active_public_workspace_updated = False

Expand Down
Loading
Loading