Skip to content

feat(rules): add FreeMarker (.ftl/.ftlh/.ftlx) review support#5

Open
chethanuk wants to merge 1 commit into
mainfrom
feat/issue-371-freemarker-rules
Open

feat(rules): add FreeMarker (.ftl/.ftlh/.ftlx) review support#5
chethanuk wants to merge 1 commit into
mainfrom
feat/issue-371-freemarker-rules

Conversation

@chethanuk

@chethanuk chethanuk commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Description

Adds first-class review support for Apache FreeMarker templates, as requested in alibaba#371:

  • Extension allowlist: .ftl, .ftlh, and .ftlx added to internal/config/allowlist/supported_file_types.json (.ftlh/.ftlx are FreeMarker's official extensions for HTML- and XML-auto-escaping output formats, so all three are covered).
  • System review rules: new internal/config/rule_docs/freemarker.md rule layer wired into internal/config/system_rules.json with glob **/*.{ftl,ftlh,ftlx}. The rules focus on template-specific pitfalls: XSS/escaping (?html vs ftlh auto-escape, noautoesc), null-safety (! default and ?? existence operators), heavy logic in templates, and include/import hygiene.
  • Docs: supported-file-type tables updated in the English, Japanese, and Chinese documentation pages.

Type of Change

  • New feature (non-breaking change that adds functionality)

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

allowed_ext_test.go and system_rules_test.go extended to cover the three new extensions, including glob-match verification for root-level and nested template paths. make check (tidy + fmt + vet) passes.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)

Related Issues

Closes alibaba#371

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jul 15, 2026
gemini-code-assist[bot]

This comment was marked as outdated.

@chethanuk
chethanuk force-pushed the feat/issue-371-freemarker-rules branch from b46e102 to 913b329 Compare July 15, 2026 08:31
Adds the FreeMarker template extensions to the supported-file-type
allowlist and introduces a freemarker.md system rule layer (glob
**/*.{ftl,ftlh,ftlx}) covering SSTI (?new()/Execute/ObjectConstructor,
?eval/?api), output escaping vs the ftlh/ftlx auto-escape formats,
null/missing-value handling, logic-in-template smells, include/import
hygiene, and locale-sensitive formatting. Extends the allowlist and
system-rules tests and documents the new mapping in the en/ja/zh pages.

Closes alibaba#371
@chethanuk
chethanuk force-pushed the feat/issue-371-freemarker-rules branch from 913b329 to 7b8d823 Compare July 15, 2026 09:14
Repository owner deleted a comment from codeant-ai Bot Jul 15, 2026
Repository owner deleted a comment from codeant-ai Bot Jul 15, 2026
Repository owner deleted a comment from coderabbitai Bot Jul 15, 2026
Repository owner deleted a comment from codeant-ai Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
Repository owner deleted a comment from gemini-code-assist Bot Jul 15, 2026
@chethanuk chethanuk changed the title feat(rules): add FreeMarker (.ftl) review support feat(rules): add FreeMarker (.ftl/.ftlh/.ftlx) review support Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

是否考虑增加对FreeMarker(.ftl)的审查流程

1 participant