Harden markdown link rendering #15

Merged
Taskuler-bot merged 3 commits from fix/markdown-link-rendering into main 2026-11-30 02:01:17 +00:00
Member

Harden markdown link rendering in job descriptions, from the Taskuler Security review of df205df (H1, M5).

What someone using the app notices:

  • Links in job text work as before for https: and mailto:.

  • Other kinds of links show as plain text.

  • Links to other sites always open in a new tab and show a small ↗ marker.

  • Only links to a job on this site (/jobs/<id>) open inside the app.

  • Links with a user name or password in them (https://name@host/…) show as plain text.

Behind the scenes:

  • Job text is parsed into tokens and rendered as React elements, not HTML strings.
  • Relative links are resolved with new URL() against the app origin and compared by origin.
  • Code block language labels are limited to short plain names.
  • The job page, the live preview and the post page now share one link policy (src/job-note/links.ts).

Checked:

  • npm test 153/153.
  • Both tsc passes and vite build pass.
  • Headless Chrome on a testnet build, under the split style policy Security proposed: 0 policy violations on /, /post, /jobs/1, /jobs/2, /withdraw and /history, and job text renders.

Merging with #14: #14 and this PR each add one import line in the same spot in src/pages/PostJob.tsx. Rebasing would need a force-push, so this branch stays on main. When merging after #14, keep both lines:

import { SupportLine } from '../support'
import { classifyHref } from '../job-note/links'

Nothing else conflicts. The full order #14 → #15 → #16 → #17 → #18 merged locally with that resolution passes 185/185 tests, both tsc passes and the testnet build.

No deploy.

Harden markdown link rendering in job descriptions, from the Taskuler Security review of `df205df` (H1, M5). What someone using the app notices: - Links in job text work as before for `https:` and `mailto:`. - Other kinds of links show as plain text. - Links to other sites always open in a new tab and show a small ↗ marker. - Only links to a job on this site (`/jobs/<id>`) open inside the app. - Links with a user name or password in them (`https://name@host/…`) show as plain text. Behind the scenes: - Job text is parsed into tokens and rendered as React elements, not HTML strings. - Relative links are resolved with `new URL()` against the app origin and compared by origin. - Code block language labels are limited to short plain names. - The job page, the live preview and the post page now share one link policy (`src/job-note/links.ts`). Checked: - `npm test` 153/153. - Both `tsc` passes and `vite build` pass. - Headless Chrome on a testnet build, under the split style policy Security proposed: 0 policy violations on `/`, `/post`, `/jobs/1`, `/jobs/2`, `/withdraw` and `/history`, and job text renders. **Merging with #14:** #14 and this PR each add one import line in the same spot in `src/pages/PostJob.tsx`. Rebasing would need a force-push, so this branch stays on `main`. When merging after #14, keep both lines: ```ts import { SupportLine } from '../support' import { classifyHref } from '../job-note/links' ``` Nothing else conflicts. The full order #14 → #15 → #16 → #17 → #18 merged locally with that resolution passes 185/185 tests, both `tsc` passes and the testnet build. No deploy.
- Job text is parsed into tokens and rendered as React elements.
- Links: https and mailto only; in-app links only for same-origin /jobs/<id> paths, compared with new URL() against the app origin. Everything else external opens in a new tab with a cue.
- Code fence labels limited to [A-Za-z0-9_-]{0,20}.
- One link policy shared by the job page, the live preview and the post page.
- Tests for link targets and rendering.
george approved these changes 2026-11-30 01:56:00 +00:00
Dismissed
Taskuler-bot dismissed george's review 2026-11-30 01:59:35 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

george approved these changes 2026-11-30 02:00:49 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
taskuler/web!15
No description provided.