Skip to content

Critical code review PR - Last sprint handover checklist of 1.4.0 release#165

Merged
Prafulrakhade merged 0 commit intomasterfrom
release-1.4.x
Sep 8, 2025
Merged

Critical code review PR - Last sprint handover checklist of 1.4.0 release#165
Prafulrakhade merged 0 commit intomasterfrom
release-1.4.x

Conversation

@vishwa-vyom
Copy link
Contributor

This PR is created just to add the review comments as part of the critical code review task of last sprint handover checklist for release of 1.4.0 version.

** THIS PR SHOULD NOT BE MERGED **

Comment on lines 29 to 45
if: ${{ inputs.release_type == 'snapshot' }}
uses: mosip/kattu/.github/workflows/maven-publish-android.yml@master
with:
SERVICE_LOCATION: 'vc-verifier/kotlin'
ANDROID_SERVICE_LOCATION: 'vcverifier'
JAVA_VERSION: 21
LICENSE_NAME: 'MPL-2.0'
RELEASE_TYPE: ${{ inputs.release_type }}
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_URL: ${{ secrets.OSSRH_CENTRAL_URL }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }}

publish-release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{}}
Copy link
Contributor Author

@vishwa-vyom vishwa-vyom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few initial queries on scope

val disclosures = sdJwt.disclosures
val keyBindingJwt = sdJwt.bindingJwt

validateSDJwtStructure(credentialJwt, disclosures)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the class name, Sd is followed and in the method name SD is followed, any specific reason for this inconsistency ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can make it validateSdJwtStructure It's just a mistake

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwa-vyom handled here 6a1053c


val payload = JSONObject(decodeBase64Json(parts[1]))
validateKeyBindingPayload(payload)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our testing, we have tested the key binding aspect also ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be tested during OVP flow. Right now we have tested with unit tests

val header = jwsObject.header

if (header.x509CertChain.isEmpty()) {
throw IllegalArgumentException("No X.509 certificate chain found in JWT header")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical: This validation is not correct, SD-JWT can have other signature securing mechanisms.
Ref: https://datatracker.ietf.org/doc/draft-ietf-oauth-sd-jwt-vc/ (Section 3.5). As per certify, we also have support for DID based once.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwa-vyom created separate card to add support for other mechanism https://mosip.atlassian.net/browse/INJIMOB-3541

val urlSafeBase64Certificate = certBase64.replace("\\s+".toRegex(), "")
.replace('+', '-')
.replace('/', '_')
val certificateBytes = Base64Decoder().decodeFromBase64Url(urlSafeBase64Certificate)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we are converting normal base64 to base64 url and then using the base64 decoding method. Can we not have a method which does base64 directly, which can avoid all the above replaces ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwa-vyom It was due to reuse existing decode base64 url encoded method.
Added new method to decode base64 encoded data 5694fe1

val dateFormats = listOf(
private val dateFormats = listOf(
("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"),
("yyyy-MM-dd'T'HH:mm:ss'Z'")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the spec, is it not valid if we use the timezone specific times ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JWS_EDDSA_SIGN_ALGO_CONST to ED25519SignatureVerifierImpl(),
JWS_ES256K_SIGN_ALGO_CONST to ES256KSignatureVerifierImpl(),
JWS_ES256_SIGN_ALGO_CONST to ES256KSignatureVerifierImpl()
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a factory of verifier, any reason to keep it in util class ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwa-vyom handled here db765ac

@Prafulrakhade Prafulrakhade merged commit 6f2e979 into master Sep 8, 2025
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants