Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.1.6 branch #15

Merged
merged 47 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6ac8f6f
Initial commit of base code.
keithboone May 25, 2024
d205a5f
Added Workflow file
keithboone May 25, 2024
2a68865
Fix workflow error.
keithboone May 25, 2024
220afa3
Merge branch 'Release_v2.1.0-branch' into IGDD-1505_Refactor_Hub_and_…
keithboone May 25, 2024
324135f
Fix environment variable error.
keithboone May 25, 2024
63d4d6f
Merge branch 'IGDD-1505_Refactor_Hub_and_Core' of https://github.com/…
keithboone May 25, 2024
bd148f3
Working on settings.xml values for GITHUB_ACTOR and GITHUB_TOKEN
keithboone May 25, 2024
5597edc
Adjusting spring-boot dependency.
keithboone May 25, 2024
0d6d23d
Added base dependencies from izgateway pom.xml file.
keithboone May 25, 2024
f2e2a68
Working on settings.xml some more.
keithboone May 25, 2024
505003a
Continuing work on settings.xml
keithboone May 25, 2024
168e922
Merge pull request #1 from IZGateway/IGDD-1505_Refactor_Hub_and_Core
keithboone Jun 10, 2024
977ec6d
Igdd 1546 add demo data to mock (#2)
keithboone Jun 10, 2024
584c061
Migrate 2.0.5 patch (#3)
keithboone Jun 17, 2024
6762c79
Merge 2.0.5 changes
keithboone Jun 29, 2024
3bc90e9
Merging in 2.0.6 Changes
keithboone Jun 29, 2024
fb1f17a
Notes on code change for IGDD-1620
keithboone Jul 16, 2024
e1784c3
Refactor LoggingValve for use in both Hub and Transformation Service.…
pcahillai Jul 25, 2024
935b3b2
Adding code to take in config value for wsdl location element. (#5)
pcahillai Jul 25, 2024
924f550
Upgraded Spring Boot to 3.3.2
keithboone Jul 26, 2024
a7eb6ae
IGDD-1643 Status History is reporting exceptions
keithboone Jul 31, 2024
3e2ef4e
Added some javadoc to SystemUtils.
keithboone Jul 31, 2024
aee02a4
Added back ErrorText support.
keithboone Aug 2, 2024
99e403e
Merge pull request #6 from IZGateway/IGDD-1643_Status_History_is_repo…
pcahillai Aug 2, 2024
df4afb4
Updating for save to blacklist. (#7)
keithboone Aug 6, 2024
78ecd1c
Igdd 1642 rework access controls (#8)
keithboone Aug 6, 2024
82be650
Restrict logging for non-test messages.
keithboone Aug 14, 2024
cb09e99
Fix .classpath
keithboone Aug 18, 2024
5901bca
Upgrade spring-framework to 6.1.12 for CVE-2024-38809
keithboone Aug 19, 2024
3170c5e
Updating version for Release
keithboone Aug 19, 2024
f6dd9b6
Adjusting test patterns to Lori's list since rebuilding anyway.
keithboone Aug 21, 2024
aef437f
Local commit
keithboone Aug 26, 2024
392c31d
Fix classpath.
keithboone Aug 26, 2024
436e7a2
Adjusting Test Message Criteria
keithboone Aug 26, 2024
1530a40
Update for credential masking.
keithboone Aug 26, 2024
45b7f35
Remove OPEN Role IGDD-1713, clean up logging and add support for DEX 2.0
keithboone Sep 23, 2024
1dc02bc
Merge branch 'main' into Release_v2.1.3-branch
keithboone Sep 24, 2024
a812706
Upgraded to spring-boot-starter-parent 3.3.4
keithboone Sep 24, 2024
93b0cff
Upgrade to spring 3.3.4
keithboone Sep 24, 2024
56c786a
Merge branch 'Release_v2.1.3-branch' of https://github.com/IZGateway/…
keithboone Sep 24, 2024
8856836
Local push for migration.
keithboone Oct 10, 2024
bcde615
Fixes for IZHD-4563 and updating Health reporting to report Database
keithboone Oct 12, 2024
7e04634
Upgrade Bouncy Castle to 2.0
keithboone Oct 17, 2024
584af43
Merge branch 'main' into Release_v2.1.4-branch
keithboone Oct 23, 2024
9b24ac9
Fixing merge error.
keithboone Oct 23, 2024
db6d80a
Fixes for 2.1.6
keithboone Nov 18, 2024
771d6d1
NPE fix
keithboone Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
Expand All @@ -22,6 +23,7 @@
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
Expand Down
23 changes: 12 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.4</version>
<version>3.3.5</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
Expand All @@ -16,9 +16,9 @@
release branch is labeled <major>.<minor>.<patch>-izgw-core-SNAPSHOT
main branch is labeled <major>.<minor>.<patch>-izgw-core-RELEASE
-->
<version>2.1.3-izgw-core-SNAPSHOT</version>
<version>2.1.6-izgw-core-SNAPSHOT</version>
<packaging>jar</packaging>
<name>IZ Gateway Core 2.0</name>
<name>IZ Gateway Core 2.1.6</name>
<description>IZ Gateway Core contains the core code for the IZ Gateway Hub and Transformation services</description>
<distributionManagement>
<repository>
Expand All @@ -35,9 +35,10 @@
<project.build.finalName>${project.artifactId}-${project.version}-${timestamp}</project.build.finalName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.java.package>${project.groupId}</project.java.package>
<!-- 17 needs a certified encryption module -->
<timestamp>${maven.build.timestamp}</timestamp>
<skipDependencyCheck>false</skipDependencyCheck>
<spring-security.version>6.3.4</spring-security.version>
<spring.version>6.2.0</spring.version>
<spring-framework.version>6.2.0</spring-framework.version>
<netty.version>4.1.115.Final</netty.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -147,17 +148,17 @@
<groupId>org.bouncycastle</groupId>
<!-- add -debug to get debug jars -->
<artifactId>bc-fips</artifactId>
<version>1.0.2.5</version>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-fips</artifactId>
<version>1.0.7</version>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctls-fips</artifactId>
<version>1.0.19</version>
<version>2.0.19</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
Expand All @@ -175,12 +176,12 @@
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
<version>[2.2.0,)</version>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>[2.2.0,)</version>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/gov/cdc/izgateway/common/HealthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ public static void setServerName(String serverName) {
public static void setBuildName(String build) {
health.setBuildName(build);
}

public static void setDatabase(String url) {
if (health.getDatabase() == null) {
health.setDatabase(url);
} else {
health.setDatabase(health.getDatabase() + ", " + url);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public class AppProperties {
@Getter
@Value("${server.mode:prod}")
private String serverMode;

@Getter
@Value("${spring.database:jpa}")
private String databaseType;
keithboone marked this conversation as resolved.
Show resolved Hide resolved

@Getter
private final ScheduledExecutorService scheduler =
Executors.newSingleThreadScheduledExecutor(r -> new Thread(r, "Background-Scheduler"));
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/gov/cdc/izgateway/logging/event/Health.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ public class Health {
@JsonProperty
@Schema(description="Host name as known by the operating system")
private String hostname;


@JsonProperty
@Schema(description="The database in use")
private String database;
keithboone marked this conversation as resolved.
Show resolved Hide resolved

public Health() {
started = new Date(ManagementFactory.getRuntimeMXBean().getStartTime());
environment = SystemUtils.getDestTypeAsString();
Expand Down Expand Up @@ -113,6 +117,7 @@ private Health(Health that) {
this.requestVolume = that.requestVolume;
this.successVolume = that.successVolume;
this.hostname = that.hostname;
this.database = that.database;
}

public Health copy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
Expand Down Expand Up @@ -653,12 +652,13 @@ private String getFirstFieldComponent(String[] parts, int index) {
}

public void setProcessError(String summary, String detail) {
processErrorSummary = summary;
processErrorDetail = detail;
processErrorSummary = HL7Utils.maskSegments(summary);
processErrorDetail = HL7Utils.maskSegments(detail);
hasProcessError = !StringUtils.isAllEmpty(summary, detail);
}

public void setProcessError(Exception fault) {

public void setProcessError(Exception fault) {
FaultSupport s = null;
if (fault instanceof UnsupportedOperationFault f) {
setMessageType(MessageType.INVALID_REQUEST);
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/gov/cdc/izgateway/model/ICertificateStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.sql.Timestamp;
import java.util.Date;
import java.util.ServiceConfigurationError;

import jakarta.xml.bind.DatatypeConverter;
Expand All @@ -23,13 +24,13 @@ public interface ICertificateStatus {

void setCertSerialNumber(String certificateSerialNumber);

Timestamp getLastCheckedTimeStamp();
Date getLastCheckedTimeStamp();

void setLastCheckedTimeStamp(Timestamp lastCheckedTimeStamp);
void setLastCheckedTimeStamp(Date lastCheckedTimeStamp);

Timestamp getNextCheckTimeStamp();
Date getNextCheckTimeStamp();

void setNextCheckTimeStamp(Timestamp nextCheckTimeStamp);
void setNextCheckTimeStamp(Date nextCheckTimeStamp);

String getLastCheckStatus();

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gov/cdc/izgateway/model/IEndpointStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public interface IEndpointStatus extends IEndpoint {
int getStatusId();

void setDestId(String destId);

int getDestTypeId();

void setDestUri(String destUri);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/cdc/izgateway/model/RetryStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum RetryStrategy {
* The IIS is not responsive for some reason. This may be due to networking infrastructure (Internet)
* failures between the IZ Gateway and the IIS, or it may be related to routine or emergency IIS
* maintenance. Check the IIS Status before attempting a retry. Some errors (e.g. DNS not found,
* expired certificates) will not disappear without human intervention.
* expired certificates, or invalid response data) will not disappear without human intervention.
*/
CHECK_IIS_STATUS("Check IIS Status before Retry", HttpStatus.BAD_GATEWAY),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
public interface EndpointStatusRepository {
public static final String[] INCLUDE_ALL = new String[0];

List<IEndpointStatus> findAll();
List<? extends IEndpointStatus> findAll();
IEndpointStatus findById(String id);
IEndpointStatus saveAndFlush(IEndpointStatus status);
boolean removeById(String id);

List<IEndpointStatus> find(int maxQuarterHours, String[] include);
List<? extends IEndpointStatus> find(int maxQuarterHours, String[] include);
boolean refresh();
void resetCircuitBreakers();
IEndpointStatus newEndpointStatus();
IEndpointStatus newEndpointStatus(IDestination dest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public boolean accessAllowed(HttpServletRequest req, HttpServletResponse resp) {
if (Boolean.FALSE.equals(check)) { // NOSONAR Null is still possible here, SONAR flags it as always true
log.error("Access denied to protected URL {} address by {} at {}", path, user, host);
resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
return true;
return false;
}

if (isSwagger(path, user)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,13 @@ public Set<String> getUsersInGroup(@PathVariable String group) {

@Operation(summary="Add a user to blacklist", description="Add the specified user to the blacklist")
@PostMapping("/access/blacklist")
public IAccessControl addUserToBlackList(@RequestParam String user
) {
public IAccessControl addUserToBlackList(@RequestParam String user) {
return service.addUserToBlacklist(user);
}

@Operation(summary="Delete a user from the blacklist", description="Delete the specified user from the blacklist")
@DeleteMapping("/access/blacklist")
public IAccessControl removeUserFromBlackList(@RequestParam String user
) {
public IAccessControl removeUserFromBlackList(@RequestParam String user) {
return service.removeUserFromBlacklist(user);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public List<String> getHosts() {
return l;
}

public List<IEndpointStatus> findAll() {
public List<? extends IEndpointStatus> findAll() {
return endpointStatusRepository.find(1, EndpointStatusRepository.INCLUDE_ALL);
}
public List<IEndpointStatus> find(int count, String[] include) {
public List<? extends IEndpointStatus> find(int count, String[] include) {
return endpointStatusRepository.find(count, include);
}

Expand Down Expand Up @@ -62,4 +62,8 @@ public boolean refresh() {
public boolean removeById(String id) {
return endpointStatusRepository.removeById(id);
}

public void resetCircuitBreakers() {
endpointStatusRepository.resetCircuitBreakers();
}
}
23 changes: 15 additions & 8 deletions src/main/java/gov/cdc/izgateway/soap/MockMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ public enum MockMessage {
HttpStatus.BAD_REQUEST),

TC_24H(MediaType.APPLICATION_XML, MockMessageText.TC_24H_TEXT,
HttpStatus.BAD_REQUEST), TC_UNKF(MockMessage::simulateFault,
HttpStatus.BAD_REQUEST),

TC_24I(MockMessageText.TC_24I_TEXT),

TC_UNKF(MockMessage::simulateFault,
MockMessageText.TC_UNKF_TEXT);


public static final MockMessage TC_FORCE_TIMEOUT = TC_13C;
private static int retryableRequestCount = 0;
/**
Expand Down Expand Up @@ -596,19 +601,21 @@ private MockMessageText() {
+ "<soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code>"
+ "<soap:Reason><soap:Text>Invalid Username, Password or FacilityID</soap:Text></soap:Reason><soap:Detail>"
+ "<ns3:SecurityFault xmlns:ns3='urn:cdc:iisb:2014'>"
+ "<ns3:Code>401</ns3:Code>" + "<ns3:Reason>Security</ns3:Reason>" // Change
// from
// required
// "Security"
// to
// "Security
// Fault"
+ "<ns3:Code>401</ns3:Code><ns3:Reason>Security</ns3:Reason>"
+ "<ns3:Detail>Invalid Username, Password or FacilityID</ns3:Detail>"
+ "</ns3:SecurityFault>"
+ "</soap:Detail></soap:Fault></soap:Envelope>";

static final String TC_24H_TEXT = "This is not a SOAP Fault nor is it XML";

static final String TC_24I_TEXT = "MSH|^~\\&|IRIS IIS|IRIS||IZG|20220205||RSP^K11^RSP_K11|20210330093013AZQ231|P|2.5.1|||||||||Z32^CDCPHINVS\r"
+ "MSA|AA|20210330093013AZQ231||0||0^Message Accepted^HL70357" + Character.valueOf((char)0x13)
+ "QAK|20210330093013AZQ231|NF|Z34^Request Complete Immunization history^CDCPHINVS\r"
+ "QPD|Z34^Request Immunization History^CDCPHINVS|20210330093013IA231|112258-9^^^IA^MR|"
+ "JohnsonIZG^JamesIZG^AndrewIZG^^^^L|LeungIZG^SarahIZG^^^^^M|20160414|M|"
+ "Main Street&&123^^Adel^IA^50003^^L|^PRN^PH^^^555^5551111|Y|1\r";


static final String TC_UNKF_TEXT = "Unknown Exception";

static final String TC_22B_TEXT = ENVELOPE + "" + "<soap:Fault>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ protected ResponseEntity<FaultMessage> handleFault(Fault fault) {
logFault(fault);
FaultMessage faultMessage = new FaultMessage(fault, messageNamespace);
faultMessage.updateAction(isHub());
logResponseMessage(faultMessage);
return new ResponseEntity<>(faultMessage, HttpStatus.INTERNAL_SERVER_ERROR);
}

Expand Down
Loading