-
Notifications
You must be signed in to change notification settings - Fork 58
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
Question OOIs with json-schema #288
Comments
For our first usecase we will create a bit that does the following: For each network (currently only the Internet is added to the graph regularly) trigger a bit.
Render this json schema as a form with 3 questions, with 2 sub-questions, etc. When the user submits this form the following data (for example) should be posted to Rocky and stored in Bytes:
Which in turn is ingested by a normaliser who understands the context for this raw file (eg, which bit created the original questionOOI), and this would in turn produce ConfigBIT bound to the original Network the QuestionOOI was bound to. |
After discussion with @underdarknl : The configOOIs that come from normalizing answers will be saved in the graph. For example, the configOOI of the above vulnerable ports will be attached to the Network. In the bit config we will add a parameter that indicates which ooi has the config. In the example of the ports, it will say: ip_port.ip_address.network. The bit runner can then query the config attached to this ooi and pass it to the bit. In the future, we can make these locations into in prioritized list so that the config ooi attached to the ip_address has priority over the ooi attached to the network. In the first version we will make the location of the config a relation of the input ooi (ip_port.ip_address.network), in the future we can make it queriable (io_service.ip_port). OctopoesV3 might also make this easier with graphql queries. |
As a note: this means that the set of OOI's that can be used to attach a Config is limited to the connected component of the input OOI of the bit and must be higher up the hierarchy (or the input OOI itself). |
Correct |
I wrote a query that could resolve to the right Config object immediately for the first use-case: What we are trying to accomplish in this first example in the PR: classDiagram
direction LR
class Network
class Hostname
class Website
class HTTPResource
class Config
Config : bit_id
Config : ooi
Network : name
Hostname : network
Website : hostname
HTTPResource : website
Network <|-- Config
Network <|-- Hostname
Hostname <|-- Website
Website <|-- HTTPResource
is to get the {:query
{:find [(pull config [*])]
:where [
[e :xt/id pkey]
[e :HTTPResource/website f]
[f :Website/hostname g]
[g :Hostname/network h]
[config :Config/ooi h]
[config :Config/bid_id bit_id]
]
}
} I am not sure if this would be possible to do with the current query functionality in Octopoes (@Lisser ?). |
We need to be careful with paths that traverse through edges on abstract classes:
{:query
{:find [(pull port [*])]
:where [
[port :xt/id port_id]
[port :IPPort/address ip_addr]
(or [ip_addr :IPV4Address/network network]
[ip_addr :IPV6Address/network network])
[config :Config/ooi network]
[config :Config/bid_id bit_id]
]
}
} |
This worked to find a Finding on internet from an IPPort (V6 and V4): {:query
{:find [(pull finding [*])]
:where [
[e :xt/id "IPPort|internet|xxxx::xxxxx|tcp|23"]
[e :IPPort/address f]
( or
[f :IPAddressV4/network n]
[f :IPAddressV6/network n]
)
[finding :Finding/ooi n]
[finding :Finding/finding_type "KATFindingType|KAT-500"]
]
}
} |
Per the discussion of today with @underdarknl we decided to not allow more than 2 levels deep for the json schema Questions. @dekkers posed this question during standup again yesterday, and I have to say that I agree given:
We will never be able to remove some the element of trusting the user on their answers, so we will have to find a middle ground between muting findings with plain text reasons and having a full adaptive procedure workflow as described in this ticket. This means that we can probably soon finish this ticket. We do still have to consider:
|
It should be possible to use KAT with hunderds of organisations. How can a user make changes to the configuration for all organisations at the same time? How can a default be configured so that new organisations get the right config? When we support multiple network in the future, if a new network is added, how will a network get the right default config? |
@dekkers Valid points, and I think adding Questions in response to adding a One assumption here is that any configuration needed to run Bits must live in XTDB, and in particular the graph relevant to the current organisation, which forces us to apply some variant of a composite pattern with respect to configuration management for Bits. This is not the case for Boefjes/Normalizers of course (Katalogus), where we actually implemented this copy-from-organization as well. If we loosen this assumption we could also consider some "central" configuration service/database that is consulted at runtime. I personally think having XTDB, the Katalogus ánd env vars as configuration options is far from optimal in the first place. This issue has turned a bit twofold: on the one hand Config OOIs and on the other Question OOIs that could be used to generate Config OOIs, but are for a large part also brought to live for handling procedures. |
I want to add that most questions are only relevant if you want to deviate from default. For most people, the default would be okay. |
See #130
Draft PR: #1394
Some considerations:
We might need to generate id's for questionsUnique Questions per OOI are probably fine?Adding a identifier field in the answerAdding an argument (but I'm not a fan of the mostly unused arguments field, see Consider removing the arguments field of BoefjeMeta #763)Try to infer it through the input_ooiThis will not work if we start attaching multiple configs to a Network.Still, Rocky (saving the raw file) needs to know what the "type" of Question is, so somehow the Question object (either as a field or in its schema) needs to carry an identifier.
Questions:
Config flow and cardinality:
Resulting ERD:
The Flow
Generating Question (forms)
To create question OOI's:
The text was updated successfully, but these errors were encountered: