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

Fb orscf #295

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Fb orscf #295

wants to merge 35 commits into from

Conversation

mbastian93
Copy link
Contributor

add orscf features to enable the study to be managed via orscf dashboard.

these features are optional

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

return resp.status(200).json({
fault: null,
createdVisitUids: createdVisitUids,
updatedVisitUids: updatedVisitUids

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression (experimental)

(Experimental) This may be a path that depends on [a user-provided value](1). Identified using machine learning.
WHERE subject_uid = $5 RETURNING subject_uid',
[
subjectMutation.periodStart,
subjectMutation.status,

Check failure

Code scanning / CodeQL

SQL database query built from user-controlled sources (experimental)

(Experimental) This may be a database query that depends on [a user-provided value](1). Identified using machine learning.
[
subjectMutation.periodStart,
subjectMutation.status,
subjectMutation.periodEnd,

Check failure

Code scanning / CodeQL

SQL database query built from user-controlled sources (experimental)

(Experimental) This may be a database query that depends on [a user-provided value](1). Identified using machine learning.
public async applyVisitBatchMutation(req: Request, resp: Response) {
try {
const visitUids: string[] = req.body.visitUids;
if (visitUids == undefined || visitUids == null) {

Check notice

Code scanning / CodeQL

Unneeded defensive code

This guard always evaluates to false.
return resp.status(200).json({ fault: 'no visits on request', return: null });
}
const mutation: VdrModels.BatchableVisitMutation = req.body.mutation;
if (mutation == undefined || mutation == null) {

Check notice

Code scanning / CodeQL

Unneeded defensive code

This guard always evaluates to false.
Copy link
Contributor Author

@mbastian93 mbastian93 left a comment

Choose a reason for hiding this comment

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

Found some unused(?) code and some possibly uncaught errors

Also: why is there VisitModel and VisitModel2?

@KornSW @keinich

src/controllers/sdr/SdrApiInfoController.ts Show resolved Hide resolved
src/controllers/sdr/SdrApiInfoController.ts Show resolved Hide resolved
src/controllers/vdr/VdrApiInfoController.ts Show resolved Hide resolved
src/controllers/vdr/VdrApiInfoController.ts Show resolved Hide resolved
src/models/OrscfStateModel.ts Outdated Show resolved Hide resolved
logger.info(cmd);
const getVisitsQuery = await pool.query(cmd);
return getVisitsQuery.rows.map((x) => {
return VdrMappingHelper.toCamelCase(x);
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 is redundant as the query already returns all attributes in camel case?

Comment on lines +268 to +277
// const searchQuery2 = await pool.query(`SELECT \
// subject_uid AS "subjectUid", \
// subject_id AS "subjectIdentifier", \
// study_uid AS "studyUid", \
// actual_site_uid AS "actualSiteUid", \
// 0 AS "isArchived", \
// 0 AS modiciationTimestampUtc \
// FROM studyparticipant`);

// return searchQuery2.rows;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused code?

Comment on lines +39 to +46
// result = SearchFilterService.appendAndFilter(
// result,
// SearchFilterService.buildStringClause(filter.assignedArm, varName, 'assigned_arm')
// );
// result = SearchFilterService.appendAndFilter(
// result,
// SearchFilterService.buildStringClause(filter.actualArm, varName, 'actual_arm')
// );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused code?

Comment on lines +185 to +193

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static secretCallback(req, payload, done) {
const result = env
.get('JWT_SECRET')
.default(randomBytes(256).toString('base64'))
.asString();
done(null, result);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused method?

Comment on lines +195 to +197
static getJwtSecret(): string {
return env.get('JWT_SECRET').default(randomBytes(256).toString('base64')).asString();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same method as in AuthConfig: duplicate code; also unused

'${dr.recordedData}'
)`;
logger.info(cmd);
await pool.query(cmd);

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources

This query depends on a [user-provided value](1). This query depends on a [user-provided value](2).
where id = '${dr.dataRecordingUid}'
`;
logger.info(cmd);
await pool.query(cmd);

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources

This query depends on a [user-provided value](1). This query depends on a [user-provided value](2).
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