Skip to content

Improve that secrets don't block from opening a flow and are only val…#490

Open
Edwardvaneechoud wants to merge 3 commits into
mainfrom
fix/ga-4-when-run-from-workflow
Open

Improve that secrets don't block from opening a flow and are only val…#490
Edwardvaneechoud wants to merge 3 commits into
mainfrom
fix/ga-4-when-run-from-workflow

Conversation

@Edwardvaneechoud
Copy link
Copy Markdown
Owner

This pull request improves how external connections (databases, Kafka, Google Analytics, REST APIs) are resolved and handled in the flow graph. The main goals are to defer connection/credential resolution until execution time (so opening or undoing a flow does not require access to the connection), ensure correct user ownership when restoring flows from snapshots, and improve security by never persisting plaintext secrets. The changes also add better error handling and make schema inference more robust.

Deferred and Secure Connection/Credential Resolution:

  • Database, Kafka, Google Analytics, and REST API connections are now resolved lazily at execution time, under the node's user_id (the flow owner), rather than at flow open/undo time. This avoids requiring the current session to have access to every connection referenced by a flow. [1] [2] [3] [4] [5]
  • For REST API nodes, any inline plaintext credential is now encrypted eagerly and removed from the node object, ensuring that secrets are never persisted in plaintext, regardless of flow ownership. Secret-store lookups are deferred to execution.

User Ownership and Flow Restoration:

  • When restoring a flow from a snapshot, the correct user_id is re-stamped onto node settings, ensuring that connection-backed nodes can resolve credentials under the correct user context. This mirrors the behavior of opening flows and prevents failures due to missing user association. [1] [2]

Improved Error Handling:

  • Added explicit error handling for missing or inaccessible database and Google Analytics connections, with clear HTTP 400 errors and descriptive messages. [1] [2]

Schema Inference Improvements:

  • For database and Kafka source nodes, schema callbacks now prefer cached fields on the node (from prior runs), only querying the live connection if necessary. This allows flows to render columns without requiring live credentials or connections. [1] [2]

Refactoring and Code Quality:

  • Refactored credential and connection resolution logic into memoized or helper functions for clarity and to avoid redundant lookups. Improved formatting and comments for maintainability. [1] [2] [3]

These changes make the flow system more robust, secure, and user-friendly, especially in collaborative or multi-user environments.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 3, 2026

Deploy Preview for flowfile-wasm canceled.

Name Link
🔨 Latest commit ed3a437
🔍 Latest deploy log https://app.netlify.com/projects/flowfile-wasm/deploys/6a214ce5a3e10200084c4600

@Edwardvaneechoud Edwardvaneechoud marked this pull request as ready for review June 4, 2026 06:06
- Remember the session owner on FlowGraph (captured in with_history_capture)
  and use it when undo restores nodes from an empty graph, so connection-backed
  nodes are never re-stamped with user_id=None
- Lock the memoized credential / Kafka-settings getters: the schema callback
  runs on a background thread while _func runs on the execution thread
- Drop echoed Kafka fields when topic/value_format/connection changes so the
  schema callback cannot serve stale columns after a programmatic update
- Guard GA oauth_cfg against an unknown auth_method reaching the oauth branch
- Raise a clear error instead of AttributeError when a referenced database
  connection is missing in _resolve_connection_string
- Add tests pinning the deferred-resolution contract, cached-fields schema,
  run-time error surfacing, and the undo user_id re-stamp

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant