Vendored deer-flow upstream (bytedance/deer-flow) plus prompt-injection hardening: - New deerflow.security package: content_delimiter, html_cleaner, sanitizer (8 layers — invisible chars, control chars, symbols, NFC, PUA, tag chars, horizontal whitespace collapse with newline/tab preservation, length cap) - New deerflow.community.searx package: web_search, web_fetch, image_search backed by a private SearX instance, every external string sanitized and wrapped in <<<EXTERNAL_UNTRUSTED_CONTENT>>> delimiters - All native community web providers (ddg_search, tavily, exa, firecrawl, jina_ai, infoquest, image_search) replaced with hard-fail stubs that raise NativeWebToolDisabledError at import time, so a misconfigured tool.use path fails loud rather than silently falling back to unsanitized output - Native client back-doors (jina_client.py, infoquest_client.py) stubbed too - Native-tool tests quarantined under tests/_disabled_native/ (collect_ignore_glob via local conftest.py) - Sanitizer Layer 7 fix: only collapse horizontal whitespace, preserve newlines and tabs so list/table structure survives - Hardened runtime config.yaml references only the searx-backed tools - Factory overlay (backend/) kept in sync with deer-flow tree as a reference / source See HARDENING.md for the full audit trail and verification steps.
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
/**
|
|
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
|
|
* for Docker builds.
|
|
*/
|
|
import "./src/env.js";
|
|
|
|
function getInternalServiceURL(envKey, fallbackURL) {
|
|
const configured = process.env[envKey]?.trim();
|
|
return configured && configured.length > 0
|
|
? configured.replace(/\/+$/, "")
|
|
: fallbackURL;
|
|
}
|
|
import nextra from "nextra";
|
|
|
|
const withNextra = nextra({});
|
|
|
|
/** @type {import("next").NextConfig} */
|
|
const config = {
|
|
i18n: {
|
|
locales: ["en", "zh"],
|
|
defaultLocale: "en",
|
|
},
|
|
devIndicators: false,
|
|
async rewrites() {
|
|
const rewrites = [];
|
|
const langgraphURL = getInternalServiceURL(
|
|
"DEER_FLOW_INTERNAL_LANGGRAPH_BASE_URL",
|
|
"http://127.0.0.1:2024",
|
|
);
|
|
const gatewayURL = getInternalServiceURL(
|
|
"DEER_FLOW_INTERNAL_GATEWAY_BASE_URL",
|
|
"http://127.0.0.1:8001",
|
|
);
|
|
|
|
if (!process.env.NEXT_PUBLIC_LANGGRAPH_BASE_URL) {
|
|
rewrites.push({
|
|
source: "/api/langgraph",
|
|
destination: langgraphURL,
|
|
});
|
|
rewrites.push({
|
|
source: "/api/langgraph/:path*",
|
|
destination: `${langgraphURL}/:path*`,
|
|
});
|
|
}
|
|
|
|
if (!process.env.NEXT_PUBLIC_BACKEND_BASE_URL) {
|
|
rewrites.push({
|
|
source: "/api/agents",
|
|
destination: `${gatewayURL}/api/agents`,
|
|
});
|
|
rewrites.push({
|
|
source: "/api/agents/:path*",
|
|
destination: `${gatewayURL}/api/agents/:path*`,
|
|
});
|
|
}
|
|
|
|
return rewrites;
|
|
},
|
|
};
|
|
|
|
export default withNextra(config);
|