Skip to content

feat: Create YAML import endpoint for Tangle Deploy to preview pipeline#1829

Merged
yuechao-qin merged 1 commit intomasterfrom
ycq/tangle-deploy-investigate-run
Mar 12, 2026
Merged

feat: Create YAML import endpoint for Tangle Deploy to preview pipeline#1829
yuechao-qin merged 1 commit intomasterfrom
ycq/tangle-deploy-investigate-run

Conversation

@yuechao-qin
Copy link
Copy Markdown
Collaborator

@yuechao-qin yuechao-qin commented Feb 20, 2026

tangle-ui

Description

Add /app/editor/import-pipeline route to enable opening pipeline YAML files directly in the browser editor from external tools.

Look at PR-28268 for Video Demos for what this PR supports.

Changes

  • ImportPage component (src/routes/Import/index.tsx) — strict URL validation (isAllowedImportUrl), confirmation dialog before fetch, step indicator UI, error handling with reusable ErrorScreen component
  • Route /app/editor/import-pipeline in router.ts
  • Unit tests covering URL validation (10 cases), confirmation flow, success path, fetch failures, empty content, missing/invalid URL, and network errors (21 tests total)

Security

  • UI
    • Strict URL allowlist: only accepts http://127.0.0.1:{port>=10000}/tangle-deploy/pipeline.yaml — blocks crafted URLs targeting local services
    • Confirmation dialog: user must explicitly click "Import Pipeline" before any fetch occurs
    • Pipeline validation: importPipelineFromYaml validates YAML syntax and graph structure before saving to IndexedDB
    • Descriptive route path: renamed from /import to /app/editor/import-pipeline to avoid root-level conflicts and clarify intent
  • CLI Server
    • CORS headers: CLI server for cross-origin fetch

Test Steps

  1. Run npm run start (frontend on localhost:3000)
  2. Run tangle-view-pipeline <any_pipeline.yaml> --ui-url http://localhost:3000 — browser should open, show the step indicator, and redirect to the editor with the pipeline loaded
  3. Visit http://localhost:3000/#/import (no url param) — should show "Missing 'url' parameter" error with Back to Home button
  4. Visit http://localhost:3000/#/import?url=http://bad-url — should show fetch error UI
  5. Run npm test -- src/routes/Import/Import.test.tsx — all 6 tests should pass

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@yuechao-qin yuechao-qin marked this pull request as ready for review February 20, 2026 02:05
@yuechao-qin yuechao-qin requested a review from a team as a code owner February 20, 2026 02:05
Copy link
Copy Markdown

Ark-kun commented Feb 20, 2026

http://localhost:3000/#/import?url=http://bad-url
This might be dangerous from security perspective. Pipelines can contain malicious components. Users can be redirected to pipeline importing URLs.

We wanted to implement this feature for sample pipelines, but eventually went with a preloaded set of pipelines.

Although, doing such importing in the browser is still more secure than doing that in the backend (which is more privileged and has access to internal resources).

Copy link
Copy Markdown

Ark-kun commented Feb 20, 2026

>/import

I think we need the name to be more specific so that it does not conflict with things like importing components.

Also, I'de like the frontend to minimize the number of root route "directories". In some circumstances we need to route HTTP requests between UI and API server (on same domain) and URL prefixes makes that easier.
I'd suggest something like /app/commands/import_pipeline or /app/editor/import_pipeline

Copy link
Copy Markdown
Collaborator

In order to properly load remote resource we would need a proxy to:

  1. sanitize malicious endpoints
  2. avoid CORS issues
  3. validate pipelines

@yuechao-qin yuechao-qin force-pushed the ycq/tangle-deploy-investigate-run branch from 767f09b to 5dff0ff Compare March 9, 2026 00:07
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

🎩 To tophat this PR:

You can add the following URL parameter to your browser to tophat this PR:

`?tophat_location=ycq/tangle-deploy-investigate-run/43fb8e7`

@yuechao-qin yuechao-qin force-pushed the ycq/tangle-deploy-investigate-run branch from 5dff0ff to 2973409 Compare March 9, 2026 06:16
@yuechao-qin yuechao-qin requested a review from Mbeaulne March 9, 2026 18:55
@yuechao-qin yuechao-qin force-pushed the ycq/tangle-deploy-investigate-run branch from 2973409 to 26ebe8e Compare March 11, 2026 21:26
@yuechao-qin yuechao-qin requested a review from Mbeaulne March 11, 2026 21:27
Copy link
Copy Markdown
Collaborator Author

yuechao-qin commented Mar 12, 2026

Merge activity

  • Mar 12, 5:15 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 12, 5:16 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 12, 5:17 PM UTC: @yuechao-qin merged this pull request with Graphite.

@yuechao-qin yuechao-qin force-pushed the ycq/tangle-deploy-investigate-run branch from 26ebe8e to 43fb8e7 Compare March 12, 2026 17:15
@yuechao-qin yuechao-qin merged commit ba2db0f into master Mar 12, 2026
17 checks passed
@yuechao-qin yuechao-qin deleted the ycq/tangle-deploy-investigate-run branch March 12, 2026 17:17
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.

4 participants