[Connectors] Refactor YETI to API v2 payload and auth schemas#3736
[Connectors] Refactor YETI to API v2 payload and auth schemas#3736sanjib2006 wants to merge 5 commits into
Conversation
|
|
||
| if self._url_key_name and self._url_key_name.endswith("/"): | ||
| self._url_key_name = self._url_key_name[:-1] | ||
| url = f"{self._url_key_name}/api/v2/observables/" |
There was a problem hiding this comment.
/api/v2/observables/in current version of yeti this endpoint accepts tags, value and type only
Check here
| # create observable with `obs_value` if it doesn't exists | ||
| # new context, tags, source are appended with existing ones | ||
|
|
||
| url = f"{self._url_key_name}/api/v2/observables/extended" |
There was a problem hiding this comment.
/api/v2/observables/extendedwe can send extra context through this endpoint only
Check here
| "observable": { | ||
| # there are type mismatches between YETI and IntelOwl | ||
| # so for now we are not senging the type to YETI | ||
| # "type": obs_type, |
There was a problem hiding this comment.
Without providing the type it defaults to jarm. Check the screenshot.
|
Regarding the These are the supported types in YETI. I am not sure about how v1 was working but I have checked v2 properly.
|
|
I will add the related tests and do something for the |
| "report": f"{settings.WEB_CLIENT_URL}/jobs/{self.job_id}", | ||
| "status": "analyzed", | ||
| "date": str(self._job.finished_analysis_time), | ||
| "date": str(self._job.received_request_time), |
There was a problem hiding this comment.
getting NULL (check the first screenshot) probable reason is race condition so I replaced it with the received_request_time
| obs_type = self._job.analyzable.classification | ||
|
|
||
| # convert obs_type to YETI's expected types if possible | ||
| if obs_type == "ip": |
There was a problem hiding this comment.
these three were conflicting
- ip - converting it to ipv4 or ipv6 (generic if any problem)
- domain to hostname
- about hash there are multiple types so for now I am making it generic
| "status": "analyzed", | ||
| "date": str(self._job.finished_analysis_time), | ||
| "date": str(self._job.received_request_time), | ||
| "description": f"IntelOwl's analysis report for Job: {self.job_id} | {obs_value} | {obs_type}", |
There was a problem hiding this comment.
Since we changed obs_type to match the YETI, this context will also contain the YETI types and not Intelowl
|
Hello @mlodic! |
mlodic
left a comment
There was a problem hiding this comment.
a question: why the IP address is classified as JARM in this case?
|
|
||
| # auth | ||
| auth_url = f"{self._url_key_name}/api/v2/auth/api-token" | ||
| auth_headers = {"x-yeti-apikey": self._api_key_name} |
There was a problem hiding this comment.
both here and in the subsequent headers request we can customize it to add "IntelOwl" as user agent. This is common practice to help detecting integrations requests.
There was a problem hiding this comment.
I have added the user agent in the latest commit
|
|
||
| # create context | ||
| context = { | ||
| "source": "IntelOwl", |
There was a problem hiding this comment.
should the source removed here too in favor of an user-agent string?
I checked it, the intended response if type parameter is not provided is to raise an error but this endpoint is working without sending type because of a syntax bug Check this line The parameter here should be I have raised an issue for this yeti-platform/yeti#1273 |






Closes #3707
Description
Type of change
Please delete options that are not relevant.
Checklist
gsoc-2026/connectors# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl # See the file 'LICENSE' for copying permission.Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.testsfolder). All the tests (new and old ones) gave 0 errors.