Skip to content

Commit

Permalink
Increase max tag length to 250 (#1156)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchop authored Oct 24, 2024
1 parent b224259 commit dc1f3f7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/database_arango.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ def filter(
else:
aql_string += "\nRETURN o"
aql_args["@collection"] = colname
print(f"aql_string: {aql_string}, aql_args: {aql_args}")
logging.debug(f"aql_string: {aql_string}, aql_args: {aql_args}")
documents = cls._db.aql.execute(
aql_string, bind_vars=aql_args, count=True, full_count=True
)
Expand Down
2 changes: 1 addition & 1 deletion core/schemas/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
)

MAX_TAG_LENGTH = 50
MAX_TAG_LENGTH = 250
MAX_TAGS_REQUEST = 50


Expand Down
5 changes: 3 additions & 2 deletions tests/apiv2/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,16 @@ def test_create_observable_empty_tags(self):
)

def test_create_observable_toolong_tag(self):
longtag = "a" * 300
response = client.post(
"/api/v2/observables/",
json={"value": "toto.com", "type": "hostname", "tags": ["tag1", "a" * 200]},
json={"value": "toto.com", "type": "hostname", "tags": ["tag1", longtag]},
)
data = response.json()
self.assertEqual(response.status_code, 422, data)
self.assertEqual(
data["detail"][0]["msg"],
f"Value error, Tag {'a'*200} exceeds max length (50)",
f"Value error, Tag {longtag} exceeds max length (250)",
data,
)

Expand Down

0 comments on commit dc1f3f7

Please sign in to comment.