Skip to content

Commit

Permalink
Add MO Fortify cookie fixes (#1317)
Browse files Browse the repository at this point in the history
* Add MO Fortify cookie fixes

* Fix lint issue

* Update yarn-audit-known-issues

* Update yarn-audit-known-issues

* enabling fortify scan to test if the stage passes

* Use released node lib version

---------

Co-authored-by: Kasi Subramaniam <singlekasi@gmail.com>
Co-authored-by: Andy Wilkins <49269487+andywilkinshmcts@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent cf74fcd commit ccb84a8
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 31 deletions.
3 changes: 2 additions & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ withPipeline(type, product, component) {
disableCleanupOfHelmReleaseOnFailure()
enableSlackNotifications(channel)
loadVaultSecrets(secrets)
enableFortifyScan('rpx-aat')
enableAksStagingDeployment()
syncBranchesWithMaster(branchesToSync)

Expand Down Expand Up @@ -197,5 +198,5 @@ withPipeline(type, product, component) {
reportName : 'AAT Functional Test'
])
}

}
12 changes: 9 additions & 3 deletions api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AUTH, AuthOptions, xuiNode } from '@hmcts/rpx-xui-node-lib';
import { NextFunction, Request, Response } from 'express';
import { CookieOptions, NextFunction, Request, Response } from 'express';
import { getConfigValue, showFeature } from '../configuration';
import {
COOKIE_TOKEN,
Expand Down Expand Up @@ -37,8 +37,12 @@ export const successCallback = async (req: EnhancedRequest, res: Response, next:
const { userinfo } = req.session.passport.user;

logger.info('Setting session and cookies');
const cookieOptions: CookieOptions = {
sameSite: 'none',
secure: true
};
// set browser cookie
res.cookie(getConfigValue(COOKIE_TOKEN), accessToken);
res.cookie(getConfigValue(COOKIE_TOKEN), accessToken, cookieOptions);

if (!req.session.auth) {
const auth = {
Expand Down Expand Up @@ -124,7 +128,9 @@ export const getXuiNodeMiddleware = () => {
cookie: {
httpOnly: true,
maxAge: 1800000,
secure: showFeature(FEATURE_SECURE_COOKIE_ENABLED)
secure: showFeature(FEATURE_SECURE_COOKIE_ENABLED),
// set as 'lax' as problems with logging in when set to 'none'
sameSite: 'lax'
},
name: 'xui-mo-webapp',
resave: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@hmcts/nodejs-healthcheck": "1.7.0",
"@hmcts/properties-volume": "0.0.13",
"@hmcts/rpx-xui-common-lib": "2.0.31",
"@hmcts/rpx-xui-node-lib": "2.29.1",
"@hmcts/rpx-xui-node-lib": "2.29.7",
"@ng-idle/core": "^14.0.0",
"@ng-idle/keepalive": "^14.0.0",
"@ngrx/effects": "^17.2.0",
Expand Down
2 changes: 1 addition & 1 deletion test/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

sourceCompatibility = 11
targetCompatibility = 11
targetCompatibility = 17

// tag::repositories[]
repositories {
Expand Down
2 changes: 1 addition & 1 deletion yarn-audit-known-issues

Large diffs are not rendered by default.

Loading

0 comments on commit ccb84a8

Please sign in to comment.