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

Shane findley patch 6 #2

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
32c7026
Update testing-functions.ts
ShaneFindley Nov 14, 2023
75da868
Update testing-functions.ts
ShaneFindley Nov 14, 2023
af094da
Update testing-functions.ts
ShaneFindley Nov 18, 2023
bcbb61e
Update testing-functions.ts
ShaneFindley Nov 18, 2023
44b989f
Update testing-functions.ts
ShaneFindley Nov 18, 2023
48ef383
Update testing-functions.ts
ShaneFindley Nov 20, 2023
064d7bc
Update testing-functions.ts
ShaneFindley Nov 20, 2023
c03f655
Update testing-functions.ts
ShaneFindley Nov 20, 2023
aafd019
Creating security bugs
ShaneFindley Nov 20, 2023
ec134e0
Update testing-functions.ts
ShaneFindley Nov 21, 2023
d2e8b8a
Update testing-functions.ts
ShaneFindley Nov 22, 2023
50377ed
Update testing-functions.ts
ShaneFindley Nov 22, 2023
ca6fa6f
Update testing-functions.ts
ShaneFindley Nov 27, 2023
e1662bc
Update testing-functions.ts
ShaneFindley Nov 27, 2023
1ca8a00
Update testing-functions.ts
ShaneFindley Nov 27, 2023
b9c5b55
Update testing-functions.ts
ShaneFindley Nov 27, 2023
188973a
Update testing-functions.ts
ShaneFindley Dec 4, 2023
68dcd20
Update testing-functions.ts
ShaneFindley Dec 4, 2023
8d3341b
Update testing-functions.ts
ShaneFindley Dec 4, 2023
9889f81
Update testing-functions.ts
ShaneFindley Dec 7, 2023
9fcb5f7
Update testing-functions.ts
ShaneFindley Dec 7, 2023
c906587
Update testing-functions.ts
ShaneFindley Dec 8, 2023
dbedaf9
Update testing-functions.ts
ShaneFindley Dec 12, 2023
732f630
Update testing-functions.ts
ShaneFindley Dec 22, 2023
cf17d58
Update testing-functions.ts
ShaneFindley Dec 22, 2023
7a32993
Update testing-component.tsx
ShaneFindley Dec 22, 2023
a8f9292
Create Dockerfile
ShaneFindley Jan 18, 2024
a21ea8f
Update code.tsx
ShaneFindley Jan 23, 2024
618af52
Update testing-component.tsx
gibberwockie Jan 23, 2024
0e4a511
Update confirmation-dialog.tsx
gibberwockie Jan 23, 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
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM public.ecr.aws/docker/library/amazoncorretto:17.0.9 AS core

ARG FD_VERSION=8.0-SNAPSHOT
ENV ENV_TYPE="" \
VERSION=${SONARCLOUD_VERSION} \
HOME=/opt/fd \
JDBC_USERNAME=fd \
JDBC_PASSWORD=fd \
JDBC_URL="jdbc:postgresql://localhost/fd" \
JWT_BASE64_HS256_SECRET=""

RUN yum install -y jq shadow-utils unzip \
&& yum clean all \
&& rm -rf /var/cache/yum

# Http port
EXPOSE 9000
EXPOSE 9001

RUN groupadd -r fd && useradd -r -g fd fd

