Security Reporting
caution
Security Reporting is in preview. PDF output uses Primus.PdfGenerator when configured; otherwise the fallback formatter returns a text placeholder. Compliance scores are heuristic and do not certify standards.
Overview
Security Reporting generates PDF or HTML reports from security scan results and exposes optional HTTP endpoints for on-demand report generation. It is designed to run locally and return report bytes directly to the caller.
Integration Guide
Step 1: Install the package
dotnet add package PrimusSaaS.Security.Reporting
If you want the built-in endpoints to run scans before generating reports, also install:
dotnet add package PrimusSaaS.Security
For production-grade PDF output, add the PDF generator package:
dotnet add package PrimusSaaS.PdfGenerator
Step 2: Configure Program.cs
using PrimusSaaS.Security.Reporting;
using PrimusSaaS.Security;
using Primus.PdfGenerator;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddPrimusSecurity(options =>
builder.Configuration.GetSection("PrimusSecurity").Bind(options));
builder.Services.AddPrimusSecurityReporting(options =>
builder.Configuration.GetSection("PrimusSecurityReporting").Bind(options));
// Optional but recommended for real PDF output
builder.Services.AddPrimusPdfGenerator();
var app = builder.Build();
Step 3: Configure appsettings.json
{
"PrimusSecurityReporting": {
"EnablePdfExport": true,
"EnableHtmlExport": true,
"EnableJsonExport": true,
"TemplatesPath": "report-templates",
"OutputPath": "security-reports"
}
}
How to get configuration values
TemplatesPathandOutputPathare local directories for custom templates and output defaults.- Endpoints return report bytes directly; these paths are used for internal defaults and future extensions.
Step 4: Configure endpoint
app.MapPrimusSecurityReportingEndpoints();
app.Run();
This exposes:
POST /api/securityreporting/generate-pdfPOST /api/securityreporting/generate-htmlPOST /api/securityreporting/compliance-reportPOST /api/securityreporting/executive-summaryGET /api/securityreporting/templates
Step 5: Test the endpoint
curl -X POST http://localhost:5000/api/securityreporting/generate-pdf \
-H "Content-Type: application/json" \
-d '{ "path": "./", "reportTitle": "Baseline Security Report" }'
The response returns a PDF file stream. Use -o report.pdf to save it locally.