Skip to content

feat: add Workflows plugin (tool + backend)#4

Open
jdrodjpl wants to merge 1 commit into
masterfrom
feat/workflows-plugin
Open

feat: add Workflows plugin (tool + backend)#4
jdrodjpl wants to merge 1 commit into
masterfrom
feat/workflows-plugin

Conversation

@jdrodjpl

Copy link
Copy Markdown
Collaborator

Workflows integration for MMGIS: submit jobs against a configured workflows API (cookie OAuth via inline connect link), track/filter/ rename runs with per-user history, and add completed runs' tile STAC items as mission layers — grouped under a "Workflow Outputs" header, with TiTiler rescale options seeded from item raster statistics and provenance shown in the layer info modal.

Backend module stores per-user submission history (endpoint, payload, run name) in the workflow_submissions table.

Data-source URI fields carry no baked-in defaults — they're omitted from payloads and the API applies its own deployment-specific defaults server-side.

@jdrodjpl
jdrodjpl requested a review from tariqksoliman July 22, 2026 22:59
Comment thread tools/Workflows/plugin.json
Comment thread backend/Workflows/plugin.json Outdated
Comment thread backend/Workflows/plugin.json Outdated
Comment thread tools/Workflows/WorkflowsTool.js
Comment thread tools/Workflows/WorkflowsTool.js Outdated
// (LayerInfoModal renders layer.description through showdown).
function buildLayerDescription(jobId, job) {
const lines = ['Generated by the Workflows tool.', '']
if (job.name) lines.push(`**Run:** ${job.name}`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

XSS. Make sure job.names like <img src=x onerror=alert(document.domain)> don't inject code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still complaining about:

  1. mdSafe() does NOT fully close the stored XSS (this is the important one). It escapes < > & \ |and_ *, which kills the raw-tag and code-span-breakout vectors — but it leaves ", !, [, ], (, )` untouched, so markdown image/link syntax still injects HTML. Confirmed against showdown:

Run name / payload value =

![](https://a/b.png"onerror="alert(document.domain))

→ renders as

<img src="https://a/b.png"onerror="alert(document.domain)" alt="" />

That's an auto-firing onerror (no click needed), stored into the shared mission config → fires for every user who opens that layer's Info modal.

Also [click](javascript:alert(1)) → <a href="javascript:alert(1)">click</a> (click-required, but still stored).

Fix: extend mdSafe() to also escape the double-quote and neutralize markdown link/image punctuation, e.g. append:

.replace(/"/g, '&quot;')
.replace(/[\[\]()!]/g, (m) => '\\' + m)

Comment thread tools/Workflows/WorkflowsTool.js Outdated
lines.push('| Parameter | Value |')
lines.push('| --- | --- |')
entries.forEach(([k, v]) => {
lines.push(`| \`${k}\` | \`${v}\` |`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

XSS. Make sure key and values like the following do not inject code.

a`<img src=x onerror=alert(1)>`b

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in latest push.

@tariqksoliman

Copy link
Copy Markdown
Member

Oh, also do update the main README.md and add the Workflows plugin to it. Thanks!

Workflows integration for MMGIS: submit jobs against a configured
workflows API (cookie OAuth via inline connect link), track/filter/
rename runs with per-user history, and add completed runs' tile STAC
items as mission layers — grouped under a "Workflow Outputs" header,
with TiTiler rescale options seeded from item raster statistics and
provenance shown in the layer info modal.

Backend module stores per-user submission history (endpoint, payload,
run name) in the workflow_submissions table.

Data-source URI fields carry no baked-in defaults — they're omitted
from payloads and the API applies its own deployment-specific
defaults server-side.

All user-controlled values interpolated into layer descriptions and
display names are escaped/stripped against stored XSS (descriptions
render through showdown and persist into the shared mission config).
@jdrodjpl
jdrodjpl force-pushed the feat/workflows-plugin branch from cbc9788 to 238e1e1 Compare July 23, 2026 17:24
@tariqksoliman

tariqksoliman commented Jul 23, 2026

Copy link
Copy Markdown
Member

@jdrodjpl Almost there, just my last message above and then a bit more for the XSS issue

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