Skip to content

feat(website): render source human_link with Go templates - #6341

Merged
michaelkedar merged 2 commits into
masterfrom
human-link-template
Nov 11, 2026
Merged

michaelkedar merged 2 commits into
masterfrom
human-link-template

Conversation

@michaelkedar

@michaelkedar michaelkedar commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Part 1/3 of moving SourceRepository.human_link off jinja (a leftover from the Python website) onto Go text/template.

Templates get .ID and .Ecosystems (the affected ecosystems, in order), plus a small set of generic functions:

  • field SEP N: split on SEP and take part N (0-indexed; out of range is an error)
  • replace OLD NEW
  • lower

Any render error means no human link is shown, so templates don't need conditionals.

To keep things working while source.yaml is migrated (#6342), templates that fail to parse as Go templates fall back to gonja, with a human_link is not a valid Go template, falling back to jinja warning. The fallback is removed in #6343.

Also updates the website devserver test data to the new syntax.

Also removes the Flask-era FLASK_SECRET_KEY/SECRET_KEY/API_URL env var fallbacks from the website; neither staging nor prod sets them (both use SESSION_SECRET_KEY/OSV_API_URL).
agy

Render SourceRepository human_link templates with text/template instead of
jinja (via gonja), with a small set of generic functions (field, replace,
lower) and the vulnerability ID/ecosystems as data.

Templates that fail to parse as Go templates fall back to gonja (with a
warning log) until source.yaml/source_test.yaml are migrated.
Neither staging nor prod sets FLASK_SECRET_KEY, SECRET_KEY or API_URL;
both set SESSION_SECRET_KEY (staging only) and OSV_API_URL.
@michaelkedar
michaelkedar marked this pull request as ready for review November 11, 2026 03:25
@michaelkedar
michaelkedar requested review from a team and jess-lowe November 11, 2026 03:25
@michaelkedar
michaelkedar merged commit 0fa7d07 into master Nov 11, 2026
26 checks passed
@michaelkedar
michaelkedar deleted the human-link-template branch November 11, 2026 23:10
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