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

feat: Promote to UAT #232

Merged
merged 9 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion .github/workflows/anchore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: CVE Description escaped extraction and print
if: always()
run: |
SCAN_RESULTS=$(jq -r '.runs[0].tool.driver.rules | map(.shortDescription.text) | join("\\n")' ${{ steps.scan.outputs.sarif }})
SCAN_RESULTS=$(jq -r 'try .runs[0].tool.driver.rules | map(.shortDescription.text) | join("\\n")' ${{ steps.scan.outputs.sarif }})
echo "SCAN_RESULTS=$SCAN_RESULTS" >> $GITHUB_ENV
echo "CVE_CRITICAL=$(echo $SCAN_RESULTS | grep -o critical | wc -l)" >> $GITHUB_ENV
echo "CVE_HIGH=$(echo $SCAN_RESULTS | grep -o high | wc -l)" >> $GITHUB_ENV
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ RUN mvn clean package -DskipTests
#
FROM amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 AS runtime

# security fixes
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3

RUN apk --no-cache add shadow
RUN useradd --uid 10000 runner

Expand Down
6 changes: 3 additions & 3 deletions helm/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: microservice-chart
repository: https://pagopa.github.io/aks-microservice-chart-blueprint
version: 2.8.0
digest: sha256:379d9a7c312874dd1771386d92d8f597cb3fed497bb80dfde102513b582123d4
generated: "2023-09-05T10:18:40.513777+02:00"
version: 5.0.0
digest: sha256:acce690c924529c84ccd541dd046bf2fa8e6d379d0bfe6f2e200d95466cdb253
generated: "2023-11-29T10:53:28.3550118+01:00"
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ version: 1.0.0
appVersion: 1.0.0
dependencies:
- name: microservice-chart
version: 2.8.0
version: 5.0.0
repository: "https://pagopa.github.io/aks-microservice-chart-blueprint"
2 changes: 1 addition & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ microservice-chart:
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"

envConfig:
JAVA_TOOL_OPTIONS: "-Xms128m -Xmx4g -javaagent:/app/applicationinsights-agent.jar -agentlib:jdwp=transport=dt_socket,server=y,address=8001,suspend=n -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=3002 -Dcom.sun.management.jmxremote.rmi.port=3003 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JAVA_TOOL_OPTIONS: "-Xms128m -Xmx4g -Djava.util.concurrent.ForkJoinPool.common.parallelism=7 -Dio.netty.eventLoopThreads=100 -javaagent:/app/applicationinsights-agent.jar -Dapplicationinsights.configuration.file=/mnt/file-config-external/appinsights-config/applicationinsights.json -agentlib:jdwp=transport=dt_socket,server=y,address=8001,suspend=n -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=3002 -Dcom.sun.management.jmxremote.rmi.port=3003 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
CACHE_REFRESH_MS_RATE: "60000"
REDIS_CACHE_ENABLED: "true"

Expand Down
2 changes: 1 addition & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ microservice-chart:
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"

envConfig:
JAVA_TOOL_OPTIONS: "-Xms128m -Xmx4g -javaagent:/app/applicationinsights-agent.jar"
JAVA_TOOL_OPTIONS: "-Xms128m -Xmx4g -Djava.util.concurrent.ForkJoinPool.common.parallelism=7 -Dio.netty.eventLoopThreads=100 -javaagent:/app/applicationinsights-agent.jar -Dapplicationinsights.configuration.file=/mnt/file-config-external/appinsights-config/applicationinsights.json"
CACHE_REFRESH_MS_RATE: "60000"
REDIS_CACHE_ENABLED: "true"

Expand Down
2 changes: 1 addition & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ microservice-chart:
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"

envConfig:
JAVA_TOOL_OPTIONS: "-Xms128m -Xmx4g -javaagent:/app/applicationinsights-agent.jar -agentlib:jdwp=transport=dt_socket,server=y,address=8001,suspend=n -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=3002 -Dcom.sun.management.jmxremote.rmi.port=3003 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JAVA_TOOL_OPTIONS: '-Xms128m -Xmx4g -javaagent:/app/applicationinsights-agent.jar -Dapplicationinsights.configuration.file=/mnt/file-config-external/appinsights-config/applicationinsights.json'
CACHE_REFRESH_MS_RATE: "10000"
REDIS_CACHE_ENABLED: "true"

