Compare commits

...

4 Commits

Author SHA1 Message Date
NFish
d760862e8d chore: update React type definitions in resolutions and overrides
Some checks failed
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
- Update resolutions @types/react from ~19.2.1 to ~19.2.7
- Update resolutions @types/react-dom from ~19.2.1 to ~19.2.3
- Update overrides @types/react from 19.0.11 to 19.2.7
- Update overrides @types/react-dom from 19.0.4 to 19.2.3
- Remove old React 18 type definitions from pnpm-lock.yaml
- Ensure all dependencies use React 19.2.7 type definitions
2025-12-08 16:19:33 +08:00
NFish
8899c717fa chore: upgrade dependencies to latest versions
Some checks failed
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
- Upgrade Next.js from 15.2.4 to 15.5.7
- Upgrade React from 19.0.0 to 19.2.1
- Upgrade React DOM from 19.0.0 to 19.2.1
- Update @types/react from 19.0.11 to ~19.2.7
- Update @types/react-dom from 19.0.4 to ~19.2.3
- Update @next/eslint-plugin-next to ^15.5.7
- Update eslint-config-next to ^15.5.7
- Update resolutions to use React 19.2.1 type definitions
- Sync pnpm-lock.yaml with updated dependencies
2025-12-08 16:14:46 +08:00
GareArc
ef2c8cd3f3 feat(workflow): add support for release/e-* tag in build-push workflow 2025-08-05 16:18:56 +08:00
GareArc
f6272dbb88 feat: enhance app access control by implementing batch permission checks for installed apps 2025-08-05 16:11:49 +08:00
5 changed files with 1676 additions and 713 deletions

View File

@@ -6,6 +6,8 @@ on:
- "main"
- "deploy/dev"
- "deploy/enterprise"
- "build/**"
- "release/e-*"
tags:
- "*"

View File

@@ -58,21 +58,38 @@ class InstalledAppsListApi(Resource):
# filter out apps that user doesn't have access to
if FeatureService.get_system_features().webapp_auth.enabled:
user_id = current_user.id
res = []
app_ids = [installed_app["app"].id for installed_app in installed_app_list]
webapp_settings = EnterpriseService.WebAppAuth.batch_get_app_access_mode_by_id(app_ids)
# Pre-filter out apps without setting or with sso_verified
filtered_installed_apps = []
app_id_to_app_code = {}
for installed_app in installed_app_list:
webapp_setting = webapp_settings.get(installed_app["app"].id)
if not webapp_setting:
app_id = installed_app["app"].id
webapp_setting = webapp_settings.get(app_id)
if not webapp_setting or webapp_setting.access_mode == "sso_verified":
continue
if webapp_setting.access_mode == "sso_verified":
continue
app_code = AppService.get_app_code_by_id(str(installed_app["app"].id))
if EnterpriseService.WebAppAuth.is_user_allowed_to_access_webapp(
app_code = AppService.get_app_code_by_id(str(app_id))
app_id_to_app_code[app_id] = app_code
filtered_installed_apps.append(installed_app)
app_codes = list(app_id_to_app_code.values())
# Batch permission check
permissions = EnterpriseService.WebAppAuth.batch_is_user_allowed_to_access_webapps(
user_id=user_id,
app_code=app_code,
):
app_codes=app_codes,
)
# Keep only allowed apps
res = []
for installed_app in filtered_installed_apps:
app_id = installed_app["app"].id
app_code = app_id_to_app_code[app_id]
if permissions.get(app_code):
res.append(installed_app)
installed_app_list = res
logger.debug(f"installed_app_list: {installed_app_list}, user_id: {user_id}")

View File

@@ -52,6 +52,16 @@ class EnterpriseService:
return data.get("result", False)
@classmethod
def batch_is_user_allowed_to_access_webapps(cls, user_id: str, app_codes: list[str]):
if not app_codes:
return {}
body = {"userId": user_id, "appCodes": app_codes}
data = EnterpriseRequest.send_request("POST", "/webapp/permission/batch", json=body)
if not data:
raise ValueError("No data found.")
return data.get("permissions", {})
@classmethod
def get_app_access_mode_by_id(cls, app_id: str) -> WebAppSettings:
if not app_id:

View File

@@ -103,14 +103,14 @@
"mime": "^4.0.4",
"mitt": "^3.0.1",
"negotiator": "^0.6.3",
"next": "15.2.4",
"next": "15.5.7",
"next-themes": "^0.4.3",
"pinyin-pro": "^3.25.0",
"qrcode.react": "^4.2.0",
"qs": "^6.13.0",
"react": "19.0.0",
"react": "19.2.1",
"react-18-input-autosize": "^3.0.0",
"react-dom": "19.0.0",
"react-dom": "19.2.1",
"react-easy-crop": "^5.1.0",
"react-error-boundary": "^4.1.2",
"react-headless-pagination": "^1.1.6",
@@ -159,7 +159,7 @@
"@eslint/js": "^9.20.0",
"@faker-js/faker": "^9.0.3",
"@happy-dom/jest-environment": "^17.4.4",
"@next/eslint-plugin-next": "^15.2.3",
"@next/eslint-plugin-next": "^15.5.7",
"@rgrove/parse-xml": "^4.1.0",
"@storybook/addon-essentials": "8.5.0",
"@storybook/addon-interactions": "8.5.0",
@@ -181,8 +181,8 @@
"@types/negotiator": "^0.6.3",
"@types/node": "18.15.0",
"@types/qs": "^6.9.16",
"@types/react": "19.0.11",
"@types/react-dom": "19.0.4",
"@types/react": "~19.2.7",
"@types/react-dom": "~19.2.3",
"@types/react-slider": "^1.3.6",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-window": "^1.8.8",
@@ -196,7 +196,7 @@
"code-inspector-plugin": "^0.18.1",
"cross-env": "^7.0.3",
"eslint": "^9.20.1",
"eslint-config-next": "^15.0.0",
"eslint-config-next": "^15.5.7",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"eslint-plugin-sonarjs": "^3.0.2",
@@ -217,8 +217,8 @@
"uglify-js": "^3.19.3"
},
"resolutions": {
"@types/react": "~18.2.0",
"@types/react-dom": "~18.2.0",
"@types/react": "~19.2.7",
"@types/react-dom": "~19.2.3",
"string-width": "4.2.3"
},
"lint-staged": {
@@ -230,8 +230,8 @@
]
},
"overrides": {
"@types/react": "19.0.11",
"@types/react-dom": "19.0.4",
"@types/react": "19.2.7",
"@types/react-dom": "19.2.3",
"@storybook/test": "8.5.0"
},
"pnpm": {

2318
web/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff