diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..9cdc9f6ac5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +All notable changes to Dify will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.15.6] - 2025-04-22 + +### Security + +- Fixed clickjacking vulnerability (#18552) +- Fixed reset password security issue (#18366) +- Updated reset password token when email code verification succeeds (#18362) + +### Fixed + +- Fixed Vertex AI Gemini 2.0 Flash 001 schema (#18405) diff --git a/api/.env.example b/api/.env.example index 95da531a1d..4f973737c9 100644 --- a/api/.env.example +++ b/api/.env.example @@ -430,4 +430,7 @@ CREATE_TIDB_SERVICE_JOB_ENABLED=false # Maximum number of submitted thread count in a ThreadPool for parallel node execution MAX_SUBMIT_COUNT=100 # Lockout duration in seconds -LOGIN_LOCKOUT_DURATION=86400 \ No newline at end of file +LOGIN_LOCKOUT_DURATION=86400 + +# Prevent Clickjacking +ALLOW_EMBED=false \ No newline at end of file diff --git a/api/configs/packaging/__init__.py b/api/configs/packaging/__init__.py index 25792cb84a..00918242b3 100644 --- a/api/configs/packaging/__init__.py +++ b/api/configs/packaging/__init__.py @@ -9,7 +9,7 @@ class PackagingInfo(BaseSettings): CURRENT_VERSION: str = Field( description="Dify version", - default="0.15.4", + default="0.15.6", ) COMMIT_SHA: str = Field( diff --git a/api/core/model_runtime/model_providers/google/google.py b/api/core/model_runtime/model_providers/google/google.py index 70f56a8337..88ea50ea2b 100644 --- a/api/core/model_runtime/model_providers/google/google.py +++ b/api/core/model_runtime/model_providers/google/google.py @@ -19,8 +19,8 @@ class GoogleProvider(ModelProvider): try: model_instance = self.get_model_instance(ModelType.LLM) - # Use `gemini-pro` model for validate, - model_instance.validate_credentials(model="gemini-pro", credentials=credentials) + # Use `gemini-2.0-flash` model for validate, + model_instance.validate_credentials(model="gemini-2.0-flash", credentials=credentials) except CredentialsValidateFailedError as ex: raise ex except Exception as ex: diff --git a/api/core/model_runtime/model_providers/google/llm/_position.yaml b/api/core/model_runtime/model_providers/google/llm/_position.yaml index 07ede384b0..4c7c4151f1 100644 --- a/api/core/model_runtime/model_providers/google/llm/_position.yaml +++ b/api/core/model_runtime/model_providers/google/llm/_position.yaml @@ -19,5 +19,3 @@ - gemini-exp-1206 - gemini-exp-1121 - gemini-exp-1114 -- gemini-pro -- gemini-pro-vision diff --git a/api/core/model_runtime/model_providers/google/llm/gemini-pro-vision.yaml b/api/core/model_runtime/model_providers/google/llm/gemini-pro-vision.yaml deleted file mode 100644 index 5b589745d7..0000000000 --- a/api/core/model_runtime/model_providers/google/llm/gemini-pro-vision.yaml +++ /dev/null @@ -1,35 +0,0 @@ -model: gemini-pro-vision -label: - en_US: Gemini Pro Vision -model_type: llm -features: - - vision -model_properties: - mode: chat - context_size: 12288 -parameter_rules: - - name: temperature - use_template: temperature - - name: top_p - use_template: top_p - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - help: - zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 - en_US: Only sample from the top K options for each subsequent token. - required: false - - name: max_tokens_to_sample - use_template: max_tokens - required: true - default: 4096 - min: 1 - max: 4096 -pricing: - input: '0.00' - output: '0.00' - unit: '0.000001' - currency: USD -deprecated: true diff --git a/api/core/model_runtime/model_providers/google/llm/gemini-pro.yaml b/api/core/model_runtime/model_providers/google/llm/gemini-pro.yaml deleted file mode 100644 index f05fec8c5d..0000000000 --- a/api/core/model_runtime/model_providers/google/llm/gemini-pro.yaml +++ /dev/null @@ -1,39 +0,0 @@ -model: gemini-pro -label: - en_US: Gemini Pro -model_type: llm -features: - - agent-thought - - tool-call - - stream-tool-call -model_properties: - mode: chat - context_size: 30720 -parameter_rules: - - name: temperature - use_template: temperature - - name: top_p - use_template: top_p - - name: top_k - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - help: - zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 - en_US: Only sample from the top K options for each subsequent token. - required: false - - name: max_tokens_to_sample - use_template: max_tokens - required: true - default: 2048 - min: 1 - max: 2048 - - name: response_format - use_template: response_format -pricing: - input: '0.00' - output: '0.00' - unit: '0.000001' - currency: USD -deprecated: true diff --git a/api/core/model_runtime/model_providers/vertex_ai/llm/gemini-2.0-flash-001.yaml b/api/core/model_runtime/model_providers/vertex_ai/llm/gemini-2.0-flash-001.yaml index bef7ca5eef..494f5aa68e 100644 --- a/api/core/model_runtime/model_providers/vertex_ai/llm/gemini-2.0-flash-001.yaml +++ b/api/core/model_runtime/model_providers/vertex_ai/llm/gemini-2.0-flash-001.yaml @@ -5,11 +5,6 @@ model_type: llm features: - agent-thought - vision - - tool-call - - stream-tool-call - - document - - video - - audio model_properties: mode: chat context_size: 1048576 @@ -20,20 +15,21 @@ parameter_rules: use_template: top_p - name: top_k label: - zh_Hans: 取样数量 en_US: Top k type: int help: - zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 en_US: Only sample from the top K options for each subsequent token. required: false + - name: presence_penalty + use_template: presence_penalty + - name: frequency_penalty + use_template: frequency_penalty - name: max_output_tokens use_template: max_tokens + required: true default: 8192 min: 1 max: 8192 - - name: json_schema - use_template: json_schema pricing: input: '0.00' output: '0.00' diff --git a/docker/.env.example b/docker/.env.example index b21bdc7085..0faf9a337d 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -932,3 +932,6 @@ MAX_SUBMIT_COUNT=100 # The maximum number of top-k value for RAG. TOP_K_MAX_VALUE=10 + +# Prevent Clickjacking +ALLOW_EMBED=false \ No newline at end of file diff --git a/docker/docker-compose-template.yaml b/docker/docker-compose-template.yaml index bca0e1814a..d760ac679d 100644 --- a/docker/docker-compose-template.yaml +++ b/docker/docker-compose-template.yaml @@ -1,8 +1,8 @@ -x-shared-env: &shared-api-worker-env +x-shared-env: &shared-api-worker-env services: # API service api: - image: langgenius/dify-api:0.15.4 + image: langgenius/dify-api:0.15.6 restart: always environment: # Use the shared environment variables. @@ -25,7 +25,7 @@ services: # worker service # The Celery worker for processing the queue. worker: - image: langgenius/dify-api:0.15.4 + image: langgenius/dify-api:0.15.6 restart: always environment: # Use the shared environment variables. @@ -47,7 +47,7 @@ services: # Frontend web application. web: - image: langgenius/dify-web:0.15.4 + image: langgenius/dify-web:0.15.6 restart: always environment: CONSOLE_API_URL: ${CONSOLE_API_URL:-} @@ -56,6 +56,7 @@ services: NEXT_TELEMETRY_DISABLED: ${NEXT_TELEMETRY_DISABLED:-0} TEXT_GENERATION_TIMEOUT_MS: ${TEXT_GENERATION_TIMEOUT_MS:-60000} CSP_WHITELIST: ${CSP_WHITELIST:-} + ALLOW_EMBED: ${ALLOW_EMBED:-false} TOP_K_MAX_VALUE: ${TOP_K_MAX_VALUE:-} INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: ${INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH:-} diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index e47519e4d9..a37527f8b6 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -389,11 +389,12 @@ x-shared-env: &shared-api-worker-env CREATE_TIDB_SERVICE_JOB_ENABLED: ${CREATE_TIDB_SERVICE_JOB_ENABLED:-false} MAX_SUBMIT_COUNT: ${MAX_SUBMIT_COUNT:-100} TOP_K_MAX_VALUE: ${TOP_K_MAX_VALUE:-10} + ALLOW_EMBED: ${ALLOW_EMBED:-false} services: # API service api: - image: langgenius/dify-api:0.15.4 + image: langgenius/dify-api:0.15.6 restart: always environment: # Use the shared environment variables. @@ -416,7 +417,7 @@ services: # worker service # The Celery worker for processing the queue. worker: - image: langgenius/dify-api:0.15.4 + image: langgenius/dify-api:0.15.6 restart: always environment: # Use the shared environment variables. @@ -438,7 +439,7 @@ services: # Frontend web application. web: - image: langgenius/dify-web:0.15.4 + image: langgenius/dify-web:0.15.6 restart: always environment: CONSOLE_API_URL: ${CONSOLE_API_URL:-} @@ -447,6 +448,7 @@ services: NEXT_TELEMETRY_DISABLED: ${NEXT_TELEMETRY_DISABLED:-0} TEXT_GENERATION_TIMEOUT_MS: ${TEXT_GENERATION_TIMEOUT_MS:-60000} CSP_WHITELIST: ${CSP_WHITELIST:-} + ALLOW_EMBED: ${ALLOW_EMBED:-false} TOP_K_MAX_VALUE: ${TOP_K_MAX_VALUE:-} INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: ${INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH:-} diff --git a/web/.env.example b/web/.env.example index e2117ddfd8..7ddf600624 100644 --- a/web/.env.example +++ b/web/.env.example @@ -31,3 +31,6 @@ NEXT_PUBLIC_TOP_K_MAX_VALUE=10 # The maximum number of tokens for segmentation NEXT_PUBLIC_INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=4000 + +# Default is not allow to embed into iframe to prevent Clickjacking: https://owasp.org/www-community/attacks/Clickjacking +NEXT_PUBLIC_ALLOW_EMBED= diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index b71a3c3fdf..5d363b421a 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -24,7 +24,7 @@ const OPTION_MAP = { iframe: { getContent: (url: string, token: string) => `