Skip to content

Commit

Permalink
lint all files
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyDrane committed Sep 4, 2023
1 parent 63ea248 commit dc9b556
Show file tree
Hide file tree
Showing 70 changed files with 1,440 additions and 967 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ NEXT_PUBLIC_API_URL_PROXY=

# UI Specific for integration tests
DOMAIN=
RESOURCE_PREFIX=
RESOURCE_PREFIX=
10 changes: 5 additions & 5 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: rAPId Dev Deployment
on:
push:
branches:
- "**"
- '**'

workflow_dispatch:

Expand All @@ -25,8 +25,8 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
python-version: '3.10'
cache: 'pip'

- run: pip install -r requirements.txt

Expand Down Expand Up @@ -79,8 +79,8 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
python-version: '3.10'
cache: 'pip'

- name: Setup Python Environment
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
python-version: '3.10'
cache: 'pip'

- run: pip install -r requirements.txt

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
python-version: '3.10'
cache: 'pip'

- name: Setup Python Environment
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/scheduled-vulnerability-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Scheduled api vulnerability scan results check
on:
schedule:
- cron: "0 9,15 * * *"
- cron: '0 9,15 * * *'

workflow_dispatch:

Expand All @@ -13,16 +13,13 @@ jobs:
- uses: actions/checkout@v3

- name: Export env vars
run:
cp ./.github/.github.env .env
run: cp ./.github/.github.env .env

- name: Export AWS_ACCOUNT
run:
echo AWS_ACCOUNT=${{ secrets.AWS_ACCOUNT }} >> .env
run: echo AWS_ACCOUNT=${{ secrets.AWS_ACCOUNT }} >> .env

- name: Export AWS_REGION
run:
echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env
run: echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env

- name: Check for vulnerabilities
run: make api-scheduled-prod-scan
2 changes: 1 addition & 1 deletion .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
- name: Run playwright tests
run: make ui-test-e2e
env:
DOMAIN_NAME: "https://${{ secrets.DOMAIN_NAME }}"
DOMAIN_NAME: 'https://${{ secrets.DOMAIN_NAME }}'
RESOURCE_PREFIX: ${{ secrets.RESOURCE_PREFIX }}
AWS_REGION: ${{ secrets.AWS_REGION }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ docs/_build/

ui/playwright/.auth
ui/playwright/.downloads
ui/test-results/
ui/test-results/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<img src="./logo.png" display=block margin-left=auto margin-right=auto width=80%;/>

# Project rAPId

![Deployment Pipeline](https://github.com/no10ds/rapid/actions/workflows/main.yml/badge.svg)

<a href="https://ukgovernmentdigital.slack.com/archives/C03E5GV2LQM"><img src="https://user-images.githubusercontent.com/609349/63558739-f60a7e00-c502-11e9-8434-c8a95b03ce62.png" width=160px; /></a>
Expand Down Expand Up @@ -37,9 +38,11 @@ Or you can consult the [Infrastructure Repo](https://github.com/no10ds/rapid/tre
# Developing

This is a quick guide to running rAPId locally for development.

## Prerequisites

Install all the required tools

- jq (use Homebrew)
- Git
- [pre-commit](https://pre-commit.com)
Expand Down
8 changes: 7 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,27 @@ Cabinet Office and No10 are advocates of responsible vulnerability disclosure. I
You can report a vulnerability through our vulnerability disclosure programme at [HackerOne](https://hackerone.com/44c348eb-e030-4273-b445-d4a2f6f83ba8/embedded_submissions/new). Alternatively, you can send an email to [disclosure@digital.cabinet-office.gov.uk](mailto:disclosure@digital.cabinet-office.gov.uk); if you do this you may get a response from Zendesk, which is our ticketing system.

When reporting a vulnerability to us, please include:

- the website, page or repository where the vulnerability can be observed
- a brief description of the vulnerability
- details of the steps we need to take to reproduce the vulnerability
- non-destructive exploitation details

If you are able to, please also include:

- the type of vulnerability, for example, the [OWASP category](https://owasp.org/www-community/vulnerabilities/)
- screenshots or logs showing the exploitation of the vulnerability

[Reach out via email](mailto:disclosure@digital.cabinet-office.gov.uk) if you are not sure if the vulnerability is genuine and exploitable, or you have found:

- a non-exploitable vulnerability
- something you think could be improved - for example, missing security headers
- TLS configuration weaknesses - for example weak cipher suite support or the presence of TLS1.0 support

## Guidelines for reporting a vulnerability

When you are investigating and reporting the vulnerability on a gov.uk domain or subdomain, you must not:

- break the law
- access unnecessary or excessive amounts of data
- modify data
Expand All @@ -40,17 +45,18 @@ When you are investigating and reporting the vulnerability on a gov.uk domain or
Only submit reports about exploitable vulnerabilities through HackerOne.

## Bug bounty

Unfortunately, Cabinet Office and No10 do not offer a paid bug bounty programme. We will make efforts to show appreciation to people who take the time and effort to disclose vulnerabilities responsibly. We do have [an acknowledgements page for legitimate issues found by researchers](https://vdp.cabinetoffice.gov.uk/thanks.txt).

---

#### Further reading and inspiration about responsible disclosure and `SECURITY.md`

- <https://www.gov.uk/help/report-vulnerability>
- <https://www.ncsc.gov.uk/information/vulnerability-reporting>
- <https://mojdigital.blog.gov.uk/vulnerability-disclosure-policy/>
- <https://github.com/Trewaters/security-README>
- <https://github.com/alphagov/security.txt>


[CODE_OF_CONDUCT.md]: https://github.com/alphagov/.github/blob/master/CODE_OF_CONDUCT.md
[OWASP category]: https://www.owasp.org/index.php/Category:OWASP_Top_Ten_2017_Project
18 changes: 9 additions & 9 deletions api/batect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ tasks:
ports:
- local: 8000
container: 8000
command: "uvicorn api.entry:app --host 0.0.0.0 --port 8000 --reload"
command: 'uvicorn api.entry:app --host 0.0.0.0 --port 8000 --reload'

test-unit:
description: Run unit tests
run:
container: service-image
command: "pytest test/api -vv -s"
command: 'pytest test/api -vv -s'

test-unit-focus:
description: Run unit tests
run:
container: service-image
command: "pytest test/api -vv -m focus"
command: 'pytest test/api -vv -m focus'

test-e2e:
description: Run E2E tests
Expand All @@ -86,7 +86,7 @@ tasks:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN:-}
command: "pytest test/e2e -v"
command: 'pytest test/e2e -v'

test-e2e-focus:
description: Run E2E tests in focus mode
Expand All @@ -96,28 +96,28 @@ tasks:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN:-}
command: "pytest test/e2e -v -m focus"
command: 'pytest test/e2e -v -m focus'

test-coverage:
description: Run all tests with coverage report for source code only
run:
container: service-image
command: "pytest --durations=5 --cov=api --cov-report term-missing test/api"
command: 'pytest --durations=5 --cov=api --cov-report term-missing test/api'

lint:
description: Lint the source and test code
run:
container: service-image
command: "flake8 api test"
command: 'flake8 api test'

format:
description: Format the source and test code
run:
container: service-image
command: "black api test"
command: 'black api test'

generate_latest_changelog:
description: Parse the changelog file for the release's changes
run:
container: service-image
command: "python get_latest_release_changelog.py"
command: 'python get_latest_release_changelog.py'
Loading

0 comments on commit dc9b556

Please sign in to comment.