Skip to content

Commit

Permalink
fix: improved versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
nullswan committed Jul 21, 2022
1 parent f3a0d1d commit f739379
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions graphinder/io/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@


def gql_endpoints_characterizer() -> list[str]:
"""return list of most common GQL endpoints."""
"""Return list of most common GQL endpoints.
- Versioning has a huge cost on the performance of the scanner.
- We try to minimize the cost by using the most common endpoints only.
"""

characterizers: list[str] = [
'graphql',
Expand Down Expand Up @@ -33,7 +37,7 @@ def gql_endpoints_characterizer() -> list[str]:
versioned_characterizers: list[str] = []
versions = ['v1', 'v2']
for version in versions:
for char in characterizers:
for char in characterizers[:8]:
if any(v in char for v in versions):
continue
versioned_characterizers.append(f'{version}/{char}')
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "graphinder"
version = "1.7.2"
version = "1.7.3"
description = "Escape Graphinder"
authors = ["Escape Technologies SAS <ping@escape.tech>"]
maintainers = [
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/io/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def test_gql_endpoints_characterizer() -> None:
endpoints = gql_endpoints_characterizer()

assert len(endpoints) == len(set(endpoints)), 'There should be no duplicates.'
assert len(endpoints) == (23*3) - 4, 'There should be no more endpoints. Please update the test if you added more.'
assert len(endpoints) == 23 + (2*8), 'There should be no more endpoints. Please update the test if you added more.'

0 comments on commit f739379

Please sign in to comment.