Skip to content
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

Validate alert's TLP and severity attributes values #326

Closed
rolinh opened this issue Sep 27, 2017 · 1 comment
Closed

Validate alert's TLP and severity attributes values #326

rolinh opened this issue Sep 27, 2017 · 1 comment
Assignees
Labels

Comments

@rolinh
Copy link

rolinh commented Sep 27, 2017

Request Type

Bug

Work Environment

Question Answer
OS version (server) Ubuntu
TheHive version 2.13.1
Package Type DEB

Problem Description

When creating a new alert using an HTTP POST request to the /api/alert endpoint, it is possible to provide invalid TLP and/or severity attributes values and the API will happily accept it (for example, a TLP value of 42 and a severity value of -273).
Only valid values for these attributes should be accepted, ie (per the doc):

  • TLP: (-1: unknown; 0: white; 1: green; 2: amber; 3: red)
  • severity: (0: not set; 1: low; 2: medium; 3: high)

The UI is confused when the TLP or severity values of alerts or cases are invalid (see screenshot).

Steps to Reproduce

curl -XPOST -H 'Authorization: Bearer ***API*KEY***' -H 'Content-Type: application/json' http://127.0.0.1:9000/api/alert -d '{
  "title": "New Alert",
  "description": "N/A",
  "type": "external",
  "source": "instance1",
  "sourceRef": "alert-ref",
  "tlp": 42,
  "severity": -273
}'

Possible Solutions

The API shall return a 400 HTTP status code with a message pointing at the wrong attribute(s) value(s) when one of the TLP or severity attribute value is out of range.

Complementary information

image

@saadkadhi saadkadhi added the bug label Sep 28, 2017
@saadkadhi saadkadhi added this to the 3.0.0 milestone Sep 28, 2017
@saadkadhi
Copy link
Contributor

Nice catch @rolinh ! We'll take care of it as soon as feasible.

To-om added a commit that referenced this issue Oct 12, 2017
@To-om To-om closed this as completed Oct 12, 2017
nadouani pushed a commit that referenced this issue Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants