OINK v0.7.1 — Security and validation hardening
OINK 0.7.1 is a security and validation patch with no component API change. It closes the code findings from an external review of the 0.7.0 line.
Highlights
- Swagger UI no longer contacts the online validator. The initializer pins
validatorUrl: nulland moves to a cacheablejs/chunks/swagger-init.js, so a same-origin spec page makes no third-party request. - Configured URL surfaces route through the shared URL policy.
params.ui.page_context_menu.linksandparams.url_latest_versionwarn and drop an unsafe value instead of rendering it, and the archived-version banner escapes its URL at the sink. - Invalid configuration warns and falls back. Numeric and boolean keys — blog/section index sizes and columns, sidebar widths, print options, offline-search limits, and more — no longer crash
hugo serveror emit broken CSS; a shared integer validator reads values as base-10 with bounds. - OpenAPI and asciinema honor the output contract. The
swagger,redoc, andasciinemashortcodes emit a static link in print, Markdown, and RSS, and register their runtime only in interactive HTML. - Generated configuration schemas match what Hugo parses. Trailing comments no longer leak into defaults, and migration-only keys stay out of the front-matter schema.
Upgrade
hugo mod get github.com/pgsty/oink@v0.7.1
hugo mod tidyNo content, configuration, or template changes are required. Invalid configuration values that used to build silently now warn — run a --panicOnWarning build to surface any that a publishing gate would catch.
OINK 0.7.1 是一个安全与校验修补版本,不改动任何组件 API,修复了对 0.7.0 主线外部审查发现的代码问题:
- Swagger UI 不再联系在线 validator:初始化写死
validatorUrl: null并移入可缓存的js/chunks/swagger-init.js,同源 spec 页面不再发起第三方请求。 - 配置中的 URL 走统一安全策略:
page_context_menu.links与url_latest_version对非法值告警并丢弃,归档版本横幅在输出处转义。 - 非法配置告警并回退:数值与布尔配置键(博客/章节索引的分页大小与列数、侧栏宽度、打印选项、离线搜索上限等)不再击穿
hugo server或输出坏 CSS;共享整数校验器以十进制读取并带范围约束。 - OpenAPI 与 asciinema 遵守输出契约:
swagger、redoc、asciinema在 print/Markdown/RSS 输出静态链接,仅在交互 HTML 中装载运行时。 - 生成的配置 Schema 与 Hugo 实际解析一致:行尾注释不再污染默认值,仅供迁移告警读取的键不再出现在 front matter Schema 中。
升级方式与英文一致;非法配置从静默构建改为告警,建议用 --panicOnWarning 构建检查发布门禁会拦截的项。