This file is indexed.

/usr/share/openscap/xsl/xccdf-report.xsl is in libopenscap1 0.8.0-4build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2010 Red Hat Inc., Durham, North Carolina.
All Rights Reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA

Authors:
     Lukas Kuklinek <lkuklinek@redhat.com>
-->


<xsl:stylesheet version="1.1"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:cdf="http://checklists.nist.gov/xccdf/1.1"
    xmlns:exsl="http://exslt.org/common"
	xmlns:db="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:svg="http://www.w3.org/2000/svg"
	xmlns="http://docbook.org/ns/docbook"
    xmlns:s="http://open-scap.org/"
    exclude-result-prefixes="xsl cdf db s exsl"
    xmlns:ovalres="http://oval.mitre.org/XMLSchema/oval-results-5"
    >

<!--<xsl:include href="xccdf-common.xsl" />-->
<xsl:import href="security-guide.xsl" />
<xsl:import href="oval-report.xsl" />

<xsl:output method="xml" encoding="UTF-8" indent="yes"/>

<xsl:variable name='end-times'>
  <s:times>
  <xsl:for-each select='/cdf:Benchmark/cdf:TestResult/@end-time'>
    <xsl:sort order='descending'/>
    <s:t t='{.}'/>
  </xsl:for-each>
  </s:times>
</xsl:variable>

<xsl:variable name='last-test-time' select='exsl:node-set($end-times)/s:times/s:t[1]/@t'/>

<!-- parameters -->
<xsl:param name="result-id" select='/cdf:Benchmark/cdf:TestResult[@end-time=$last-test-time][last()]/@id'/>
<xsl:param name="with-target-facts"/>
<xsl:param name="show"/>
<xsl:param name='profile' select='/cdf:Benchmark/cdf:TestResult[@id=$result-id][1]/cdf:profile/@idref'/>

<!-- OVAL results parametres -->
<xsl:param name='oval-template'/>

<xsl:variable name='oval-tmpl'>
  <xsl:choose>
    <xsl:when test='not($oval-template)' />
    <xsl:when test='substring($oval-template, 1, 1) = "/"'><xsl:value-of select='$oval-template'/></xsl:when>
    <xsl:otherwise><xsl:value-of select='concat($pwd, "/", $oval-template)'/></xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xsl:variable name='result' select='$root/cdf:TestResult[@id=$result-id][1]'/>

<xsl:variable name='toshow'>
  <xsl:choose>
    <xsl:when test='substring($show, 1, 1) = "="'>,<xsl:value-of select='substring($show, 2)'/>,</xsl:when>
    <xsl:otherwise>,pass,fixed,notchecked,informational,unknown,error,fail,<xsl:value-of select='$show'/>,</xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<!-- keys -->
<xsl:key name="items" match="cdf:Group|cdf:Rule|cdf:Value" use="@id"/>
<xsl:key name="profiles" match="cdf:Profile" use="@id"/>


<!-- top-level template -->
<xsl:template match='cdf:Benchmark'>
  <xsl:choose>
    <xsl:when test='count($root/cdf:TestResult) = 0'>
      <xsl:message terminate='yes'>This benchmark does not contain any test results.</xsl:message>
    </xsl:when>
    <xsl:when test='$result-id and $result'>
      <xsl:if test='$verbosity'>
        <xsl:message>TestResult ID: <xsl:value-of select='$result-id'/></xsl:message>
        <xsl:message>Profile: <xsl:value-of select='$profile'/></xsl:message>
      </xsl:if>
      <xsl:apply-templates select='$result'/>
    </xsl:when>
    <xsl:when test='$result-id'>
      <xsl:message terminate='yes'>No such result exists.</xsl:message>
    </xsl:when>
    <xsl:otherwise>
      <xsl:message terminate='yes'>No result ID specified.</xsl:message>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match='cdf:TestResult'>
  <book xmlns='http://docbook.org/ns/docbook' version='5.0'
        xmlns:xlink="http://www.w3.org/1999/xlink"
        id='{@id}'
    >
    <info>
        <title>Security Check Result</title>
        <subtitle><phrase xlink:href='http://scap.nist.gov/specifications/xccdf/'>XCCDF</phrase> Result Report</subtitle>
        <xsl:call-template name='footerinfo'/>
    </info>

    <xsl:call-template name='summary'/>
    <xsl:call-template name='target-info'/>
    <xsl:call-template name='benchmark-info'/>
    <xsl:call-template name='score'/>
    <xsl:call-template name='rr'/>
  </book>
</xsl:template>

<xsl:template name='summary'>
  <chapter id='summary'>
    <title>Summary</title>
    
    <para>During <emphasis><xsl:value-of select='cdf:title[1]'/></emphasis> (ID <xsl:value-of select='@id'/>) processing
       <xsl:if test='cdf:benchmark'> using the <emphasis><xsl:value-of select='cdf:benchmark/@href'/></emphasis> benchmark </xsl:if>
       <xsl:if test='cdf:identity'> triggered by <emphasis><xsl:value-of select='cdf:identity'/></emphasis></xsl:if>
       which <xsl:if test='@start-time'> started <phrase role='date'><xsl:apply-templates mode='date' select='@start-time'/></phrase> and </xsl:if>
       ended <phrase role='date'><xsl:apply-templates mode='date' select='@end-time'/></phrase>,
       <xsl:value-of select='count(cdf:rule-result)'/> rule results were recorded.
    </para>

    <xsl:apply-templates select='@id|cdf:benchmark|cdf:version|@start-time|@end-time|cdf:profile|cdf:identity'/>

    <para>Target: <emphasis role='strong'><xsl:value-of select='cdf:target[1]'/></emphasis>
      <xsl:for-each select='cdf:target[position() &gt; 1]'>,
        <xsl:text>, </xsl:text><emphasis role='strong'><xsl:value-of select='.'/></emphasis>
      </xsl:for-each>
    </para>

    <table role='raw'>
      <title>Rule Results Summary</title>
      <tgroup>
        <tbody>
          <row><entry>pass</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="pass"])'/></entry></row>
          <row><entry>fixed</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="fixed"])'/></entry></row>
          <row><entry>fail</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="fail"])'/></entry></row>
          <row><entry>error</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="error"])'/></entry></row>
          <row><entry>not selected</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="notselected"])'/></entry></row>
          <row><entry>not checked</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="notchecked"])'/></entry></row>
          <row><entry>not applicable</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="notapplicable"])'/></entry></row>
          <row><entry>informational</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="informational"])'/></entry></row>
          <row><entry>unknown</entry><entry><xsl:value-of select='count(cdf:rule-result[cdf:result="unknown"])'/></entry></row>
          <row><entry><emphasis role='strong'>total</emphasis></entry><entry><xsl:value-of select='count(cdf:rule-result)'/></entry></row>
        </tbody>
      </tgroup>
    </table>
  </chapter>
</xsl:template>

<xsl:template name='target-info'>
  <chapter id='target-info'>
    <title>Target Information</title>

    <xsl:call-template name='list'>
      <xsl:with-param name='nodes' select='cdf:target' />
      <xsl:with-param name='title' select='"Target"' />
    </xsl:call-template>

    <xsl:call-template name='list'>
      <xsl:with-param name='nodes' select='cdf:target-address' />
      <xsl:with-param name='title' select='"Addresses"' />
    </xsl:call-template>

    <xsl:if test="$with-target-facts">
      <xsl:apply-templates select='cdf:target-facts' mode='result' />
    </xsl:if>
  </chapter>
</xsl:template>

<xsl:template name='benchmark-info'>
  <chapter id='benchmark-info'>
    <title>Benchmark Execution Information</title>

    <xsl:call-template name='list'>
      <xsl:with-param name='nodes' select='cdf:remark' />
      <xsl:with-param name='title' select='"Remarks"' />
    </xsl:call-template>

    <xsl:if test='cdf:platform'>
      <itemizedlist>
        <title>Platforms</title>
        <xsl:apply-templates select='cdf:platform'/>
      </itemizedlist>
    </xsl:if>

    <xsl:if test='cdf:set-value'>
      <table>
        <title>Values</title>
        <tgroup>
          <thead><row><entry>Name</entry><entry>Value</entry></row></thead>
          <tbody><xsl:apply-templates select='cdf:set-value'/></tbody>
        </tgroup>
      </table>
    </xsl:if>

    <xsl:call-template name='list'>
      <xsl:with-param name='nodes' select='cdf:organization' />
      <xsl:with-param name='title' select='"Organization"' />
    </xsl:call-template>
  </chapter>
</xsl:template>

<xsl:template name='score'>
  <chapter id='score'>
    <title>Score</title>
    <xsl:choose>
      <xsl:when test='cdf:score'><xsl:call-template name='score.table'/></xsl:when>
      <xsl:otherwise><para role='unknown'>No score results.</para></xsl:otherwise>
    </xsl:choose>
  </chapter>
</xsl:template>

<xsl:template name='score.table'>
  <table>
    <title role='hidden'>Security Score</title>
    <tgroup>
      <thead><row><entry>system</entry><entry>score</entry><entry>max</entry><entry>bar</entry></row></thead>
      <tbody><xsl:apply-templates select='cdf:score'/></tbody>
    </tgroup>
  </table>
