Skip to content

Add local web view for sim db - #11

Merged
hyharry merged 1 commit into
masterfrom
feature/local-view-ui
Apr 11, 2026
Merged

Add local web view for sim db#11
hyharry merged 1 commit into
masterfrom
feature/local-view-ui

Conversation

@hyharry

@hyharry hyharry commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • add local view command that serves a lightweight browser UI
  • support filtering and sorting across sim rows, including date asc/desc
  • add quick start/done actions from the local UI
  • update tests and README

Verification

  • python3 -m unittest -v
  • local view API smoke check

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02ac26fe02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sim_db.py
}).join('') + '</tr>';
const body = rows.map(r => {
const cells = state.columns.map(c => `<td>${String(r[c] || '').replaceAll('<', '&lt;')}</td>`).join('');
const actions = `<td><div class="actions"><button data-job="${r.job_id}" data-action="start">start</button><button data-job="${r.job_id}" data-action="done">done</button></div></td>`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Escape job_id before injecting into action buttons

renderTable inserts r.job_id directly into a data-job attribute via innerHTML. Because imported records can contain arbitrary job_id strings (for example via sync-import), a value containing quotes can break out of the attribute and execute script when the local view is opened, which can then call /api/start or /api/done and silently mutate run statuses. Build these elements with DOM APIs (setAttribute) or properly escape attribute values before templating.

Useful? React with 👍 / 👎.

Comment thread sim_db.py
const headerCols = [...state.columns, '_actions'];
const head = '<tr>' + headerCols.map(c => {
if (c === '_actions') return '<th>actions</th>';
return `<th><button data-sort="${c}">${c}${state.sortBy === c ? (state.desc ? ' ▼' : ' ▲') : ''}</button></th>`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Sanitize column names before rendering sortable headers

The sortable header HTML injects c (a column name) directly into both data-sort and button text. Column names come from row keys, and extra keys are user-controlled through imported artifacts, so a crafted key containing quotes/markup can inject DOM/script or break the table controls as soon as the page renders. Treat column names as untrusted and escape them or render with textContent/setAttribute instead of raw innerHTML.

Useful? React with 👍 / 👎.

@hyharry
hyharry merged commit e875420 into master Apr 11, 2026
8 checks passed
@hyharry
hyharry deleted the feature/local-view-ui branch April 11, 2026 20:37
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