SHELL ["/bin/bash", "-c"]
COPY sonarqube-${VERSION} $HOME
RUN chown -R fd:fd $HOME \
&& rm -rf $HOME/bin/*

VOLUME "$HOME/data"

COPY run.sh $HOME/bin/

WORKDIR $HOME

USER fd
ENTRYPOINT ["./bin/run.sh"]

# BOM file is generated in build.sh from core stage image before this final stage
FROM core
COPY bom.json bom.json.asc ./
2 changes: 1 addition & 1 deletion src/common/code-block/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'prismjs/themes/prism-okaidia.min.css'

export default function Code ({ code, language, title }: { code: string, language: string, title?: string }) {
useEffect(() => {
Prism.highlightAll()
Prism.highlightAll()
}, [])
return (
<div className="Code">
Expand Down
56 changes: 27 additions & 29 deletions src/common/confirmation-dialog/confirmation-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,42 @@ export default function ConfirmationDialog (
onCancel,
maxWidth = 'sm',
disableActions = false
}: Props
}: Readonly<Props>
) {
const confirm = confirmLabel ?? 'OK'
const cancel = cancelLabel ?? 'Cancel'

return <>
<Dialog
return <Dialog
open={show}
onClose={onCancel}
maxWidth={maxWidth}
fullWidth={true}
scroll={'body'}
keepMounted={false}
>
<DialogTitle children={title}/>
<DialogContent>
{
isString(children)
? <Typography variant={'body1'} children={children} />
: children
}
</DialogContent>
{
!disableActions && <DialogActions style={{ padding: 24 }}>
<Button
color={'secondary'}
onClick={onCancel}
children={cancel}
variant='outlined'
/>
<Button
autoFocus
children={confirm}
onClick={onConfirm}
variant='outlined'
/>
</DialogActions>
}
</Dialog>
</>
<DialogTitle children={title}/>
<DialogContent>
{
isString(children)
? <Typography variant={'body1'} children={children} />
: children
}
</DialogContent>
{
!disableActions && <DialogActions style={{ padding: 24 }}>
<Button
color={'secondary'}
onClick={onCancel}
children={cancel}
variant='outlined'
/>
<Button
autoFocus
children={confirm}
onClick={onConfirm}
variant='outlined'
/>
</DialogActions>
}
</Dialog>
}
46 changes: 46 additions & 0 deletions src/jest/testing-component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,50 @@
import { useState } from 'react'

export const timeFormat = 'HH:mm:ss'
export const timeFormat2 = 'HH:mm:ss'
export const timeFormat3 = 'HH:mm:ss'
export const timeFormat4 = 'HH:mm:ss'
export const timeFormat5 = 'HH:mm:ss'

export function echo() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo2() {
console.log();
console.log();
console.log();
console.log();
console.log();
}

export function echo3() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo4() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo5() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

const STATUS = {
HOVERED: 'hovered',
Expand Down
73 changes: 67 additions & 6 deletions src/jest/testing-functions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,72 @@
import { format } from 'date-fns'
import orderBy from 'lodash/orderBy'
import { randomUUID } from 'crypto'
import { createCipheriv, createDecipheriv, randomUUID } from 'crypto';
import { format } from 'date-fns';
import orderBy from 'lodash/orderBy';

import { type IGroupedTransactions, type ITransaction, type IPushedTransactions } from './types'
import { type IGroupedTransactions, type IPushedTransactions, type ITransaction } from './types';

const encryption_key = "byz9VFNtbRQM0yBODcCb1lrUtVVH3D3x"; // Must be 32 characters
const initialization_vector = "X05IGQ5qdBnIqAWD"; // Must be 16 characters

function encrypt(text){
const cipher = createCipheriv('aes-256-cbc',Buffer.from(encryption_key), Buffer.from(initialization_vector))

Check failure

Code scanning / SonarCloudsquad-3

Encryption algorithms should be used with secure mode and padding scheme

<!--SONAR_ISSUE_KEY:AY1pBgrDE3VqTM19eISq-->Use a secure mode and padding scheme. <p>See more on <a href="https://squad-3-core.sc-dev.io/project/issues?id=anita-stanisz-sonarsource_react-base&issues=AY1pBgrDE3VqTM19eISq&open=AY1pBgrDE3VqTM19eISq&pullRequest=2">SonarCloud</a></p>

Check failure

Code scanning / SonarCloudsquad-5

Encryption algorithms should be used with secure mode and padding scheme High test

Use a secure mode and padding scheme. See more on SonarCloud
var crypted = cipher.update(text, 'utf8', 'hex')
crypted += cipher.final('hex')
return crypted
}

function decrypt(text){
const decipher = createDecipheriv('aes-256-cbc',Buffer.from(encryption_key), Buffer.from(initialization_vector))
let dec = decipher.update(text, 'hex', 'utf8')
dec += decipher.final('utf8')
return dec
}

const requestDateFormat = 'yyyy-MM-dd'
const timeFormat = 'HH:mm:ss'
export const timeFormat = 'HH:mm:ss'
export const timeFormat2 = 'HH:mm:ss'
export const timeFormat3 = 'HH:mm:ss'
export const timeFormat4 = 'HH:mm:ss'
export const timeFormat5 = 'HH:mm:ss'

export function echo() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo2() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo3() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo4() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

export function echo5() {
console.error();
console.error();
console.error();
console.error();
console.error();
}

function mapTransactions (data: IPushedTransactions | undefined) {
if (data != null) {
Expand All @@ -29,7 +90,7 @@
const orderedTrans = orderBy(newTrans, x => x.soldAt, 'desc')
for (const tran of orderedTrans) {
const index = groupedItems.findIndex(x => x.date === tran.soldAt)
if (index === -1) {
if (index === -1) {
groupedItems.push({
comparisonDate: new Date(tran.soldAt).getTime(),
date: tran.soldAt,
Expand Down
Loading