Skip to content

Commit

Permalink
Merge branch 'kw-secure-cookie' of https://github.com/adhocteam/Head-…
Browse files Browse the repository at this point in the history
…Start-TTADP into kw-secure-cookie
  • Loading branch information
kryswisnaskas committed Feb 12, 2021
2 parents 4ba76a9 + 6740fd5 commit 61cb04e
Show file tree
Hide file tree
Showing 44 changed files with 953 additions and 307 deletions.
10 changes: 8 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,23 @@ jobs:
- run:
name: Pull OWASP ZAP docker image
command: docker pull owasp/zap2docker-weekly
- run:
name: Make reports directory group writeable
command: chmod g+w reports
- run:
name: Run OWASP ZAP
command: |
docker run \
-v $(pwd)/zap.conf:/zap/wrk/zap.conf:rw \
-v $(pwd)/zap.conf:/zap/wrk/zap.conf:ro \
-v $(pwd)/reports:/zap/wrk:rw \
--rm \
--user zap:$(id -g) \
--network="project_smarthub" \
-t owasp/zap2docker-weekly zap-baseline.py \
-t http://server:8080 \
-c zap.conf -I -i
-c zap.conf -I -i -r owasp_report.html
- store_artifacts:
path: reports/owasp_report.html
accessibility_scan:
executor: docker-postgres-executor
steps:
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

Welcome to the home of the OHS TTADP.

<table>
<tr>
<th scope="col">HHS</th>
<th scope="col">Ad Hoc</th>
</tr>
<tr>
<td>

[![HHS](https://circleci.com/gh/HHS/Head-Start-TTADP.svg?style=shield)](https://app.circleci.com/pipelines/github/HHS/Head-Start-TTADP)

</td>
<td>

[![adhocteam](https://circleci.com/gh/adhocteam/Head-Start-TTADP.svg?style=shield)](https://app.circleci.com/pipelines/github/adhocteam/Head-Start-TTADP)

</td>
</tr>
</table>

## What We're Building and Why

For the latest on our product mission, goals, initiatives, and KPIs, see the [Product Planning page](https://github.com/HHS/Head-Start-TTADP/wiki/Product-Planning).
Expand All @@ -13,7 +32,7 @@ For the latest on our product mission, goals, initiatives, and KPIs, see the [Pr

1. Make sure Docker is installed. To check run `docker ps`.
2. Make sure you have Node 12.20.0 installed.
3. Run `yarn docker:deps`. This builds the frontend and backend docker containers and install dependencies. You only need to run this step the first time you fire up the app and when dependencies are added/updated/removed.
3. Run `yarn docker:deps`. This builds the frontend and backend docker containers and install dependencies. You only need to run this step the first time you fire up the app and when dependencies are added/updated/removed.
4. Copy `.env.example` to `.env`.
6. Change the `AUTH_CLIENT_ID` and `AUTH_CLIENT_SECRET` variables to to values found in the "Values for local development" section of the "Development Credentials" document. If you don't have access to this document, please ask in the hs-vendors-ohs-tta channel of the gsa-tts slack channel.
7. Optionally, set `CURRENT_USER` to your current user's uid:gid. This will cause files created by docker compose to be owned by your user instead of root.
Expand Down
22 changes: 14 additions & 8 deletions docs/boundary_diagram.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
System Boundary Diagram
=======================

<img src="http://www.plantuml.com/plantuml/png/fLPVRnit37_tf-3oKBX04tT91XJ3CDI9tJH3t7evjtqf4CWwsXQgawuYPTSO-jqdAkUpBqQ73GEIMAR87yaV_oYlYLNWMDdUJyPf6qk45NDDlmu6GMtEbePNSHu9W_QEqV6PzjL0bS4ejxQnZeFhozEfLOu_JEu6LZ4I9z73TT9Mnc4ugmMR3Lk4sMm8HPNSmTiuXxcFhbHX2sk3czuK0tdNh_E7G_i2JlQg7mZ3IP8C7Q0hJoKSy0lWrHFCa-Sxd1BNQ7r2w-2CTjAJZdYTG7s0reP0kH9kPfE4vpmZA8Anqs5Ri_7kNPBqXjQ2ba2rY2ZPraOpbg020cPT-RP9zC7ihe2VpyuXEej4u5FOOMC8GR3Birxode-zguQHljgGPFkfW1k_lhO-bYVFuQyUGAkXHRZqwwIMZsVftEW055jYh1x6trYG7fIT7wg1zQeydIkhd6veJOw6TrSfswvrw-L1rQO3CPpU_eDsy94pyxyzisgBWNw7lUdZ9OdVd1cyaPp25ZYenS9e80nhex71ttF2VYwnQXsmDAo4z_QsJHsWxRp-PhD9WTUTEBej-0ddCAnhQtI6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3lArCho0wNK1_pyvXUGi4e7d1SQL8GJ1BKyEq9LvAAoxgjw-jqg_Sj9xRG4pAxseqJ7rwFU2xoBUr-iG_JSZkeLV4nBJpwTY3wlBpQ-3zaIoKonH7ihXTaWW873q-kNhbq-PjXqLaQF19NOjiPVbtUBgcQl42tJIuOoKPKzitm-RwTFTikgCbXZDV0sc54jUxuVUkJmtFQUTQaPK9GrMqOXNOKp8457xMERu0tsrdNaNzIyZz0ZGsLFc6tKMssNGWAuCtZZUO_7BCBj4EkL5zrLabKH98QYeQjoy9VAM7Ghx02K-2G3F88M6L7iVf1vY9vcjb4bxRQJpucfmCOA92MYDmttDp4zQISAbORciHDZV5SSIUlJMebnl9OA85Xdsyf3f0sWJjKLjn5SUNbpjQAvSqLLxEnRTqsbFV3icapIpXXRPiK0r2q3Dzz7fQLlw7Ujjvxwk3SF2-tiH93ENZjum0lOGauE7qmZTQMImHv2Tr-G8W_Nhtil2Ew2aDHBDastX6k06wLgjxqOxklqmUzlUc7dY3ReorVPV)

UML Source
----------
Expand All @@ -12,19 +12,18 @@ UML Source
title TTA Smart Hub boundary view
Person(personnel, "Smart Hub User", "An end-user of the TTA Smart Hub")
Person(developer, "Smart Hub Developer", "Smart Hub vendor developers and GTM")
note as EncryptionNote
All connections depicted are encrypted with TLS 1.2 unless otherwise noted.
end note
Boundary(aws, "AWS GovCloud") {
Boundary(cloudgov, "cloud.gov") {
System_Ext(aws_alb, "cloud.gov load-balancer", "AWS ALB")
System_Ext(cloudgov_api, "cloud.gov API")
System_Ext(cloudgov_router, "<&layers> cloud.gov routers", "Cloud Foundry traffic service")
Boundary(atob, "Accreditation Boundary") {
Container(www_app, "<&layers> TTA Smart Hub Web Application", "NodeJS, Express, React", "Displays and collects TTA data. Multiple instances running")
Container(worker_app, "TTA Smart Hub Worker Application", "NodeJS, Bull", "Perform background work and data processing")
Container(clamav, "File scanning API", "ClamAV", "Internal application for scanning user uploads")
ContainerDb(www_db, "PostgreSQL Database", "AWS RDS", "Contains content and configuration for TTA Smart Hub")
ContainerDb(www_s3, "AWS S3 bucket", "AWS S3", "Stores static file assets")
ContainerDb(www_redis, "Redis Database", "AWS Elasticache", "Queue of background jobs to work on")
}
}
}
Expand All @@ -35,15 +34,22 @@ Boundary(gsa_saas, "FedRAMP-approved SaaS") {
Rel(developer, newrelic, "Manage performance & logging", "https GET/POST/PUT/DELETE (443)")
Rel(www_app, newrelic, "reports telemetry", "tcp (443)")
Rel(personnel, aws_alb, "manage TTA data", "https GET/POST/PUT/DELETE (443)")
note right on link
All connections depicted are encrypted with TLS 1.2 unless otherwise noted.
end note
Rel(www_s3, personnel, "download file attachments", "https GET (443)")
Rel(aws_alb, cloudgov_router, "proxies requests", "https GET/POST/PUT/DELETE (443)")
Rel(cloudgov_router, www_app, "proxies requests", "https GET/POST/PUT/DELETE (443)")
Rel(www_app, clamav, "scans files", "http POST (8080)")
Rel(www_app, HSES, "retrieve Grantee data", "https GET (443)")
Rel(worker_app, clamav, "scans files", "http POST (8080)")
Rel(worker_app, HSES, "retrieve Grantee data", "https GET (443)")
Rel(www_app, HSES, "authenticates user", "OAuth2")
Rel(personnel, HSES, "verify identity", "https GET/POST (443)")
BiRel(www_app, www_db, "reads/writes dataset records", "psql (5432)")
BiRel(www_app, www_db, "reads/writes dataset records", "psql")
BiRel(worker_app, www_db, "reads/writes dataset records", "psql")
BiRel(www_app, www_s3, "reads/writes data content", "vpc endpoint")
BiRel(worker_app, www_s3, "reads/writes data content", "vpc endpoint")
Rel(www_app, www_redis, "enqueues job parameters", "redis")
BiRel(worker_app, www_redis, "dequeues job parameters & updates status", "redis")
Boundary(development_saas, "CI/CD Pipeline") {
System_Ext(github, "GitHub", "HHS-controlled code repository")
System_Ext(circleci, "CircleCI", "Continuous Integration Service")
Expand All @@ -59,7 +65,7 @@ Lay_R(HSES, aws)
Instructions
------------

1. [Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/fLPVRnit37_tf-3oKBX04tT91XJ3CDI9tJH3t7evjtq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lUc7dY3ReorVPV)
1. Copy and paste the final UML into the UML Source section
1. Update the img src and edit link target to the current values

Expand Down
8 changes: 7 additions & 1 deletion docs/openapi/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ components:
description: Topics covered during the TTA
items:
type: string
approvingManager:
$ref: '#/components/schemas/user'
pageState:
type: object
enum: ['Not Started', 'In progress', 'Completed']
Expand All @@ -100,7 +102,11 @@ components:
type: string
status:
type: string
enum: ['draft', 'submitted']
enum:
- draft
- submitted
- approved
- needs_action
description: The current state of the report
ttaType:
type: array
Expand Down
8 changes: 4 additions & 4 deletions docs/openapi/paths/activity-reports/review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ put:
type: string
description: The status of the report after review
enum:
- Approved
- Needs Action
- approved
- needs_action
managerNotes:
type: string
description: Any notes the manager needs to relay to the author/collaborators of the report
Expand All @@ -40,7 +40,7 @@ put:
status:
type: string
enum:
- Approved
- Needs Action
- approved
- needs_action
managerNotes:
type: string
12 changes: 12 additions & 0 deletions frontend/src/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,15 @@ export const REGIONS = [
];

export const DECIMAL_BASE = 10;

export const managerReportStatuses = [
'needs_action',
'approved',
];

export const REPORT_STATUSES = {
DRAFT: 'draft',
SUBMITTED: 'submitted',
NEEDS_ACTION: 'needs_action',
APPROVED: 'approved',
};
41 changes: 23 additions & 18 deletions frontend/src/components/Navigator/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,48 @@ import {
render, screen, waitFor, within,
} from '@testing-library/react';

import { useFormContext } from 'react-hook-form';
import Navigator from '../index';
import { NOT_STARTED } from '../constants';

// eslint-disable-next-line react/prop-types
const Input = ({ name }) => {
const { register } = useFormContext();
return (
<input
type="radio"
data-testid={name}
name={name}
ref={register}
/>
);
};

const pages = [
{
position: 1,
path: 'first',
label: 'first page',
review: false,
render: (hookForm) => (
<input
type="radio"
data-testid="first"
ref={hookForm.register}
name="first"
/>
render: () => (
<Input name="first" />
),
},
{
position: 2,
path: 'second',
label: 'second page',
review: false,
render: (hookForm) => (
<input
type="radio"
data-testid="second"
ref={hookForm.register}
name="second"
/>
render: () => (
<Input name="second" />
),
},
{
position: 3,
label: 'review page',
path: 'review',
review: true,
render: (hookForm, allComplete, formData, onSubmit) => (
render: (allComplete, formData, onSubmit) => (
<div>
<button type="button" data-testid="review" onClick={onSubmit}>Continue</button>
</div>
Expand All @@ -57,9 +61,10 @@ describe('Navigator', () => {
const renderNavigator = (currentPage = 'first', onSubmit = () => {}, onSave = () => {}) => {
render(
<Navigator
reportId={1}
submitted={false}
initialData={initialData}
status="draft"
formData={initialData}
updateFormData={() => {}}
onReview={() => {}}
approvingManager={false}
defaultValues={{ first: '', second: '' }}
Expand All @@ -76,7 +81,7 @@ describe('Navigator', () => {
const firstInput = screen.getByTestId('first');
userEvent.click(firstInput);
const first = await screen.findByRole('button', { name: 'first page' });
await waitFor(() => expect(within(first).getByText('In progress')).toBeVisible());
await waitFor(() => expect(within(first).getByText('In Progress')).toBeVisible());
});

it('onContinue calls onSave with correct page position', async () => {
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/components/Navigator/components/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
import { startCase } from 'lodash';
import Sticky from 'react-stickynode';
import { Button, Tag, Alert } from '@trussworks/react-uswds';
import { useMediaQuery } from 'react-responsive';
import moment from 'moment';

import Container from '../../Container';
import './SideNav.css';
import { REPORT_STATUSES } from '../../../Constants';
import {
NOT_STARTED, IN_PROGRESS, COMPLETE, SUBMITTED, APPROVED, NEEDS_ACTION,
NOT_STARTED, IN_PROGRESS, COMPLETE,
} from '../constants';

const tagClass = (state) => {
Expand All @@ -24,11 +26,11 @@ const tagClass = (state) => {
return 'smart-hub--tag-in-progress';
case COMPLETE:
return 'smart-hub--tag-complete';
case SUBMITTED:
case REPORT_STATUSES.SUBMITTED:
return 'smart-hub--tag-submitted';
case APPROVED:
case REPORT_STATUSES.APPROVED:
return 'smart-hub--tag-submitted';
case NEEDS_ACTION:
case REPORT_STATUSES.NEEDS_ACTION:
return 'smart-hub--tag-needs-action';
default:
return '';
Expand All @@ -50,10 +52,10 @@ function SideNav({
>
<span className="margin-left-2">{page.label}</span>
<span className="margin-left-auto margin-right-2">
{page.state !== 'draft'
{page.state !== REPORT_STATUSES.DRAFT
&& (
<Tag className={`smart-hub--tag ${tagClass(page.state)}`}>
{page.state}
{startCase(page.state)}
</Tag>
)}
</span>
Expand Down
Loading

0 comments on commit 61cb04e

Please sign in to comment.