DCCLIP-1068: option to override ATL_SECURE_PROPERTIES

This commit is contained in:
Jun jeong 2024-08-27 14:51:19 +10:00
parent e98648419f
commit 81d106e36b
2 changed files with 17 additions and 3 deletions

View File

@ -98,7 +98,8 @@
{# Confluence versions 9.1 and newer #} {# Confluence versions 9.1 and newer #}
{% if (confluence_version.split(".")[0] | int() == 9 and confluence_version.split(".")[1] | int() >= 1) or confluence_version.split(".")[0] | int() > 9 %} {% if (confluence_version.split(".")[0] | int() == 9 and confluence_version.split(".")[1] | int() >= 1) or confluence_version.split(".")[0] | int() > 9 %}
<property name="secure.properties">true</property> {% set secure_properties = atl_secure_properties if atl_secure_properties is defined else 'true' %}
<property name="secure.properties">{{ secure_properties }}</property>
{% endif %} {% endif %}
</properties> </properties>
</confluence-configuration> </confluence-configuration>

View File

@ -719,7 +719,7 @@ def test_skip_custom_allowlist_secure_vars(docker_cli, image, run_user):
raise EOFError(f"Found unexpected log line") raise EOFError(f"Found unexpected log line")
@pytest.mark.parametrize("version,secure_properties_flag_expected", [('6.9.0', 'false'), ('9.0.1', 'false'), ('9.1.0', 'true'), ('9.2.0', 'true')]) @pytest.mark.parametrize("version,secure_properties_flag_expected", [('6.9.0', 'false'), ('9.0.1', 'false'), ('9.1.0', 'true'), ('9.2.0', 'true')])
def test_confluence_xml_secure_properties(docker_cli, image, version, secure_properties_flag_expected): def test_confluence_xml_secure_properties_default(docker_cli, image, version, secure_properties_flag_expected):
environment = { environment = {
'CONFLUENCE_VERSION': version, 'CONFLUENCE_VERSION': version,
} }
@ -731,4 +731,17 @@ def test_confluence_xml_secure_properties(docker_cli, image, version, secure_pro
if secure_properties_flag_expected.lower() == 'true': if secure_properties_flag_expected.lower() == 'true':
assert secure_properties_elements[0].text == "true" assert secure_properties_elements[0].text == "true"
else: else:
assert len(secure_properties_elements) == 0 assert len(secure_properties_elements) == 0
@pytest.mark.parametrize("version,overrideVar", [('9.1.0', 'false'), ('9.2.0', 'true')])
def test_confluence_xml_secure_properties_override(docker_cli, image, version, overrideVar):
environment = {
'CONFLUENCE_VERSION': version,
'ATL_SECURE_PROPERTIES' overrideVar,
}
container = run_image(docker_cli, image, environment=environment)
xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
secure_properties_elements = xml.findall('.//property[@name="secure.properties"]')
assert secure_properties_elements[0].text == overrideVar