Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Font size overwrite #557

Open
Manonnnn4 opened this issue Mar 28, 2019 · 7 comments
Open

Font size overwrite #557

Manonnnn4 opened this issue Mar 28, 2019 · 7 comments

Comments

@Manonnnn4
Copy link

Bug

In my report I generate finding tables using:

¬overview/paragraph¬ µzzzzµ π.π
ƒcodeƒ π.π
•	ƒbulletƒ π.π 
÷ π.π ≠

and

πnotesπ

All these use styles with font size 10 in my template. However, in the generated report, only notes, bulletted points and code is font size 10. Other text in paragraphs has font size 12. When selecting it, it has style normal(which has font size 10). This is driving me nuts. I have tried:

  • manually setting font size for the tables in the template.
  • Using a self made style in the template.
  • Editing the Normal style in the template.

Now I have to manually change the font size in my results tables for every report I make, which really defeats the point of using serpico.

Details

I inspected the xml files of the generated docx report, I see the following style elements:

Example 1: Text in template that is not modified by serpico (like title of a table):
<w:rStyle w:val="Normal-calibri10"/></w:rPr><w:t>This is displayed correctly, not generated by serpico </w:t></w:r>

Example 2: Paragraph text coming from a finding, displayed in font size 12:
<w:rStyle w:val="Normal-calibri10"/></w:rPr></w:pPr><w:r><w:t>This is NOT displayed correctly, and generated by info from findings in serpico </w:t>

Example 3: Bulletted text coming from a finding, displayed correctly in font size 10:
<w:pStyle w:val="Lijstbolniv1"/><w:rPr><w:rFonts w:asciiTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorHAnsi"/><w:sz w:val="20"/><w:szCs w:val="20"/></w:rPr></w:pPr><w:r w:rsidRPr="00D53241"><w:rPr><w:rFonts w:asciiTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorHAnsi"/><w:sz w:val="20"/><w:szCs w:val="20"/></w:rPr><w:t xml:space="preserve"> Bulleted points are correctly displayed </w:t></w:r>

Related fix

I thought that this issue should have been fixed by #525, I checked and the code of this fix is there in my helpers/xslt_generation.rb, it just did not fix the problem in my case (I have the developer build now to make sure of this, no change).

Related issue

This issue is probably related to: #223. This one was closed without a fix.

@Manonnnn4
Copy link
Author

Noteworthy: This issue only applies to text generated by:
¬overview/paragraph¬
¬poc/paragraph¬
¬remediation/paragraph¬
¬references/paragraph¬

Other "finding specific" text, like πaffected_hostsπ or πcvss_totalπ is displayed correctly.

@BuffaloWill
Copy link
Contributor

Hi @Manonnnn4 could you confirm you mean paragraph text? Tables use a different syntax (https://github.com/SerpicoProject/Serpico/wiki/Serpico-Meta-Language-In-Depth) than paragraphs.

Assuming you meant paragraphs your original code block looked like this:

¬overview/paragraph¬ µzzzzµ π.π
ƒcodeƒ π.π
•	ƒbulletƒ π.π 
÷ π.π ≠

Could you try the following? Open up your template in Word and highlight the line ÷ π.π and µzzzzµ π.π, set those to the style template you would like (e.g. paragraph, my_custom_style, etc.). Upload your template back into Serpico and re-generate the report.

That block above is a choose/when. So if you have a bullet element in your finding from the Serpico UI, then when the report is generated Word will apply the style set to π.π.

@Manonnnn4
Copy link
Author

Hi BuffoloWill, thanks for your reaction.

I did that. I've included some screenshots to show you the problem.
The test "this is the text of the finding" and "this is the risk explanation of the finding" is font size 12, instead of size 10.

Screenshot 1, the template:
serpico

Screenshot 2, the input:
serpico2

Screenshot 3, the result:
Serpico3

@BuffaloWill
Copy link
Contributor

@Manonnnn4 please check the Word style (not the font) that is applied to your template and to your report.

@Manonnnn4
Copy link
Author

I did. There seems to be something weird going on. When I define a custom style in font 10 it does not store the "font 10" part (see bottom of the first screenshot). This than gets overwritten by serpico to font size 12. If I define a style with font size 9, it is explicitly part of the style (second screenshot), and then serpico does not touch it, and the whole table turns out the way you expect it to (everything in size 9, as I defined it). Weirder still, if I inspect the normal style, it is size 10, but if I apply it, the text is in font size 12! I spent ages trying to find out why this happens the way it does. I cannot find a clue, and at this point it has cost so much time I will just have my tables in size 9. Hopefully others with the same problem find this workaround usefull, but a fix it is not.

I suspect this is some weird Word thing, not a serpico thing. You may close this issue if you want.

Defining a style with font size 10:
Serpico4

Defining a style with font size 9:
Serpico5

@sdewis
Copy link

sdewis commented Apr 19, 2019

I'm having a similar issue. I have a newly created style which explicitly specifies a white font. My template text in the my finding table is set to the new style. Every character of it. When I generate a report, Serpico reverts the regular Overview and PoC text to the Normal style, not the one I set.

Template showing the white style:
image

(^ the code ends on the next page - the table overruns in the template)

Output:
image

This must be a bug at the Serpico side, as the Style is changing from the template to the generated report. This is driving me absolutely nuts. I'm glad the OP found it too.

Cheers,

Sean

@BuffaloWill ?

@nikosev
Copy link

nikosev commented Oct 16, 2019

Hello,

I had the same issue and I managed to solve this.
In my case, I inserted a code block (symbol: ⁂) in a template with word style font set to "Arial" but the symbol was displayed in "Segoe UI Symbol" font. So, the generated document, the text that was included inside the code block was displayed in "Segoe UI Symbol" font.

To solve this I replaced all the "⁂" characters in helpers/xslt_generation.rb with "ȹ" (Latin Small Letter QP Digraph) which was supported by "Arial" font.
I choose this letter based on https://en.wikipedia.org/wiki/List_of_Unicode_characters#Latin_Extended-B (last "Miscellaneous" row).
Then restarted the server, reupload the template and generate the report and worked.

In conclusion, it seems that some special characters, that serpico has reserved, are supported from all the fonts.

I hope my feedback to help you.

Best regards,
Nick

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants