jenglish / ssptool

nodejs / express application for working with OpenControl data
MIT License
3 stars 5 forks source link

TypeError: /var/www/html/SecurityCentral/ssptool/views/pgbody/control.pug:25 #8

Closed shawndwells closed 6 years ago

shawndwells commented 6 years ago

After december updates, now receiving this error on most controls:

image

Internal error
/var/www/html/SecurityCentral/ssptool/views/pgbody/control.pug:25 23| each sat in satisfied 24| h3 > 25| | #{sat.component.name} #{""} 26| small #[+showThe(sat, 'implementation_status')] 27| +narrative-block(sat.narrative) 28| else if certifications && certifications.length Cannot read property 'name' of undefined

path
/certifications/DHS-4300A/NIST-800-53/AU-8
TypeError: /var/www/html/SecurityCentral/ssptool/views/pgbody/control.pug:25
    23|   each sat in satisfied
    24|     h3
  > 25|       | #{sat.component.name} #{""}
    26|       small #[+showThe(sat, 'implementation_status')]
    27|     +narrative-block(sat.narrative)
    28| else if certifications && certifications.length

Cannot read property 'name' of undefined
    at eval (eval at wrap (/var/www/html/SecurityCentral/ssptool/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:873:71)
    at eval (eval at wrap (/var/www/html/SecurityCentral/ssptool/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:914:4)
    at template (eval at wrap (/var/www/html/SecurityCentral/ssptool/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:950:244)
    at Object.exports.renderFile (/var/www/html/SecurityCentral/ssptool/node_modules/pug/lib/index.js:418:38)
    at Object.exports.renderFile (/var/www/html/SecurityCentral/ssptool/node_modules/pug/lib/index.js:408:21)
    at View.exports.__express [as engine] (/var/www/html/SecurityCentral/ssptool/node_modules/pug/lib/index.js:455:11)
    at View.render (/var/www/html/SecurityCentral/ssptool/node_modules/express/lib/view.js:127:8)
    at tryRender (/var/www/html/SecurityCentral/ssptool/node_modules/express/lib/application.js:640:10)
    at Function.render (/var/www/html/SecurityCentral/ssptool/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/var/www/html/SecurityCentral/ssptool/node_modules/express/lib/response.js:971:7)

This can be reproduced by using this as your opencontrol.yaml:

schema_version: "1.0.0"
name: Template Information System
metadata:
  description: Template Information System
  maintainers:
    - Shawn Wells <shawn@redhat.com>

components:
#    - ./SI-System_and_Information_Integrity

dependencies:
  standards:
    - url: https://github.com/opencontrol/standards
      revision: master
  certifications:
    - url: https://github.com/SecurityCentral/opencontrol-certifications
      revision: master
  systems:
    - url: https://github.com/ComplianceCenter/template-system-process-controls
      revision: opencontrol
    - url: https://github.com/ComplianceCenter/redhat-openstack-platform-13
      revision: opencontrol
jenglish commented 6 years ago

Cause of problem: queries.findControl() neglected to fully populate the "Satisfied By" list with linked component information.

Notes: problem is order-dependant -- visiting the relevant component page first, then returning to the control page and the error goes away. This could be why this bug wasn't caught in testing.

Fix on the way.

shawndwells commented 6 years ago

Rebased and works great. Thank you!!