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
13 changes: 13 additions & 0 deletions application/single_app/admin_settings_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4024,6 +4024,19 @@
"default": False,
"depends_on": {"key": "allow_user_workflows", "equals": True},
},
{
"key": "enable_workflow_ai_assistant",
"type": "switch",
"label": "Enable AI Workflow Assistant",
"help": (
"Users can describe a change in plain language and review the "
"assistant's proposed edit in the V2 workflow editor before they "
"save it. The assistant never saves, runs or shares a workflow, "
"and it only uses documents the user can already open."
),
"default": True,
"depends_on": {"key": "allow_user_workflows", "equals": True},
},
{
"key": "allow_group_workflows",
"type": "switch",
Expand Down
2 changes: 1 addition & 1 deletion application/single_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
EXECUTOR_TYPE = 'thread'
EXECUTOR_MAX_WORKERS = 30
SESSION_TYPE = 'filesystem'
VERSION = "0.261.207"
VERSION = "0.261.208"
IS_DEVELOPMENT = is_development_env_enabled()

# Opt-out for deployments where App Service Easy Auth is active but the platform
Expand Down
25 changes: 25 additions & 0 deletions application/single_app/functions_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,14 @@
return True


def is_workflow_assistant_enabled_for_user(settings, user_roles=None):

Check warning on line 1163 in application/single_app/functions_settings.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
"""Return True when the AI workflow assistant is on and personal workflows are available to the user."""
source_settings = settings or {}
if not is_user_workflows_enabled_for_user(source_settings, user_roles=user_roles):

Check warning on line 1166 in application/single_app/functions_settings.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
return False
return source_settings.get('enable_workflow_ai_assistant', False) is True


def _authorize_user_settings_access(user_id, operation, allow_cross_user=False):
"""Authorize user-settings access for the current request context."""
normalized_user_id = str(user_id or '').strip()
Expand Down Expand Up @@ -1439,6 +1447,8 @@
'allow_user_plugins': False,
'allow_user_workflows': False,
'require_member_of_workflow_user': False,
# The AI workflow assistant in the V2 editor. It only applies where personal workflows do.
'enable_workflow_ai_assistant': True,
'workflow_max_tasks': 50,
'workflow_max_loop_items': WORKFLOW_LOOP_ITEMS_DEFAULT,
'workflow_max_repeat_iterations': WORKFLOW_REPEAT_ITERATIONS_DEFAULT,
Expand Down Expand Up @@ -3865,6 +3875,21 @@
return wrapper


def workflow_assistant_required(f):
"""Allow the route only when the AI workflow assistant is available to the signed-in user."""
@wraps(f)
def wrapper(*args, **kwargs):
settings = get_settings()

Check warning on line 3882 in application/single_app/functions_settings.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.
user_roles = (session.get('user') or {}).get('roles', [])

Check warning on line 3883 in application/single_app/functions_settings.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
if is_workflow_assistant_enabled_for_user(settings, user_roles=user_roles):

Check warning on line 3884 in application/single_app/functions_settings.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
return f(*args, **kwargs)
return jsonify({
'error': 'The AI workflow assistant is not available.',
'code': 'workflow_assistant_disabled',

Check warning on line 3888 in application/single_app/functions_settings.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
}), 403
return wrapper


def enabled_required(setting_key):
def decorator(f):
@wraps(f)
Expand Down
Loading
Loading