CodamAIDocs
Topicdone

What CRMS is

A report is a template plus data. What CRMS takes care of, what it does not do on purpose, and why the application prepares the data.

Variants
Preview (PREVIEW)final document (FINAL)transient document (TRANSIENT)

What this is about

CRMS stands for CodamAI Reporting Management System. It produces reports: PDF, HTML, Word files and spreadsheets. A report is always made of two parts:

  • the template: it defines what the report looks like. It is written in FreeMarker, a template language with placeholders like ${customer.name}.
  • the payload: the data for exactly this one report, for example the customer, the date and the items of an audit.

CRMS puts the payload into the template and returns the finished document.

A report is created

  1. 1
    User→Client
    clicks "Create report"
  2. 2
    Client→CDMS
    reads the data that belongs in the report and prepares it
  3. 3
    Client→CRMS
    sends a render request: template key, format, mode and payload
  4. 4
    CRMS→CIAS
    asks who is calling and in which tenant
  5. 5
    CRMS
    looks up the published revision of the template that applies to this person
  6. 6
    CRMS
    checks the payload before the template sees it
  7. 7
    CRMS
    Payload breaks the rules → 422 with every violation
  8. 8
    CRMS
    inserts the payload in a sealed-off environment and produces the format
  9. 9
    CRMS→File storage
    stores a final document encrypted, only in mode FINAL
  10. 10
    CRMS→Client
    returns the document
    Result: The bytes of the document, plus key, scope, language, revision and hash of the template it came from

Every document says which revision of the template it comes from. A revision is a fixed state of the template that can no longer be changed. This way you can prove later which text a report was produced with.

What CRMS does and what it does not

The tasks of CRMS
CRMS does
templates and documents
  • manages templates with language variants and revisions
  • releases templates through an approval chain
  • checks the payload
  • renders PDF, HTML, DOCX, XLSX, CSV and ODS
  • stores final documents in a hash chain
  • verifies them and keeps them until their retention ends
CRMS does not
that stays with the application
  • reads no business data, not from CDMS either
  • changes no business data
  • does not calculate: no sums, no formulas
  • does not decide when a report is created
  • manages no users and roles, CIAS does that

Why the application prepares the data

A template is written in the running system, by people with a template role. That is why it may do nothing but insert values:

  • No access to Java. The template cannot create classes and cannot call methods. FreeMarker built-ins like ?new and ?api are switched off.
  • Only prepared values in the payload: text, numbers, booleans, date and point in time, plus lists and objects of these. An arbitrary Java object is refused, because it would hand the template its methods.
  • At most two levels deep: title, customer.name, items[].amount. Whatever the template needs, the application prepares flat.
  • No files from outside. Images, fonts and style sheets only come from the template itself (asset:<name>) or from the request (attachment:<name>). Every other address is refused before it is called.
  • No formulas. A spreadsheet also holds only finished values. A formula assembled from a payload value would be a way in for attackers.

How the payload is checked exactly is described in The payload check.

Three modes

Every render request names a mode. It decides whether the document is stored.

PREVIEWFINALTRANSIENT
storedneveryes, as the next revision of its document chainnever
markervisible watermark and marker crms-previewnone, it is the originalonly the marker crms-transient in the metadata
what forcheck what a report looks likethe report that countsa copy to download, only from system templates

The details are described in Preview, final, transient.

Pitfalls

Next

Search