</xsl:template>

<xsl:template name='rr'>
  <xsl:variable name='results' select='cdf:rule-result[contains($toshow, concat(",",cdf:result,",")) and not(contains($toshow, concat(",-",cdf:result,",")))]'/>

  <chapter id='results'>
    <title>Results</title>
    <xsl:choose>
      <xsl:when test='$results'>
        <xsl:apply-templates select='.' mode='rr.table'><xsl:with-param name='results' select='$results'/></xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise><para role='unknown'>No rule results.</para></xsl:otherwise>
    </xsl:choose>
    <xsl:apply-templates select='$results'/>
  </chapter>
</xsl:template>

<xsl:template match='cdf:rule-result'>
  <xsl:variable name='rule' select="key('items',@idref)"/>

  <section id='ruleresult-{generate-id(.)}' role='result-detail'>
    <title>Result for <xsl:value-of select='($rule/cdf:title[1]|@idref)[1]'/></title>
    <para role="result-{normalize-space(cdf:result)}">Result: <emphasis role='strong'><xsl:value-of select="cdf:result"/></emphasis></para>
    <para>Rule ID: <emphasis role='strong'><xsl:value-of select="@idref"/></emphasis></para>

    <xsl:apply-templates select='@time'/>
    <xsl:apply-templates select='@severity'/>
    <xsl:call-template name='rr.instance'/>
    <xsl:apply-templates select='$rule/cdf:description[1]'/>
    <xsl:apply-templates select='$rule/cdf:warning[1]'/>
    <xsl:apply-templates select='$rule/cdf:rationale[1]'/>
    <xsl:call-template name='idents'/>
    <!-- overrides (n) -->
    <!-- messages (n) -->
    <xsl:apply-templates select='$rule/cdf:fixtext[1]'/>
    <xsl:apply-templates select='($rule/cdf:fix|cdf:fix)[last()]'/>
    <xsl:apply-templates select='.' mode='engine-results'/>
    <xsl:call-template name='references'/>
  </section>
</xsl:template>

<xsl:template mode='rr.table' match='cdf:TestResult'>
  <xsl:param name='results'/>
  <table>
    <title role='hidden'>Rule results summary</title>
    <tgroup>
      <thead><row><entry>Title</entry><entry>Result</entry><entry>more</entry></row></thead>
      <tbody><xsl:apply-templates select='$results' mode='rr.table'/></tbody>
    </tgroup>
  </table>
</xsl:template>

<xsl:template mode='rr.table' match='cdf:rule-result'>
  <row role='result-{normalize-space(cdf:result)}'>
    <entry role='id'    ><xsl:value-of select='(key("items",@idref)/cdf:title[1]|@idref)[1]'/></entry>
    <entry role='result'><emphasis role='strong'><xsl:value-of select='normalize-space(cdf:result)'/></emphasis></entry>
    <entry role='link'  ><phrase xlink:href='#ruleresult-{generate-id(.)}'>view</phrase></entry>
  </row>
</xsl:template>

<xsl:template name='rr.instance'>
  <xsl:if test='cdf:instance'>
    <itemizedlist><title>Instance</title><xsl:apply-templates select='cdf:instance'/></itemizedlist>
  </xsl:if>
</xsl:template>

<xsl:template match='cdf:instance'>
  <listitem><simpara><xsl:value-of select='.'/>
         <xsl:if test='@context'> [context: <xsl:value-of select='@context'/>]</xsl:if>
         <xsl:if test='@parentContext'> [parent context: <xsl:value-of select='@parentContext'/>]</xsl:if>
  </simpara></listitem>
</xsl:template>

<xsl:template match='cdf:benchmark'>
    <para>Used XCDF benchmark URI: <emphasis role='strong'><xsl:value-of select='@href'/></emphasis></para>
</xsl:template>

<xsl:template match='cdf:test-result/cdf:status'>
  <para>
    <xsl:text>Status: </xsl:text><emphasis role='strong'><xsl:value-of select='normalize-space(.)'/></emphasis>
    <xsl:if test='@date'>(as of <phrase role='date'><xsl:value-of select='@date'/></phrase>)</xsl:if>
  </para>
</xsl:template>

<xsl:template match='@id'>
    <para>Result ID: <emphasis role='strong'><xsl:value-of select='.'/></emphasis></para>
</xsl:template>

<xsl:template match='@severity'>
    <para>Severity: <emphasis role='strong'><xsl:value-of select='.'/></emphasis></para>
</xsl:template>

<xsl:template match='cdf:identity'>
    <para>Identity: <emphasis role='strong'><xsl:value-of select='.'/></emphasis>
      (<xsl:if test='@authenticated!="1" and @authenticated!="true"'>not </xsl:if>authenticated, <xsl:if test='@privileged!="1" and @privileged!="true"'>not </xsl:if>privileged)</para>
</xsl:template>

<xsl:template match='@end-time'>
    <para>End time: <emphasis role='strong'><phrase role='date'><xsl:apply-templates mode='date' select='.'/></phrase></emphasis></para>
</xsl:template>

<xsl:template match='@start-time'>
    <para>Start time: <emphasis role='strong'><phrase role='date'><xsl:apply-templates mode='date' select='.'/></phrase></emphasis></para>
</xsl:template>

<xsl:template match='@time'>
    <para>Time: <emphasis role='strong'><phrase role='date'><xsl:apply-templates mode='date' select='.'/></phrase></emphasis></para>
</xsl:template>

<xsl:template match='cdf:profile'>
    <para>Profile: <emphasis role='strong'><xsl:value-of select='@idref'/></emphasis></para>
</xsl:template>

<xsl:template match='cdf:target-facts'>
  <table>
    <title>Target facts</title>
    <tgroup>
      <thead><row><entry>Fact</entry><entry>Value</entry></row></thead>
      <tbody>
        <xsl:apply-templates select='cdf:fact'/>
      </tbody>
    </tgroup>
  </table>
</xsl:template>

<xsl:template match='cdf:fact'>
  <row><entry><xsl:value-of select='@name'/></entry><entry><xsl:value-of select='.'/></entry></row>
</xsl:template>

<xsl:template match='cdf:set-value'>
  <row><entry><xsl:value-of select='(key("items",@idref)/cdf:title[1]|@idref)[1]'/></entry><entry><xsl:value-of select='.'/></entry></row>
</xsl:template>

<xsl:template match='cdf:score'>
  <xsl:variable name='max'>
    <xsl:choose>
      <xsl:when test='@maximum'><xsl:value-of select='@maximum'/></xsl:when>
      <xsl:otherwise>100</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name='percent' select='number(.) div number($max)'/>
  <xsl:variable name='format' select="'#.00'"/>

  <row id='score-{translate(@system, ":", "-")}'>
    <entry role='score-sys'><xsl:value-of select='@system' /></entry>
    <entry role='score-val'><xsl:value-of select='format-number(string(.), $format)' /></entry>
    <entry role='score-max'><xsl:value-of select='format-number($max, $format)' /></entry>
    <entry role='score-bar'>
      <inlinemediaobject role='score-bar'>
        <imageobject>
          <imagedata format='SVG'>
            <svg:svg width="100%" height="100%" version="1.1" baseProfile="full">
              <svg:rect width="100%" height="100%" fill="red"/>
              <svg:rect height="100%" width="{format-number($percent, '#.00%')}" fill="green"/>
            </svg:svg>
          </imagedata>
        </imageobject>
        <textobject><phrase><xsl:value-of select='format-number($percent, "#.0%")'/></phrase></textobject>
      </inlinemediaobject>
    </entry>
  </row>
</xsl:template>

<!-- TOC adjustment (switch off) -->
<xsl:template mode='dbout.html.toc' match='db:chapter'/>


<!-- checking engine results related templates (currently just oval) -->
<xsl:template match='cdf:rule-result' mode='engine-results'>
  <xsl:if test='contains(",fixed,fail,", concat(",", normalize-space(cdf:result), ","))'>
    <xsl:apply-templates mode='engine-results' select='key("items", @idref)'/>
  </xsl:if>
</xsl:template>

<xsl:template match='cdf:Rule' mode='engine-results'>
    <xsl:apply-templates mode='engine-results' select='cdf:check'/>
</xsl:template>

<xsl:template match='cdf:check[starts-with(@system, "http://oval.mitre.org/XMLSchema/oval")]' mode='engine-results'>
  <xsl:apply-templates mode='engine-results' select='cdf:check-content-ref[1]'/>
</xsl:template>

<xsl:template match='cdf:check-content-ref' mode='engine-results'>

  <xsl:variable name='filename'>
    <xsl:choose>
      <xsl:when test='contains($oval-tmpl, "%")'><xsl:value-of select='concat(substring-before($oval-tmpl, "%"), @href, substring-after($oval-tmpl, "%"))'/></xsl:when>
      <xsl:otherwise><xsl:value-of select='$oval-tmpl'/></xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:if test='$oval-tmpl'>
    <xsl:apply-templates select='document($filename)/ovalres:oval_results' mode='brief'>
      <xsl:with-param name='definition-id' select='@name'/>
    </xsl:apply-templates>
  </xsl:if>

</xsl:template>

<xsl:template match='node()' mode='engine-results'/>
</xsl:stylesheet>