Skip to content

Commit 87b4808

Browse files
authored
Rename LibraryVersion to ComponentVersion, and ComponentVersion.library to ComponentVersion.name (#4378)
1 parent 063d614 commit 87b4808

90 files changed

Lines changed: 257 additions & 247 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

conftest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from utils._context._scenarios import scenarios, Scenario
2121
from utils._logger import logger
2222
from utils.scripts.junit_report import junit_modifyreport
23-
from utils._context.library_version import LibraryVersion
23+
from utils._context.component_version import ComponentVersion
2424
from utils._decorators import released, configure as configure_decorators
2525
from utils.properties_serialization import SetupProperties
2626

@@ -237,7 +237,7 @@ def _get_skip_reason_from_marker(marker: pytest.Mark) -> str | None:
237237
def pytest_pycollect_makemodule(module_path: Path, parent: pytest.Session) -> None | pytest.Module:
238238
# As now, declaration only works for tracers at module level
239239

240-
library = context.library.library
240+
library = context.library.name
241241

242242
manifests = load_manifests()
243243

@@ -487,7 +487,9 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus: int) -> None:
487487
if context.scenario.is_main_worker:
488488
with open(f"{context.scenario.host_log_folder}/known_versions.json", "w", encoding="utf-8") as f:
489489
json.dump(
490-
{library: sorted(versions) for library, versions in LibraryVersion.known_versions.items()}, f, indent=2
490+
{library: sorted(versions) for library, versions in ComponentVersion.known_versions.items()},
491+
f,
492+
indent=2,
491493
)
492494

493495
data = session.config._json_report.report # noqa: SLF001
@@ -510,7 +512,7 @@ def export_feature_parity_dashboard(session: pytest.Session, data: dict) -> None
510512
"runDate": data["created"],
511513
"environment": session.config.option.report_environment or "local",
512514
"testSource": "systemtests",
513-
"language": context.library.library,
515+
"language": context.library.name,
514516
"variant": context.weblog_variant,
515517
"testedDependencies": [
516518
{"name": name, "version": str(version)} for name, version in context.scenario.components.items()

docs/scenarios/docker_ssi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class TestDockerSSIFeatures:
376376
377377
@features.ssi_guardrails
378378
def test_install_supported_runtime(self):
379-
logger.info(f"Testing Docker SSI installation on supported lang runtime: {context.scenario.library.library}")
379+
logger.info(f"Testing Docker SSI installation on supported lang runtime: {context.scenario.library.name}")
380380
assert self.r.status_code == 200, f"Failed to get response from {context.scenario.weblog_url}"
381381
382382
# If the language version is supported there are traces related with the request

docs/weblog/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ Returns a JSON dict, with those values :
811811
{
812812
"status": "ok",
813813
"library": {
814-
"language": "<language>", // one of cpp, dotnet, golang, java, nodejs, php, python, ruby
814+
"name": "<library's name>", // one of cpp, cpp_nginx, cpp_httpd, dotnet, golang, java, nodejs, php, python, ruby
815815
"version": "1.2.3" // version of the library
816816
}
817817
}

tests/appsec/iast/sink/test_hardcoded_passwords.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_hardcoded_passwords_exec(self):
3939
assert vuln["location"]["path"] == self._get_expectation(self.location_map)
4040

4141
def _get_expectation(self, d):
42-
expected = d.get(context.library.library)
42+
expected = d.get(context.library.name)
4343
if isinstance(expected, dict):
4444
expected = expected.get(context.weblog_variant)
4545
return expected
@@ -75,5 +75,5 @@ def test_extended_location_data(self):
7575

7676
assert all(field in location for field in ["path", "line"])
7777

78-
if context.library.library not in ("python", "nodejs"):
78+
if context.library.name not in ("python", "nodejs"):
7979
assert all(field in location for field in ["class", "method"])

tests/appsec/iast/sink/test_hardcoded_secrets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
def get_expectation(d):
15-
expected = d.get(context.library.library)
15+
expected = d.get(context.library.name)
1616
if isinstance(expected, dict):
1717
expected = expected.get(context.weblog_variant)
1818
return expected
@@ -102,5 +102,5 @@ def test_extended_location_data(self):
102102

103103
assert all(field in location for field in ["path", "line"])
104104

105-
if context.library.library not in ("python", "nodejs"):
105+
if context.library.name not in ("python", "nodejs"):
106106
assert all(field in location for field in ["class", "method"])

tests/appsec/iast/sink/test_unvalidated_redirect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def _expected_location():
10-
if context.library.library == "java":
10+
if context.library.name == "java":
1111
if context.weblog_variant.startswith("spring-boot"):
1212
return "com.datadoghq.system_tests.springboot.AppSecIast"
1313
if context.weblog_variant == "resteasy-netty3":
@@ -18,7 +18,7 @@ def _expected_location():
1818
return "com.datadoghq.vertx3.iast.routes.IastSinkRouteProvider"
1919
if context.weblog_variant == "vertx4":
2020
return "com.datadoghq.vertx4.iast.routes.IastSinkRouteProvider"
21-
if context.library.library == "nodejs":
21+
if context.library.name == "nodejs":
2222
if context.weblog_variant in ("express4", "express5"):
2323
return "iast/index.js"
2424
if context.weblog_variant == "express4-typescript":

tests/appsec/iast/sink/test_unvalidated_redirect_forward.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def _expected_location():
10-
if context.library.library == "java":
10+
if context.library.name == "java":
1111
if context.weblog_variant.startswith("spring-boot"):
1212
return "com.datadoghq.system_tests.springboot.AppSecIast"
1313
if context.weblog_variant == "vertx3":

tests/appsec/iast/sink/test_weak_hash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212

1313

1414
def _expected_location() -> str | None:
15-
if context.library.library == "java":
15+
if context.library.name == "java":
1616
return "com.datadoghq.system_tests.iast.utils.CryptoExamples"
1717

18-
if context.library.library == "nodejs":
18+
if context.library.name == "nodejs":
1919
if context.weblog_variant in ("express4", "express5"):
2020
return "iast/index.js"
2121
if context.weblog_variant == "express4-typescript":
2222
return "iast.ts"
2323

24-
if context.library.library == "python":
24+
if context.library.name == "python":
2525
if context.library.version >= "1.12.0":
2626
return "iast.py"
2727
# old value: absolute path
@@ -33,7 +33,7 @@ def _expected_location() -> str | None:
3333

3434

3535
def _expected_evidence() -> str:
36-
if context.library.library == "dotnet":
36+
if context.library.name == "dotnet":
3737
return "MD5"
3838
else:
3939
return "md5"

tests/appsec/iast/source/test_header_name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class TestHeaderName(BaseSourceTest):
1111
"""Verify that request headers name are tainted"""
1212

13-
source_name = "User" if context.library.library == "python" else "user"
13+
source_name = "User" if context.library.name == "python" else "user"
1414

1515
endpoint = "/iast/source/headername/test"
1616
requests_kwargs = [{"method": "GET", "headers": {"user": "unused"}}]

tests/appsec/iast/source/test_header_value.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TestHeaderValue(BaseSourceTest):
1111
"""Verify that request headers are tainted"""
1212

1313
source_name = (
14-
"HTTP_TABLE" if context.library.library == "python" and context.weblog_variant == "django-poc" else "table"
14+
"HTTP_TABLE" if context.library.name == "python" and context.weblog_variant == "django-poc" else "table"
1515
)
1616

1717
endpoint = "/iast/source/header/test"

0 commit comments

Comments
 (0)