Skip to content

feat(agentflow): strip server-only metadata from node data#5966

Merged
jocelynlin-wd merged 3 commits intomainfrom
feat/agentflow-strip-node-metadata
Mar 13, 2026
Merged

feat(agentflow): strip server-only metadata from node data#5966
jocelynlin-wd merged 3 commits intomainfrom
feat/agentflow-strip-node-metadata

Conversation

@jocelynlin-wd
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves data security and consistency within the agentflow package by introducing explicit data filtering mechanisms. It ensures that only necessary and safe node data is retained during export operations and node initialization, effectively preventing the accidental exposure of sensitive credentials, file system paths, and transient runtime states. This change aligns data handling with best practices for serialization and sharing, making the system more robust and secure.

Highlights

  • Enhanced Data Export Security: Implemented a new pickExportNodeData function to explicitly allowlist node data fields for export, ensuring sensitive information (like credentials, password/file/folder input values) and runtime-only state (status, error, warning, hint, validationErrors) are systematically stripped before export.
  • Improved Node Initialization Data Hygiene: Introduced a pickNodeData function to filter out server-only metadata (e.g., filePath, badge, author, loadMethods) and runtime-only state from node data when initializing nodes, preventing persistence of transient or internal data.
  • Comprehensive Test Coverage: Added extensive test cases in flowExport.test.ts and nodeFactory.test.ts to rigorously verify that sensitive data, server-only metadata, and runtime states are correctly stripped during both flow export and node initialization processes.
Changelog
  • packages/agentflow/src/core/utils/flowExport.test.ts
    • Updated the 'should preserve other node data' test to 'should preserve allowlisted node data fields' and expanded its scope to cover more allowed fields.
    • Added a new test case 'should strip runtime-only state from exported data' to verify the removal of transient node properties.
    • Included a new test case 'should strip password, file, and folder input values' to confirm the removal of sensitive input values during export.
  • packages/agentflow/src/core/utils/flowExport.ts
    • Defined SENSITIVE_INPUT_TYPES as a constant set for input types that must be stripped.
    • Implemented the pickExportNodeData function to create an allowlisted copy of node data, removing credentials, sensitive input values, and runtime state.
    • Modified generateExportFlowData to utilize pickExportNodeData for processing node data before export.
  • packages/agentflow/src/core/utils/nodeFactory.test.ts
    • Added a new test case 'should strip server-only metadata like filePath from node data' to ensure server-specific properties are removed during node initialization.
    • Included a new test case 'should strip runtime-only state from node data' to verify the removal of transient runtime properties during node initialization.
  • packages/agentflow/src/core/utils/nodeFactory.ts
    • Implemented the pickNodeData function to filter out server-only metadata and runtime state from raw NodeData.
    • Modified the initNode function to incorporate pickNodeData when initializing node data, ensuring only relevant properties are kept.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an allowlist-based approach for filtering node data, both during node initialization and when exporting flows. This is a great improvement for security and data hygiene, preventing server-only metadata and sensitive values from being persisted or exported. The changes are well-implemented and include thorough tests. I have a suggestion to improve performance, but overall this is a solid contribution.

@jocelynlin-wd jocelynlin-wd merged commit 9e92d60 into main Mar 13, 2026
7 checks passed
@jocelynlin-wd jocelynlin-wd deleted the feat/agentflow-strip-node-metadata branch March 13, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants