cerebrate-project / cerebrate

Cerebrate is an open-source platform meant to act as a trusted contact information provider and interconnection orchestrator for other security tools.
https://www.cerebrate-project.org/
GNU Affero General Public License v3.0
82 stars 16 forks source link

Import of "ENISA CSIRT inventory" fails with "Undefined variable: metaTemplateUUID" #53

Closed ghost closed 3 years ago

ghost commented 3 years ago
sebastianw@cerebrate:/var/www/cerebrate$ sudo -u www-data /var/www/cerebrate/bin/cake Importer --yes /var/www/cerebrate/config-enisa-csirts-inventory.json https://www.enisa.europa.eu/topics/csirts-in-europe/csirt-inventory/certs-by-country-interactive-map/tool_data.json
Notice Error: Undefined variable: metaTemplateUUID
In [/var/www/cerebrate/src/Command/ImporterCommand.php, line 164]

2021-06-15 21:01:38 Notice: Notice (8): Undefined variable: metaTemplateUUID in [/var/www/cerebrate/src/Command/ImporterCommand.php, line 164]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE/src/Error/BaseErrorHandler.php, line 188
App\Command\ImporterCommand::marshalData() - APP/Command/ImporterCommand.php, line 164
App\Command\ImporterCommand::execute() - APP/Command/ImporterCommand.php, line 109
Cake\Console\BaseCommand::run() - CORE/src/Console/BaseCommand.php, line 179
Cake\Console\CommandRunner::runCommand() - CORE/src/Console/CommandRunner.php, line 336
Cake\Console\CommandRunner::run() - CORE/src/Console/CommandRunner.php, line 172
[main] - ROOT/bin/cake.php, line 12

Unkown template for UUID 

And /var/www/cerebrate/config-enisa-csirts-inventory.json has this content:

{
    "format": "json",
    "mapping": {
        "name": "data.{n}.short-team-name",
        "url": "data.{n}.website",
        "contacts": "data.{n}.email",
        "ISO 3166-1 Code": "data.{n}.country-code",
        "website": "data.{n}.website",
        "enisa-geo-group": "data.{n}.enisa-geo-group",
        "is-approved": "data.{n}.is_approved",
        "first-member-type": "data.{n}.first-member-type",
        "team-name": "data.{n}.team-name",
        "oes-coverage": "data.{n}.oes-coverage",
        "enisa-tistatus": "data.{n}.enisa-tistatus",
        "csirt-network-status": "data.{n}.csirt-network-status",
        "constituency": "data.{n}.constituency",
        "establishment": "data.{n}.establishment",
        "email": "data.{n}.email",
        "country-name": "data.{n}.country-name",
        "short-team-name": "data.{n}.short-team-name",
        "key": "data.{n}.key"
    },
    "metaTemplateUUID": "089c68c7-d97e-4f21-a798-159cd10f7864"
}

metaTemplateUUID is defined as specified by https://github.com/cerebrate-project/cerebrate/wiki/CLI-Tools-usage#user-content-importing-and-merging-data-from-the-enisa-csirt-inventory

We have version v0.2-38-g5e2107c installed (according to git describe).

ghost commented 3 years ago

Same error using v0.2-79-g3925c4c

mokaddem commented 3 years ago

Hey, Indeed, I forgot to include the ENISA CSIRT Network Meta-Fields template in the repository. (The one with the uuid 089c68c7-d97e-4f21-a798-159cd10f7864 that you used). It has been added on develop https://github.com/cerebrate-project/cerebrate/commit/96658779e24dd6145fc8b4509a29dcef98effa76. The undefined variable is indeed a bug and has been fixed in 45de6f8bf54b254cdf72167607f8492cc0065439 Thanks for the feedback!