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

Critical code review PR - Last sprint handover checklist of 0.10.0 release #84

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dc45f11
[INJICERT-189] move mosip id changes from feature branch to develop (…
challabeehyv Jun 18, 2024
a8d48d3
[INJICERT-189] make service classes as conditional beans
challabeehyv Jun 18, 2024
c54607e
Merge pull request #34 from challabeehyv/mosipid-conditional-beans
vishwa-vyom Jun 18, 2024
b42ad84
[INJICERT-189] add esignet integration api dependency
challabeehyv Jun 18, 2024
d00c2f6
Merge pull request #36 from challabeehyv/esignet-dependency-mosipid
vishwa-vyom Jun 18, 2024
462be90
[MOSIP-33939] change esignet dependency versions for mosip ida plugin
challabeehyv Jun 20, 2024
9457ba9
Merge pull request #37 from challabeehyv/develop
vishwa-vyom Jun 20, 2024
d653407
[INJICERT-186] add mock identity plugin (#35)
challabeehyv Jun 24, 2024
e3f7ab1
[DSD-5591] Updated push-trigger.yml
abhishek8shankar Jun 25, 2024
6fa688f
Merge pull request #40 from abhishek8shankar/develop
ckm007 Jun 25, 2024
6ed7586
[DSD-5591] Updated push-trigger.yml
abhishek8shankar Jun 26, 2024
e4693ee
[DSD-5591] Updated push-trigger.yml
abhishek8shankar Jun 26, 2024
1da9d75
[DSD-5591] Updated push-trigger.yml
abhishek8shankar Jun 26, 2024
14eaef3
Merge pull request #41 from abhishek8shankar/develop
ckm007 Jun 26, 2024
a96fada
[DSD-5591] add plugin (#42)
challabeehyv Jun 26, 2024
fa0aee7
[INJICERT-317] rename credential.type to MockVerifiableCredential (#43)
vharsh Aug 1, 2024
6720dd8
[INJICERT-444] update to release URL
vharsh Sep 19, 2024
60d4697
Merge branch 'develop' into rel
vharsh Sep 26, 2024
7bcd0d9
[INJICERT-444] use java-11 for sunbird esignet plugin
vharsh Sep 26, 2024
79d0a6a
[INJICERT-444] bump up the version to 0.3.0
vharsh Sep 26, 2024
c38d8da
[INJICERT-444] bump down version due to artifact unavailability
vharsh Sep 26, 2024
7f116ef
Merge pull request #64 from vharsh/rel
jainhitesh9998 Sep 26, 2024
563a383
[INJICER-444] prepare for 0.10.0 release (#71)
vharsh Oct 8, 2024
2680e45
[INJIMOB-1588] add mso_mdoc vc format support for mock plugin (#60)
KiruthikaJeyashankar Oct 9, 2024
1e20150
[INJICERT-316] remove null field in the Mock VC (#69)
vharsh Oct 11, 2024
2e0f31c
[INJICERT-434] Added mock data provider plugin for data model 2.0 (#72)
Piyush7034 Oct 17, 2024
b329ca7
[INJICERT-499] Added JsonObject in place of HashMap for identity data…
Piyush7034 Nov 4, 2024
a437218
[INJIMOB-1862] Modifications in mdoc generation (#73)
KiruthikaJeyashankar Nov 5, 2024
e1a182f
[INJICERT-587] add CSV plugin implementation (#78)
vharsh Nov 8, 2024
b2516ba
[INJICERT-587] Fixed file access through classpath (#79)
Piyush7034 Nov 14, 2024
f9d3c76
[INJICERT-587] Merge mock-csv plugin to mock-certify-plugin (#80)
Piyush7034 Nov 14, 2024
cb220c0
[INJICERT-499] Implement a data provider plugin with postgres (#82)
Piyush7034 Nov 27, 2024
c654d79
[INJICERT-657] Remove mock-ida-dataprovider-plugin project from relea…
Piyush7034 Dec 14, 2024
f352d7d
Removed mdoc and mdl related code
Piyush7034 Dec 17, 2024
9c29bb9
Merge pull request #88 from Infosys/remove-mdoc
vishwa-vyom Dec 17, 2024
e50fa83
[INJICERT-657] Added jakarta dependency for build fix (#92)
Piyush7034 Dec 18, 2024
3a51e4e
[INJICERT-695] add Mock mdoc VCI plugin (#89)
KiruthikaJeyashankar Dec 18, 2024
f48d218
[INJICERT-695] handle null data when creating mdoc data entry (#93)
KiruthikaJeyashankar Dec 19, 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
53 changes: 47 additions & 6 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ jobs:
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_URL: ${{ secrets.RELEASE_URL }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

sonar_analysis_sunbird-rc-esignet-integration-impl:
needs: build-maven-sunbird-rc-esignet-integration-impl
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
with:
SERVICE_LOCATION: ./sunbird-rc-esignet-integration-impl
secrets:
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_URL: ${{ secrets.RELEASE_URL }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_URL: ${{ secrets.RELEASE_URL }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Expand All @@ -145,7 +145,7 @@ jobs:
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-maven-mock-certify-plugin:
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
Expand All @@ -167,7 +167,7 @@ jobs:
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_URL: ${{ secrets.RELEASE_URL }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Expand All @@ -186,3 +186,44 @@ jobs:
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
vishwa-vyom marked this conversation as resolved.
Show resolved Hide resolved

build-maven-postgres-dataprovider-plugin:
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: postgres-dataprovider-plugin
BUILD_ARTIFACT: postgres-dataprovider-plugin
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

publish_to_nexus_postgres-dataprovider-plugin:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}"
needs: build-maven-postgres-dataprovider-plugin
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
with:
SERVICE_LOCATION: ./postgres-dataprovider-plugin
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

sonar_analysis_postgres-dataprovider-plugin:
needs: build-maven-postgres-dataprovider-plugin
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./postgres-dataprovider-plugin
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
ORG_KEY: ${{ secrets.ORG_KEY }}
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ target/
.setting/
.mvn/
.project/
*.DS_Store
121 changes: 115 additions & 6 deletions mock-certify-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>io.mosip.certify</groupId>
<artifactId>mock-certify-plugin</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>mock-certify-integration-impl</name>
Expand Down Expand Up @@ -53,23 +53,27 @@
<maven.jacoco.version>0.8.11</maven.jacoco.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<kernel-keymanager-service.version>1.3.0-beta.1</kernel-keymanager-service.version>
<kotlin.version>2.0.0</kotlin.version>
</properties>
<dependencies>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.mosip.certify</groupId>
<artifactId>certify-core</artifactId>
<version>0.9.0</version>
<version>0.10.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.mosip.esignet</groupId>
<artifactId>esignet-core</artifactId>
Expand Down Expand Up @@ -131,6 +135,43 @@
<artifactId>slf4j-api</artifactId>
<version>2.0.12</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-datetime-jvm</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>com.android.identity</groupId>
<artifactId>identity-credential</artifactId>
<version>20231002</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>co.nstant.in</groupId>
<artifactId>cbor</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>net.javacrumbs.json-unit</groupId>
<artifactId>json-unit-assertj</artifactId>
<version>3.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.9.0</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<repositories>
Expand All @@ -156,6 +197,10 @@
<id>danubetech-maven-public</id>
<url>https://repo.danubetech.com/repository/maven-public/</url>
</repository>
<repository>
<id>google</id>
<url>https://maven.google.com/</url>
</repository>
</repositories>

<distributionManagement>
Expand Down Expand Up @@ -356,6 +401,70 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<source>src/main/java</source>
<source>target/generated-sources/annotations</source>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<source>src/test/java</source>
<source>target/generated-test-sources/test-annotations</source>
</sourceDirs>
</configuration>
</execution>
</executions>
<configuration>
<jvmTarget>${maven.compiler.target}</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package io.mosip.certify.mock.integration.service;


import io.mosip.certify.api.exception.DataProviderExchangeException;
import io.mosip.certify.api.spi.DataProviderPlugin;
import io.mosip.certify.util.CSVReader;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StreamUtils;
import org.springframework.web.client.RestTemplate;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Set;

@ConditionalOnProperty(value = "mosip.certify.integration.data-provider-plugin", havingValue = "MockCSVDataProviderPlugin")
@Component
@Slf4j
public class MockCSVDataProviderPlugin implements DataProviderPlugin {
@Value("${mosip.certify.mock.vciplugin.id-uri:https://example.com/}")
private String id;
@Autowired
private CSVReader csvReader;
@Value("${mosip.certify.mock.data-provider.csv-registry-uri}")
private String csvRegistryURI;
@Value("${mosip.certify.mock.data-provider.csv.identifier-column}")
private String identifierColumn;
@Value("#{'${mosip.certify.mock.data-provider.csv.data-columns}'.split(',')}")
private Set<String> dataColumns;
@Autowired
private RestTemplate restTemplate;

/**
* initialize sets up a CSV data for this DataProviderPlugin on start of application
* @return
*/
@PostConstruct
public File initialize() throws IOException, JSONException {
File filePath;
if (csvRegistryURI.startsWith("http")) {
// download the file to a path: usecase(docker, spring cloud config)
filePath = restTemplate.execute(csvRegistryURI, HttpMethod.GET, null, resp -> {
File ret = File.createTempFile("download", "tmp");

Check warning

Code scanning / CodeQL

Local information disclosure in a temporary directory Medium

Local information disclosure vulnerability due to use of file readable by other local users.
StreamUtils.copy(resp.getBody(), new FileOutputStream(ret));
return ret;
});
} else if (csvRegistryURI.startsWith("classpath:")) {
try {
// usecase(local setup)
filePath = ResourceUtils.getFile(csvRegistryURI);
} catch (IOException e) {
throw new FileNotFoundException("File not found in: " + csvRegistryURI);
}
} else {
// usecase(local setup)
filePath = new File(csvRegistryURI);
if (!filePath.isFile()) {
// TODO: make sure it crashes the application
throw new FileNotFoundException("File not found: " + csvRegistryURI);
}
}
csvReader.readCSV(filePath, identifierColumn, dataColumns);
return filePath;
}

@Override
public JSONObject fetchData(Map<String, Object> identityDetails) throws DataProviderExchangeException {
try {
String individualId = (String) identityDetails.get("sub");
if (individualId != null) {
JSONObject jsonRes = csvReader.getJsonObjectByIdentifier(individualId);
return jsonRes;
}
} catch (Exception e) {
log.error("Failed to fetch json data for from data provider plugin", e);
throw new DataProviderExchangeException("ERROR_FETCHING_IDENTITY_DATA");
}
throw new DataProviderExchangeException("No Data Found");
}
}
Loading
Loading