Skip to content

[BUG] hard-code domain name in demo #1766

Description

@BossNP

Multiple hardcoded ".mosip.net" domain references in apitest-commons (report link + cert path lookups)

Describe the bug
Several places in apitest-commons build URLs/paths by concatenating a dynamic environment value with a hardcoded literal .[mosip.net](http://mosip.net/) suffix, instead of using the actual configured environment domain end-to-end. On any deployment not hosted under *.[mosip.net](http://mosip.net/), this produces broken links/paths.

  1. Report link (still present in current develop/master and v1.6.0):
    apitest-commons/src/main/java/io/mosip/testrig/apirig/report/EmailableReport.java (~line 226-230):
String reportLink = "https://minio."
        + BaseTestCase.environment.replace("api-internal.", "")
        + ".[mosip.net/browser/](http://mosip.net/browser/)"
        + ConfigManager.getS3Account() + "/"
        + BaseTestCase.currentModule + "%2F" + newString;

2. Certificate path lookup (present in v1.3.3, already fixed by v1.6.0but still affects anyone on 1.3.x):
apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java, getKeysDirPath() (v1.3.3, ~line 4472-4481):
public static String getKeysDirPath() {
    String certsTargetDir = System.getProperty("[java.io](http://java.io/).tmpdir") + File.separator
            + System.getProperty("parent.certs.folder.name", "AUTHCERTS");
    if (System.getProperty("os.name").toLowerCase().contains("windows") == false) {
        certsTargetDir = "/home/mosip/authcerts";
    }
    return certsTargetDir + File.separator + certsForModule + "-IDA-" + environment + ".[mosip.net](http://mosip.net/)";
}
This doesn't use env.endpoint at all — it uses environment (from env.user) and blindly appends .[mosip.net](http://mosip.net/), causing certificate lookups (e.g. ida-partner.cer) to fail with a NullPointerException on any [non-mosip.net](http://non-mosip.net/) environment. Fixed in v1.6.0 by switching to BaseTestCase.domain with no hardcoded suffix.

3. Same pattern, also present in v1.3.3, also fixed by v1.6.0:
apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java, getKeysDirPath(String certsDir, String moduleName) (~line 345):
return certsTargetDir + File.separator + certsModuleName + "-IDA-" + System.getProperty("env.user") + ".[mosip.net](http://mosip.net/)";

To Reproduce
1. Deploy id-authentication's api-test (auth apitestrig) module — its pom.xml pins apitest-commons to 1.3.3.
2. Deploy on any environment not hosted under *.[mosip.net](http://mosip.net/) (e.g. a [cs.ait.ac.th](http://cs.ait.ac.th/) sandbox), with ENV_ENDPOINT/env.endpoint correctly configured to the real domain.
3. Run the auth test suite with partner certificate lookups and S3/MinIO report push + Slack notification enabled.
4. Observe: certificate lookup fails (Key file not available for partner type: ..., NPE on x509Cert.getPublved path still has .[mosip.net](http://mosip.net/) appended; and/or the Slack-posted MinIO report link points at a nonexistent*.[mosip.net](http://mosip.net/) host.

Expected behavior
Both the certificate directory path and the MinIO report link should be built entirely from the actual con, with no hardcoded .[mosip.net](http://mosip.net/) suffix appended.

Screenshots
N/A

Environment (please complete the following information):
- Server OS: N/A
- Client OS: N/A
- Build: apitest-commons 1.3.3 (cert path lookups), develop/master & v1.6.0 (report link)
- Browser: N/A

Attach logs
ERROR  io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil - java.lang.NullPointerException: Cannot invoke "java.security.cert.X509Certificate.getPublicKey()" because "x509Cert" is null
ERROR  io.mosip.testrig.apirig.utils.AdminTestUtil - Key file not available for partner type: auth_pid1785

Additional context
- id-authentication/api-test/pom.xml pins apitest-commons to 1.3.3, which carries the cert-path hardcodingis dependency to 1.6.0+ would resolve the cert-path issue without any further code change.
- Item 1 (EmailableReport.java minio link) is unresolved even at the latest v1.6.0 tag and needs an actual fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

End Date

None yet

Complexity

None yet

Start Date

None yet

Original Estimate

None yet

Time Tracking

None yet

Resolved By

None yet

Story Points

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions