لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Harden a JasperReports pipeline

آزاد تازه‌وارد تاییدشده امن

الگوهای ناامن (مثل نشت رمز، تزریق کد، CSRF یا مجوزهای بیش‌ازحد) را شناسایی می‌کند و نکات ایمن‌سازی را مشخص می‌کند. (شامل ۱۰ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: hardening
description: Harden JasperReports applications that accept templates, query inputs, or report resources from outside the trusted codebase. Use for JasperReports-specific trust boundaries and defensive controls, not generic application security reviews or claims that JasperReports provides a sandbox.
---

# Harden a JasperReports pipeline

## Set the trust boundary first

Identify the exact JasperReports artifacts and versions, Java version, expression languages, query executers, resource resolvers, exporters, and whether JRXML/JRTX, compiled `.jasper`, or serialized print objects can come from users or third parties. Keep every example synthetic and do not request credentials, production reports, or production data.

Treat report templates and serialized JasperReports objects as executable or deserializable input, not passive documents. JasperReports is not a security sandbox. Class filters and repository settings are defense-in-depth controls with defined scopes; they do not make arbitrary user-authored templates safe to execute in the application process. Prefer trusted, reviewed templates. If users need customization, expose a constrained application-level report builder rather than accepting arbitrary templates.

Where untrusted input must be processed, isolate the work in a separate, unprivileged process or service with only the required filesystem and network access, no application secrets, bounded CPU, memory, execution time and output size, and controlled temporary storage. These measures reduce blast radius; they do not turn JasperReports into a sandbox. Never deserialize untrusted `.jasper` or serialized print files to inspect them.

## Verify versioned controls before configuring

The following defaults and version metadata were checked against the JasperReports 7.1.1 source and configuration reference. Verify every property against the exact deployed release and context; do not assume project-level or report-level properties have the intended security scope.

| Control | JasperReports 7.1.1 behavior | Use and limitation |
| --- | --- | --- |
| Report expression class filter: `net.sf.jasperreports.report.class.filter.enabled` | Default `false`; source metadata says since 6.13.0 | Enable only with a reviewed, narrow class allowlist where compatible. It is not a general Java-expression sandbox and does not replace trusted templates or process isolation. |
| Deserialization class filter: `net.sf.jasperreports.deserialization.class.filter.enabled` | Default `true`; since 7.0.4 | Keep enabled and review only narrowly required allowlist additions. It applies to JasperReports deserialization paths that use this filter; it is not permission to accept arbitrary serialized input. |
| Raw query clause: `net.sf.jasperreports.query.parameter.clause.enabled` | Default `true`; source metadata says since 7.0.7 | Disable at the JasperReports context when templates do not need `$P!{...}`. The source metadata says 7.0.7 while `changes.txt` lists the feature under 7.0.8; check the target release artifacts and documentation before relying on an older version. |
| Query language factory: `net.sf.jasperreports.query.executer.factory.<language>.enabled` | Enabled by default for each language; since 7.0.7 | Disable languages the deployment does not need. This is not a SQL authorization policy. |
| Repository URL filter: `net.sf.jasperreports.repository.url.filter.enabled` | Default `false`; since 7.0.7 | When enabled, only full URLs matching configured `net.sf.jasperreports.repository.url.whitelist.<name>` regular expressions are allowed by `DefaultRepositoryService`. Use narrow, anchored patterns and test allowed and denied synthetic URLs. This does not constrain every library, extension, exporter or application URL access. |
| Default file repository: `net.sf.jasperreports.default.file.repository.enabled` | Default `true`; since 6.11.0 | Set to `false` when report resources must not resolve through the default repository's filesystem lookup. This is not an operating-system filesystem boundary. |
| SVG external resources: `net.sf.jasperreports.svg.allow.external.resources` | Default `false`; since 7.0.1 | Keep disabled unless required; it controls Batik SVG external resources, not all report resource fetching. |
| HTML hyperlink filter: `net.sf.jasperreports.export.html.href.filter.enabled` | Default `false`; since 7.0.8 | Configure allow patterns if generated links need restriction. It filters HTML exporter hyperlinks; it does not sanitize HTML, protect a browser from all active content, or control server-side network access. |

Set security properties in the context actually used to compile, fill, deserialize, resolve resources, and export. Confirm precedence and scope for the exact release. Do not place a trusted global policy in untrusted report properties or accept a report's own configuration as the enforcement point.

## Defend query and resource boundaries

1. Use `$P{...}` for values and `$X{...}` for supported generated clauses. Never concatenate request values into SQL or pass untrusted input through `$P!{...}`. If raw clauses are not a required feature, disable them in the trusted context and test that a synthetic query using the syntax fails before database execution.
2. Keep SQL identifiers, sort directions and table names in application code. Map user choices through a fixed allowlist; bound values do not bind identifiers. Give the report database identity read-only, least-privilege access and apply database-side timeouts and row limits.
3. Disable unused query executer languages. A query-language allowlist is not a substitute for safe query construction or least-privilege database credentials.
4. Treat template-controlled images, subreports, data adapters, styles and other resource locations as untrusted. Prefer packaged classpath resources or an application-owned resolver. Configure and test the repository URL allowlist and filesystem policy, and enforce outbound network policy outside JasperReports as well.
5. Apply output-specific controls in the consuming application: encode user text for its rendering context, constrain output paths and filenames, set safe download headers, and cap generated output. An exporter setting is not a complete browser or document security policy.

<!-- ‹guest · 2026-11-29› -->
Use [data-sources](../data-sources/SKILL.md) for binding, [subreports-datasets](../subreports-datasets/SKILL.md) for resource lookup, [export](../export/SKILL.md) for output-specific behavior, and [debug](../debug/SKILL.md) for diagnosing a control that changes report behavior.

## Validate and report

Use a disposable local database and synthetic reports only. Cover an expression result class rejected by an enabled class filter without executing a harmful expression; verify the filter's scope and explicitly state that this does not prove arbitrary expressions safe. Verify that disabling raw query clauses rejects a query containing `$P!{...}` without connecting to production. Verify that an unlisted synthetic remote URL is rejected before any network request, and test permitted URLs only against a controlled test endpoint.

Record the exact library version, Java version, context properties and effective configuration, test commands, and observed results. Separate property-default inspection, deterministic runtime tests, behavioral evals, and deployment or network-policy checks. Mark unavailable tests unverified; never claim that a sandbox, broad SSRF protection, complete expression confinement or security certification was established.

## Sources

- [Configuration reference](https://jasperreports.sourceforge.net/config.reference.html)
- [Version changes](https://github.com/Jaspersoft/jasperreports/blob/master/changes.txt)
- [API](https://jasperreports.sourceforge.net/api/index.html)
- [Data sources](../data-sources/SKILL.md)
- [Subreports and datasets](../subreports-datasets/SKILL.md)

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
کیفیت کد و تست
✦ Pro

REA CI and tests audit

«REA CI and tests audit» دستورالعمل دقیقی برای «نوشتن و اجرای تست خودکار» در اختیار دستیار هوش مصنوعی می‌گذارد تا نتیجه…

⚡ /rea-ci-tests-audit SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۱/۱۰۰ ★ ۴۷۴,۰۸۴
کیفیت کد و تست
✦ Pro

Finishing a Development Branch

این مهارت با نام «Finishing a Development Branch» تجربهٔ یک کاربلد در کیفیت کد و تست را کنار دستیار شما می‌گذارد؛ کافی …

⚡ /finishing-a-development-branch SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Code Review Reception

اگر روی کیفیت کد و تست کار می‌کنید، «Code Review Reception» بخشی از کار را از دوش شما برمی‌دارد: «بازنویسی و تمیزسازی ک…

⚡ /receiving-code-review SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Requesting Code Review

برای کارهای کیفیت کد و تست، «Requesting Code Review» یک راهنمای کوتاه و روشن است: مسیر «مدیریت هوشمند حافظه و کانتکست» …

⚡ /requesting-code-review SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Test-Driven Development (TDD)

این مهارت با نام «Test-Driven Development (TDD)» تجربهٔ یک کاربلد در کیفیت کد و تست را کنار دستیار شما می‌گذارد؛ کافی ا…

⚡ /test-driven-development SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Skill Creator

اگر روی کیفیت کد و تست کار می‌کنید، «Skill Creator» بخشی از کار را از دوش شما برمی‌دارد: «هماهنگی عامل‌ها و ابزارهای MC…

⚡ /skill-creator SKILL.md
Claude / Claude Code
۹۲/۱۰۰ ★ ۱۹۸,۷۹۴