Expand Down
10 changes: 8 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ microservice-chart:
DELETE_PAGINATION_SIZE: "60"
DELETE_DELAY_TIME: "1000"

envConfigMapExternals:
externalConfigMapValues:
idpay-common:
TZ: TZ
idpay-eventhub-00:
Expand Down Expand Up @@ -107,4 +107,10 @@ microservice-chart:

# tolerations: []

# affinity: {}
# affinity: {}

externalConfigMapFiles:
create: true
configMaps:
- name: appinsights-config
key: applicationinsights.json
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<groupId>it.gov.pagopa</groupId>
<artifactId>idpay-admissibility-assessor</artifactId>
<name>idpay-admissibility-assessor</name>
<version>1.2.2</version>
<version>1.2.3</version>

<properties>
<java.version>17</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,49 @@ private static List<ExtraFilterField> buildExtraFilterFields(final Class<?> claz
final List<ExtraFilterField> out = new ArrayList<>();
final Set<String> fieldsAdded = new HashSet<>();

ReflectionUtils.doWithMethods(clazz, m -> checkIfGetter2AnalyzeAndRetrieveFieldInfo(m, path, castPath, class2subclass, path2ignore, maxDepth, out, fieldsAdded),
ReflectionUtils.doWithMethods(clazz, m -> checkIfGetter2AnalyzeAndRetrieveFieldInfo(m, class2subclass, path2ignore, maxDepth, out, fieldsAdded,
generateExtraFilterField(path, castPath)),
m -> m.getParameterTypes().length == 0 && (m.getName().startsWith("get") || m.getName().startsWith("is")));
return out;
}

private static void checkIfGetter2AnalyzeAndRetrieveFieldInfo(Method m, String path, Class<?> castPath, Map<Class<?>, List<Class<?>>> class2subclass, Set<String> path2ignore, int maxDepth, List<ExtraFilterField> out, Set<String> fieldsAdded) {
Class<?> fieldType = m.getReturnType();
if (class2notAnalyze.stream().anyMatch(c -> c.isAssignableFrom(fieldType))) {
private static ExtraFilterField generateExtraFilterField(String path, Class<?> castPath){
ExtraFilterField eff = new ExtraFilterField();
eff.setPath(path);
eff.setCastPath(castPath);
return eff;
}

private static void checkIfGetter2AnalyzeAndRetrieveFieldInfo(Method m, Map<Class<?>, List<Class<?>>> class2subclass, Set<String> path2ignore, int maxDepth, List<ExtraFilterField> out, Set<String> fieldsAdded, ExtraFilterField eff) {
eff.setType(m.getReturnType());
if (class2notAnalyze.stream().anyMatch(c -> c.isAssignableFrom(eff.getType()))) {
return;
}

String fieldName = StringUtils.uncapitalize(m.getName().replaceFirst("^(?:get|is)", ""));
String fullFieldName = path != null ? String.format("%s.%s", path, fieldName) : fieldName;
if (!Modifier.isStatic(m.getModifiers()) && !fieldsAdded.contains(fullFieldName) && (path2ignore == null || !path2ignore.contains(fullFieldName))) {
extractFieldInfo(path, castPath, class2subclass, path2ignore, maxDepth, out, fieldsAdded, fieldType, fieldName, fullFieldName);
eff.setName(StringUtils.uncapitalize(m.getName().replaceFirst("^(?:get|is)", "")));
eff.setField(eff.getPath() != null ? String.format("%s.%s", eff.getPath(), eff.getName()) : eff.getName());
if (!Modifier.isStatic(m.getModifiers()) && !fieldsAdded.contains(eff.getField()) && (path2ignore == null || !path2ignore.contains(eff.getField()))) {
extractFieldInfo(class2subclass, path2ignore, maxDepth, out, fieldsAdded, eff);
}
}

private static void extractFieldInfo(String path, Class<?> castPath, Map<Class<?>, List<Class<?>>> class2subclass, Set<String> path2ignore, int maxDepth, List<ExtraFilterField> out, Set<String> fieldsAdded, Class<?> fieldType, String fieldName, String fullFieldName) {
ExtraFilterField eff = new ExtraFilterField();
eff.setPath(path);
eff.setName(fieldName);
eff.setField(fullFieldName);
eff.setType(fieldType);
eff.setCastPath(castPath);

private static void extractFieldInfo(Map<Class<?>, List<Class<?>>> class2subclass, Set<String> path2ignore, int maxDepth, List<ExtraFilterField> out, Set<String> fieldsAdded, ExtraFilterField eff) {
out.add(eff);
fieldsAdded.add(fullFieldName);
fieldsAdded.add(eff.getField());

List<Class<?>> subclasses = class2subclass == null ? null : class2subclass.get(fieldType);
List<Class<?>> subclasses = class2subclass == null ? null : class2subclass.get(eff.getType());
if (!CollectionUtils.isEmpty(subclasses)) {
eff.setToCast(true);
eff.setSubclasses(subclasses);
for (Class<?> s : subclasses) {
if (fieldType.isAssignableFrom(s)) {
out.addAll(buildExtraFilterFields(s, String.format("%s(%s)%s", path == null ? "" : String.format("%s.", path), s.getName(), fieldName), s, class2subclass, path2ignore, maxDepth));
if (eff.getType().isAssignableFrom(s)) {
out.addAll(buildExtraFilterFields(s, String.format("%s(%s)%s", eff.getPath() == null ? "" : String.format("%s.", eff.getPath()), s.getName(), eff.getName()), s, class2subclass, path2ignore, maxDepth));
} else {
throw new IllegalArgumentException(String.format("The configured class '%s' is not a subclass of '%s'", s.getName(), fieldType));
throw new IllegalArgumentException(String.format("The configured class '%s' is not a subclass of '%s'", s.getName(), eff.getType()));
}
}
} else if (!fieldType.isPrimitive() && class2notExplore.stream().noneMatch(c -> c.isAssignableFrom(fieldType))) {
out.addAll(buildExtraFilterFields(fieldType, fullFieldName, null, class2subclass, path2ignore, maxDepth));
} else if (!eff.getType().isPrimitive() && class2notExplore.stream().noneMatch(c -> c.isAssignableFrom(eff.getType()))) {
out.addAll(buildExtraFilterFields(eff.getType(), eff.getField(), null, class2subclass, path2ignore, maxDepth));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,7 @@ private String checkConsensusErrors(OnboardingDTO onboardingRequest) {
return OnboardingConstants.REJECTION_REASON_CONSENSUS_PDND_FAIL;
}

/*
if (!CollectionUtils.isEmpty(onboardingRequest.getSelfDeclarationList())) {
return selfDeclarationListCheck(onboardingRequest.getSelfDeclarationList());
}
*/
return null;
}

//Handle multi and boolean criteria
/*
private String selfDeclarationListCheck(Map<String, Boolean> selfDeclarationList) {
for (Map.Entry<String, Boolean> selfDeclaration : selfDeclarationList.entrySet()) {
if (Boolean.FALSE.equals(selfDeclaration.getValue())) {
return String.format(OnboardingConstants.REJECTION_REASON_CONSENSUS_CHECK_SELF_DECLARATION_FAIL_FORMAT, selfDeclaration.getKey());
}
}
return null;
}
*/

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package it.gov.pagopa.common.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.Status;
Expand All @@ -13,8 +12,11 @@
@Service
public class HealthIndicatorLogger implements HealthIndicator {

@Autowired
private List<HealthIndicator> healthIndicatorList;
private final List<HealthIndicator> healthIndicatorList;

public HealthIndicatorLogger(List<HealthIndicator> healthIndicatorList) {
this.healthIndicatorList = healthIndicatorList;
}

@Override
public Health health() {
Expand Down
Loading