-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elevator 4.0 incorrectly issues error that labels is required property for Indicator #268
Comments
Hi Chris - I think this is a validator issue... |
@CyberDaedalus00 This and your other issue indicate that your elevator is using STIX 2.0 instead of 2.1. There seems to be a bug with the elevator when using it as a Python library, where it will default to 2.0. If you use the elevator's CLI script it should default to 2.1 and not give these errors. If using the elevator as a Python library you can set the STIX version using the following code from the readme: from stix2elevator.options import initialize_options, set_option_value
initialize_options()
set_option_value("spec_version", "2.1") In the meantime we'll work to fix the bug. |
my python script looks just like what you posted, so perhaps there is another issue |
can you send us the script?? |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import os
import io
import click
import json
# Elevate a STIX 1.x via filename
# Use set_option_value to override default elevator options
# Read the documentation for options
from stix2elevator import elevate
from stix2elevator.options import initialize_options, set_option_value
##
# command line options and arguments
##
@click.command()
@click.argument('stix1_file', nargs=-1, required=True, type=click.STRING)
@click.option('--noverbose', is_flag=True, help='Turn off verbose mode.')
@click.option('--output', type=click.File(mode='w',encoding='utf-8'), help='Generates a JSON representation of the classes, namespaces, and their prefixes')
##
# command line main
##
def main(stix1_file, noverbose, output):
initialize_options()
set_option_value("missing_policy", "use-extensions")
set_option_value("spec_version", "2.1")
# click returns tuple, so have to join it into a string
results = elevate(''.join(stix1_file))
if output:
output.write( results )
else:
print(results)
if __name__ == '__main__':
main()
print("Finished") |
So here is what I think happened. The default value for the spec_version was 2.0. This caused the validator version to be 2.0 (see line 195 in options.py). The spec_version was then set to 2.1, my assumption is that there was no label, or because it generated 2.1, it used the indicator_types property instead. We are generating a patch version of the elevator, fixing the default_value, but you might use initialize_options to set the options - for instance:
|
that worked |
In accordance with STIX 2.1 CS03, the labels property is optional on all SDO's, including Indicator. Elevator 4.0 incorrectly issues an error that states that labels is a required property
[X] indicator--de6032df-6b15-4412-8405-7e8b5dc8639f: 'labels' is a required property
The text was updated successfully, but these errors were encountered: