usnistgov / iheos-toolkit2

XDS Toolkit
https://ihexds.nist.gov
45 stars 25 forks source link

Query or Retrieve tool transaction selection bug #566

Closed skbhaskarla closed 1 year ago

skbhaskarla commented 1 year ago

This is a bug when the obsolete method gov.nist.toolkit.actortransaction.shared.ActorType#getActorType is used without following an undocumented test plan selection pattern. This method is sensitive to the ActorType enumeration order. For example, when the XC_RETRIEVE transaction is selected, the tool service backend code incorrectly picks up the Fixed Reply actor type, because the FR actor type entry was ordered before the Responding Gateway actor type and declared support for XC_RETRIEVE transaction.

Test plan section selection pattern

Excerpt taken from the gov.nist.toolkit.session.server.services.FindDocuments#run method Line 32:

            if (session.siteSpec.actorType.equals(ActorType.REGISTRY))
                sections.add("XDS");
            else if (session.siteSpec.actorType.equals(ActorType.INITIATING_GATEWAY))
                sections.add("IG");
            else {
                sections.add("XCA");
                String home = site.homeId;
                if (home != null && !home.equals("")) { // Null check not in original RetrieveDocument#run
                    params.put("$home$", home);
                }
            }