Skip to content

Commit 070b385

Browse files
authored
Merge branch 'main' into chore/Langchain-V1
2 parents 51ac34e + e00876a commit 070b385

5 files changed

Lines changed: 36 additions & 15 deletions

File tree

.github/workflows/publish-agentflow.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,28 @@ jobs:
6363

6464
- name: Set version
6565
run: |
66+
CURRENT=$(npm pkg get version --prefix packages/agentflow | tr -d '"')
6667
if [ "$BUMP" = "custom" ]; then
67-
pnpm --filter @flowiseai/agentflow exec npm version "$CUSTOM_VERSION" --no-git-tag-version
68+
NEW_VERSION="$CUSTOM_VERSION"
6869
else
69-
pnpm --filter @flowiseai/agentflow exec npm version "$BUMP" --preid dev --no-git-tag-version
70+
NEW_VERSION=$(npx semver "$CURRENT" -i "$BUMP" --preid dev)
7071
fi
72+
npm pkg set version="$NEW_VERSION" --prefix packages/agentflow
73+
echo "Version set to $NEW_VERSION"
7174
env:
7275
BUMP: ${{ inputs.bump }}
7376
CUSTOM_VERSION: ${{ inputs.custom_version }}
7477

7578
- name: Resolve version
7679
id: resolve-version
7780
run: |
78-
VERSION=$(node -p "require('./packages/agentflow/package.json').version")
81+
VERSION=$(npm pkg get version --prefix packages/agentflow | tr -d '"')
7982
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
8083
echo "## Version to publish: \`$VERSION\`" >> "$GITHUB_STEP_SUMMARY"
8184
echo "## Tag: \`${{ inputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
8285
8386
- name: Package contents
84-
run: pnpm --filter @flowiseai/agentflow exec npm pack --dry-run
87+
run: pnpm --filter @flowiseai/agentflow pack --dry-run
8588

8689
- name: Dry run publish
8790
run: pnpm --filter @flowiseai/agentflow publish --no-git-checks --dry-run --tag ${{ inputs.tag }}
@@ -114,11 +117,14 @@ jobs:
114117

115118
- name: Set version
116119
run: |
120+
CURRENT=$(npm pkg get version --prefix packages/agentflow | tr -d '"')
117121
if [ "$BUMP" = "custom" ]; then
118-
pnpm --filter @flowiseai/agentflow exec npm version "$CUSTOM_VERSION" --no-git-tag-version
122+
NEW_VERSION="$CUSTOM_VERSION"
119123
else
120-
pnpm --filter @flowiseai/agentflow exec npm version "$BUMP" --preid dev --no-git-tag-version
124+
NEW_VERSION=$(npx semver "$CURRENT" -i "$BUMP" --preid dev)
121125
fi
126+
npm pkg set version="$NEW_VERSION" --prefix packages/agentflow
127+
echo "Version set to $NEW_VERSION"
122128
env:
123129
BUMP: ${{ inputs.bump }}
124130
CUSTOM_VERSION: ${{ inputs.custom_version }}

packages/agentflow/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flowiseai/agentflow",
3-
"version": "0.0.0-dev.2",
3+
"version": "0.0.0-dev.3",
44
"description": "Embeddable React component for building and visualizing AI agent workflows",
55
"license": "Apache-2.0",
66
"repository": {
@@ -59,18 +59,18 @@
5959
"prepublishOnly": "npm run clean && npm run build"
6060
},
6161
"peerDependencies": {
62-
"react": "^18.2.0",
63-
"react-dom": "^18.2.0",
64-
"@mui/material": "^5.15.0",
65-
"@mui/icons-material": "^5.0.0",
6662
"@emotion/react": "^11.10.0",
6763
"@emotion/styled": "^11.10.0",
64+
"@mui/icons-material": "^5.0.0",
65+
"@mui/material": "^5.15.0",
66+
"react": "^18.2.0",
67+
"react-dom": "^18.2.0",
6868
"reactflow": "^11.5.0"
6969
},
7070
"dependencies": {
71+
"@tabler/icons-react": "^3.7.0",
7172
"axios": "^1.7.2",
7273
"lodash": "^4.17.21",
73-
"@tabler/icons-react": "^3.7.0",
7474
"uuid": "^10.0.0"
7575
},
7676
"devDependencies": {

packages/server/src/controllers/chatflows/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { getPageAndLimitParams } from '../../utils/pagination'
1212
import { WorkspaceUserErrorMessage, WorkspaceUserService } from '../../enterprise/services/workspace-user.service'
1313
import { QueryRunner } from 'typeorm'
1414
import { GeneralErrorMessage } from '../../utils/constants'
15+
import { sanitizeFlowDataForPublicEndpoint } from '../../utils/sanitizeFlowData'
1516

1617
const checkIfChatflowIsValidForStreaming = async (req: Request, res: Response, next: NextFunction) => {
1718
try {
@@ -217,7 +218,8 @@ const getSinglePublicChatflow = async (req: Request, res: Response, next: NextFu
217218
}
218219
const chatflow = await chatflowsService.getChatflowById(req.params.id)
219220
if (!chatflow) return res.status(StatusCodes.NOT_FOUND).json({ message: 'Chatflow not found' })
220-
if (chatflow.isPublic) return res.status(StatusCodes.OK).json(chatflow)
221+
if (chatflow.isPublic)
222+
return res.status(StatusCodes.OK).json({ ...chatflow, flowData: sanitizeFlowDataForPublicEndpoint(chatflow.flowData) })
221223
if (!req.user) return res.status(StatusCodes.UNAUTHORIZED).json({ message: GeneralErrorMessage.UNAUTHORIZED })
222224
queryRunner = getRunningExpressApp().AppDataSource.createQueryRunner()
223225
const workspaceUserService = new WorkspaceUserService()

packages/server/src/utils/sanitizeFlowData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export const sanitizeFlowDataForPublicEndpoint = (flowDataString: string): strin
2121
delete node.data.credential
2222

2323
const inputs = node.data.inputs
24-
const inputParams: INodeParams[] = node.data.inputParams
2524

26-
if (!inputs || !inputParams) continue
25+
if (!inputs) continue
26+
const inputParams: INodeParams[] = node.data.inputParams ?? []
2727

2828
const sanitizedInputs: Record<string, unknown> = {}
2929
for (const key of Object.keys(inputs)) {

packages/server/test/utils/sanitizeFlowData.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,19 @@ describe('sanitizeFlowDataForPublicEndpoint', () => {
147147
expect(sanitizeFlowDataForPublicEndpoint('')).toBe('')
148148
})
149149

150+
it('sanitizes sensitive headers even when inputParams is missing', () => {
151+
const flowData = makeFlowData([
152+
{
153+
id: 'n0',
154+
type: 'x',
155+
data: { inputs: { headers: { Authorization: 'Bearer secret', 'Content-Type': 'application/json' } } }
156+
}
157+
])
158+
const result = JSON.parse(sanitizeFlowDataForPublicEndpoint(flowData))
159+
expect(result.nodes[0].data.inputs.headers).not.toHaveProperty('Authorization')
160+
expect(result.nodes[0].data.inputs.headers['Content-Type']).toBe('application/json')
161+
})
162+
150163
it('does not crash when a node has no inputParams', () => {
151164
const flowData = makeFlowData([{ id: 'n0', type: 'x', data: { inputs: { foo: 'bar' } } }])
152165
expect(() => sanitizeFlowDataForPublicEndpoint(flowData)).not.toThrow()

0 commit comments

Comments
 (0)