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

Deploy to test #1909

Merged
merged 147 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
34222d1
chore(pyproject): require azure key vault libs
thekaveman Jan 26, 2024
d92a091
feat(secrets): POC reads value using azure libs
thekaveman Jan 26, 2024
1ce493b
feat(settings): helper calculates runtime env from hosts
thekaveman Jan 29, 2024
082d6cf
refactor(sentry): use RUNTIME_ENVIRONMENT by default
thekaveman Jan 29, 2024
4e941bf
refactor(secrets): calculate key vault URL from runtime env
thekaveman Jan 30, 2024
1ce210d
feat(admin): first pass @ django_google_sso; allow compiler.la domains
machikoyasuda Jan 17, 2024
60d3d95
fix(settings): allow wikimedia link
machikoyasuda Jan 17, 2024
33edf7d
fix(pyproject): require django-google-sso
machikoyasuda Jan 17, 2024
e1a61c9
fix(csp): add admin.js files, add google sso user icons to allowlist
machikoyasuda Jan 17, 2024
f603890
fix(tests): only install django-google-sso, only add sso url if admin
machikoyasuda Jan 17, 2024
7360fd1
fix(settings): move app to installed_apps if admin
machikoyasuda Jan 17, 2024
bbb64a1
feat(admin): fetch and save admin user's ggoogle email, first and las…
machikoyasuda Jan 17, 2024
575ef39
refactor(settings): save allowable_domains as a dictionary in Terraform
machikoyasuda Jan 17, 2024
b8e0acb
refactor(settings): add google sso svg, remove wikimedia from csp
machikoyasuda Jan 17, 2024
35a6a46
fix(pyproject): unpin version
machikoyasuda Jan 17, 2024
8c21ca2
fix(pyproject): use ==
machikoyasuda Jan 17, 2024
de6f66d
feat(admin): create allow list for staff and admin + terraform vars
machikoyasuda Jan 19, 2024
38e9a07
fix(settings): remove 120.. from allowed_hosts
machikoyasuda Jan 30, 2024
0bee9a9
refactor(sso): use requests, not httpx
machikoyasuda Jan 30, 2024
3c3fdc9
feat(secrets): helper function gets secret by name
thekaveman Jan 30, 2024
d5125e4
feat(devcontainer): install Azure CLI
thekaveman Feb 2, 2024
259bac6
feat(secrets): DEBUG-only route reads a test secret
thekaveman Feb 2, 2024
660f269
feat(test): test in progress
machikoyasuda Feb 2, 2024
066f6f9
docs: README.md > SBMTD Mobility Pass status
indexing Feb 2, 2024
8da3304
Low-income use case
indexing Feb 3, 2024
93c79b8
chore(pre-commit): autofix run
pre-commit-ci[bot] Feb 3, 2024
2dd7d14
docs: README.md > SBMTD Mobility Pass status (#1871)
thekaveman Feb 3, 2024
6b3f899
chore(deps): bump treosh/lighthouse-ci-action from 10.1.0 to 11.4.0
dependabot[bot] Feb 5, 2024
0d5984e
fix(tests): use mocker; fixed tests yay
machikoyasuda Feb 6, 2024
2e28ec7
chore: undo test changes
machikoyasuda Feb 6, 2024
a0c4b2e
refactor(admin): move code to Admin.py
machikoyasuda Feb 6, 2024
4f98e63
fix(settings): remove if ADMIN checks
machikoyasuda Feb 6, 2024
88bac57
chore(deps): bump treosh/lighthouse-ci-action from 10.1.0 to 11.4.0 (…
machikoyasuda Feb 6, 2024
1092e1a
refactor(settings): introduce new default 'local' runtime env
thekaveman Feb 6, 2024
0c28146
fix(test): fix test
machikoyasuda Feb 7, 2024
5c00e19
fix: rename to core, remove unused file
machikoyasuda Feb 7, 2024
0e55a8c
refactor(secrets): fallback to environment for local runtime
thekaveman Feb 7, 2024
e055d86
refactor(secrets): error handling for Azure auth problems
thekaveman Feb 7, 2024
49c78a3
fix(tests): remove tests, un-remove admin check
machikoyasuda Feb 7, 2024
147cd51
fix: undo admin fixture
machikoyasuda Feb 7, 2024
643f830
chore(deps-dev): bump sentry-sdk from 1.40.0 to 1.40.2
dependabot[bot] Feb 7, 2024
4eec8a5
chore(deps-dev): bump sentry-sdk from 1.40.0 to 1.40.2 (#1879)
machikoyasuda Feb 7, 2024
8faf1a7
Admin: Add Google SSO for Compiler users (#1855)
machikoyasuda Feb 8, 2024
9e310a7
Feat: helper script to read KeyVault secrets (#1859)
thekaveman Feb 8, 2024
c4f7b62
feat(secrets): Django validator for secret names
thekaveman Feb 6, 2024
5c94f12
feat(secrets): Django field for storing secret names
thekaveman Feb 6, 2024
ca91759
refactor(models): AuthProvider.client_id is a secret field
thekaveman Feb 6, 2024
cb315e6
refactor(models): EligibilityVerifier.api_auth_key is a secret field
thekaveman Feb 6, 2024
a4b3675
refactor(models): PemData.data could come from a secret field
thekaveman Feb 6, 2024
bce9ab3
refactor(secrets): enforce name validation in helper function
thekaveman Feb 8, 2024
4ae08a9
fix(secrets): env vars can't contain hyphens
thekaveman Feb 8, 2024
0caa851
fix(ci): start from the .env.sample
thekaveman Feb 8, 2024
3721d8c
refactor(models): rename secret field for clarity
thekaveman Feb 8, 2024
cd8bf53
chore(terraform): update lock file after init
thekaveman Feb 8, 2024
a7a5f54
chore(deps-dev): bump sentry-sdk from 1.40.2 to 1.40.3
dependabot[bot] Feb 9, 2024
8523ec9
Update docs/enrollment-pathways/Low-income.md formatting
indexing Feb 9, 2024
d6bebe2
Update docs/enrollment-pathways/Low-income.md remove link to application
indexing Feb 9, 2024
3a490c0
Update docs/enrollment-pathways/Low-income.md remove link to application
indexing Feb 9, 2024
deb0fbb
Update docs/enrollment-pathways/Low-income.md adding code syntax for …
indexing Feb 9, 2024
4c10d2c
Update docs/enrollment-pathways/Low-income.md remove link to application
indexing Feb 9, 2024
bd70f88
Update docs/enrollment-pathways/Low-income.md remove link to application
indexing Feb 9, 2024
c1bed4e
Update docs/enrollment-pathways/Low-income.md clarifying acronym
indexing Feb 9, 2024
633a6e6
Update docs/enrollment-pathways/Low-income.md capitalization
indexing Feb 9, 2024
ea09cec
Update docs/enrollment-pathways/Low-income.md capitalization
indexing Feb 9, 2024
d0ed1bd
Rename Low-income.md to low-income.md
indexing Feb 9, 2024
73e0129
Update low-income.md removed extraneous bolding on headings
indexing Feb 9, 2024
8af3ba3
Update low-income.md added additional benefits to using Benefits!
indexing Feb 9, 2024
03727b2
chore(pre-commit): autofix run
pre-commit-ci[bot] Feb 9, 2024
512512c
Update low-income.md added sequence diagram to basic flow section
indexing Feb 10, 2024
094f12c
Update copy-delivery.md Updated name of Copy Master
indexing Feb 10, 2024
87c17f0
Update README.md adding 2024 – 2025 Benefits product roadmap
indexing Feb 10, 2024
391d593
chore(pre-commit): autofix run
pre-commit-ci[bot] Feb 10, 2024
eed1319
Update .pages remove design style guide page
indexing Feb 10, 2024
5b57135
feat(terraform): define storage recovery vault and policy
thekaveman Feb 8, 2024
ed704d3
docs(terraform): add step for local tfvars setup
thekaveman Feb 12, 2024
eac947e
Refactor: model secret fields (#1874)
thekaveman Feb 12, 2024
20ab413
Update low-income.md updated IdG hyperlink
indexing Feb 13, 2024
3edb2ae
chore(deps-dev): bump sentry-sdk from 1.40.2 to 1.40.3 (#1882)
machikoyasuda Feb 13, 2024
1dffc3a
chore(deps-dev): bump django from 5.0.1 to 5.0.2
dependabot[bot] Feb 13, 2024
a4d5c54
chore(deps-dev): bump sentry-sdk from 1.40.3 to 1.40.4
dependabot[bot] Feb 13, 2024
df25d78
refactor: use cal-itp/littlepay to check API access
angela-tran Feb 13, 2024
b9ad1cd
Updated name of Copy Master (#1883)
angela-tran Feb 13, 2024
4caf72e
adding 2024 – 2025 Benefits product roadmap (#1884)
angela-tran Feb 13, 2024
040a5b0
remove design style guide page (#1885)
angela-tran Feb 13, 2024
a7084bb
fix(secrets): use literal newlines in multiline env vars
thekaveman Feb 13, 2024
071a63b
Secrets: update guidance and parsing for local multiline env vars (#1…
thekaveman Feb 14, 2024
e4794bc
refactor(admin): assume database and superuser already exist
angela-tran Jan 23, 2024
4625f25
refactor(admin): admin interface is always enabled
angela-tran Jan 23, 2024
d9b2c28
test(admin): update unit test assertion
angela-tran Jan 23, 2024
2174ac8
feat: add script for resetting the database
angela-tran Feb 8, 2024
0e0f37c
refactor(settings): consolidate template processors
thekaveman Feb 13, 2024
84956df
test(admin): assert redirects to login page
thekaveman Feb 13, 2024
eeffe2e
test(admin): pre_login_user success and failure
thekaveman Feb 13, 2024
f394a3c
chore(settings): remove unused variable
thekaveman Feb 13, 2024
6f9ba82
chore(config): add sample SUPERUSER env vars
thekaveman Feb 13, 2024
409391e
feat(devcontainer): startup with the reset_db script
thekaveman Feb 13, 2024
c2b074f
refactor(migrations): remove data migration, use local fixtures
thekaveman Feb 13, 2024
4bac379
fix(tests): container startup script specifically for Cypress
thekaveman Feb 14, 2024
2d77311
Feat: configure Azure file share backup (#1886)
thekaveman Feb 14, 2024
b1ecb05
Low-income use case (#1872)
machikoyasuda Feb 14, 2024
1178784
chore(deps-dev): bump sentry-sdk from 1.40.3 to 1.40.4 (#1888)
machikoyasuda Feb 14, 2024
0a744c3
chore(deps-dev): bump django from 5.0.1 to 5.0.2 (#1875)
machikoyasuda Feb 14, 2024
493a7ec
Refactor: use cal-itp/littlepay to check API access (#1889)
angela-tran Feb 14, 2024
5956e1c
Update README.md removed directive from Mermaid chart
indexing Feb 14, 2024
4f0c317
Update README.md removed directive from Mermaid chart (#1891)
thekaveman Feb 14, 2024
f9cc62a
Update low-income.md changed ordered list markdown to all 1s
indexing Feb 15, 2024
a00f70f
fix(docs): clean up front-matter
thekaveman Feb 14, 2024
a254ff6
fix(docs): clean up front-matter (#1893)
thekaveman Feb 15, 2024
1bf16ea
Update low-income.md changed ordered list markdown to all 1s (#1892)
thekaveman Feb 15, 2024
22c7938
docs(roadmap): use an image for now
thekaveman Feb 15, 2024
7c6549a
docs: update roadmap image
thekaveman Feb 15, 2024
09132f8
docs(roadmap): use an image for now (#1894)
thekaveman Feb 15, 2024
aeaa3aa
chore(terraform): remove env vars used in data migration
thekaveman Feb 15, 2024
b71b525
refactor(rest_db): allow more local customization
thekaveman Feb 15, 2024
0a562fb
feat(git): ignore fixtures except the included sample
thekaveman Feb 15, 2024
9cedf8d
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Feb 19, 2024
8c88e8e
chore(deps-dev): bump sentry-sdk from 1.40.4 to 1.40.5
dependabot[bot] Feb 19, 2024
94312c0
docs(deployment): update language around config database
thekaveman Feb 20, 2024
e37ed91
refactor(migrations): update helper script and docs
thekaveman Feb 20, 2024
d6bf990
chore(docs): update references to Django docs
thekaveman Feb 20, 2024
c736ad5
chore(deps-dev): bump cypress from 13.6.4 to 13.6.5 in /tests/cypress
dependabot[bot] Feb 20, 2024
353f53f
chore(deps-dev): bump cypress from 13.6.4 to 13.6.5 in /tests/cypress…
machikoyasuda Feb 21, 2024
d12c885
chore(pre-commit): autoupdate hooks (#1900)
machikoyasuda Feb 21, 2024
28a5f79
chore(deps-dev): bump sentry-sdk from 1.40.4 to 1.40.5 (#1901)
machikoyasuda Feb 21, 2024
0f8ab20
docs: fix typo in Django URL
thekaveman Feb 23, 2024
6d0a87c
Refactor: Django admin always enabled (#1881)
thekaveman Feb 23, 2024
e07665e
fix(terraform): correct Google SSO secret names
thekaveman Feb 23, 2024
2820d68
Fix: correct Google SSO secret names (#1904)
thekaveman Feb 23, 2024
acb0803
chore(deps-dev): bump cypress from 13.6.5 to 13.6.6 in /tests/cypress
dependabot[bot] Feb 23, 2024
cb882c3
chore(deps-dev): bump azure-keyvault-secrets from 4.7.0 to 4.8.0
dependabot[bot] Feb 23, 2024
d198d54
chore(deps-dev): bump cypress from 13.6.5 to 13.6.6 in /tests/cypress…
thekaveman Feb 23, 2024
f6fa110
fix(ci): check for existing preview comment first
thekaveman Feb 23, 2024
0c6e46b
Fix: check for existing preview comment before adding one (#1910)
thekaveman Feb 26, 2024
037ba78
Update README.md added low-income pathway to table within supported e…
indexing Feb 27, 2024
afcb2ab
chore(deps-dev): bump sentry-sdk from 1.40.5 to 1.40.6
dependabot[bot] Feb 27, 2024
1cb08ff
added low-income pathway to table within supported enrollment pathway…
indexing Feb 27, 2024
e47b6cd
fix(env): wrap sample secret in quotes
thekaveman Feb 28, 2024
67bc3f4
fix(reset): correct syntax checking for valid fixtures
thekaveman Feb 28, 2024
4a266d6
Fix: sample env and reset_db helper (#1914)
thekaveman Feb 29, 2024
6bac762
chore(docs): pin key requirements
thekaveman Feb 29, 2024
51d0d69
chore(github): dependabot config for docs requirements
thekaveman Feb 29, 2024
57725c0
fix(docs): fix syntax for pymdownx.emoji
thekaveman Feb 29, 2024
d766e73
Docs: pin key requirements, fix extension syntax (#1923)
thekaveman Mar 1, 2024
4d490ba
chore(deps-dev): bump sentry-sdk from 1.40.5 to 1.40.6 (#1913)
thekaveman Mar 1, 2024
d68239f
chore(deps-dev): bump azure-keyvault-secrets from 4.7.0 to 4.8.0 (#1908)
thekaveman Mar 1, 2024
d7a4dce
chore(deps-dev): bump django-csp from 3.7 to 3.8
dependabot[bot] Mar 1, 2024
7a837ce
chore(deps-dev): bump django-csp from 3.7 to 3.8 (#1925)
thekaveman Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM benefits_client:latest

# install Azure CLI
# https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
USER root
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
USER $USER

# install devcontainer requirements
RUN pip install -e .[dev,test]

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"service": "dev",
"runServices": ["dev", "docs", "server"],
"workspaceFolder": "/home/calitp/app",
"postStartCommand": ["/bin/bash", "bin/init.sh"],
"postStartCommand": ["/bin/bash", "bin/reset_db.sh"],
"postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],
"customizations": {
"vscode": {
Expand Down
25 changes: 25 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
DJANGO_SUPERUSER_USERNAME=benefits-admin
DJANGO_SUPERUSER_EMAIL=benefits-admin@calitp.org
DJANGO_SUPERUSER_PASSWORD=superuser12345!

DJANGO_DB_RESET=true
DJANGO_DB_DIR=.
DJANGO_DB_FILE=django.db
DJANGO_DB_FIXTURES="benefits/core/migrations/local_fixtures.json"

auth_provider_client_id=benefits-oauth-client-id
courtesy_card_verifier_api_auth_key=server-auth-token
mobility_pass_verifier_api_auth_key=server-auth-token
client_private_key='-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA1pt0ZoOuPEVPJJS+5r884zcjZLkZZ2GcPwr79XOLDbOi46on\nCa79kjRnhS0VUK96SwUPS0z9J5mDA5LSNL2RoxFb5QGaevnJY828NupzTNdUd0sY\nJK3kRjKUggHWuB55hwJcH/Dx7I3DNH4NL68UAlK+VjwJkfYPrhq/bl5z8ZiurvBa\n5C1mDxhFpcTZlCfxQoas7D1d+uPACF6mEMbQNd3RaIaSREO50NvNywXIIt/OmCiR\nqI7JtOcn4eyh1I4j9WtlbMhRJLfwPMAgY5epTsWcURmhVofF2wVoFbib3JGCfA7t\nz/gmP5YoEKnf/cumKmF3e9LrZb8zwm7bTHUViwIDAQABAoIBAQCIv0XMjNvZS9DC\nXoXGQtVpcxj6dXfaiDgnc7hZDubsNCr3JtT5NqgdIYdVNQUABNDIPNEiCkzFjuwM\nuuF2+dRzM/x6UCs/cSsCjXYBCCOwMwV/fjpEJQnwMQqwTLulVsXZYYeSUtXVBf/8\n0tVULRty34apLFhsyX30UtboXQdESfpmm5ZsqsZJlYljw+M7JxRMneQclI19y/ya\nhPWlfhLB9OffVEJXGaWx1NSYnKoCMKqE/+4krROr6V62xXaNyX6WtU6XiT7C6R5A\nPBxfhmoeFdVCF6a+Qq0v2fKThYoZnV4sn2q2An9YPfynFYnlgzdfnAFSejsqxQd0\nfxYLOtMBAoGBAP1jxjHDJngZ1N+ymw9MIpRgr3HeuMP5phiSTbY2tu9lPzQd+TMX\nfhr1bQh2Fd/vU0u7X0yPnTWtUrLlCdGnWPpXivx95GNGgUUIk2HStFdrRx+f2Qvk\nG8vtLgmSbjQ26UiHzxi9Wa0a41PWIA3TixkcFrS2X29Qc4yd6pVHmicfAoGBANjR\nZ8aaDkSKLkq5Nk1T7I0E1+mtPoH1tPV/FJClXjJrvfDuYHBeOyUpipZddnZuPGWA\nIW2tFIsMgJQtgpvgs52NFI7pQGJRUPK/fTG+Ycocxo78TkLr/RIj8Kj5brXsbZ9P\n3/WBX5GAISTSp1ab8xVgK/Tm07hGupKVqnY2lCAVAoGAIql0YjhE2ecGtLcU+Qm8\nLTnwpg4GjmBnNTNGSCfB7IuYEsQK489R49Qw3xhwM5rkdRajmbCHm+Eiz+/+4NwY\nkt5I1/NMu7vYUR40MwyEuPSm3Q+bvEGu/71pL8wFIUVlshNJ5CN60fA8qqo+5kVK\n4Ntzy7Kq6WpC9Dhh75vE3ZcCgYEAty99uXtxsJD6+aEwcvcENkUwUztPQ6ggAwci\nje9Z/cmwCj6s9mN3HzfQ4qgGrZsHpk4ycCK655xhilBFOIQJ3YRUKUaDYk4H0YDe\nOsf6gTP8wtQDH2GZSNlavLk5w7UFDYQD2b47y4fw+NaOEYvjPl0p5lmb6ebAPZb8\nFbKZRd0CgYBC1HTbA+zMEqDdY4MWJJLC6jZsjdxOGhzjrCtWcIWEGMDF7oDDEoix\nW3j2hwm4C6vaNkH9XX1dr5+q6gq8vJQdbYoExl22BGMiNbfI3+sLRk0zBYL//W6c\ntSREgR4EjosqQfbkceLJ2JT1wuNjInI0eR9H3cRugvlDTeWtbdJ5qA==\n-----END RSA PRIVATE KEY-----'
client_public_key='-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1pt0ZoOuPEVPJJS+5r88\n4zcjZLkZZ2GcPwr79XOLDbOi46onCa79kjRnhS0VUK96SwUPS0z9J5mDA5LSNL2R\noxFb5QGaevnJY828NupzTNdUd0sYJK3kRjKUggHWuB55hwJcH/Dx7I3DNH4NL68U\nAlK+VjwJkfYPrhq/bl5z8ZiurvBa5C1mDxhFpcTZlCfxQoas7D1d+uPACF6mEMbQ\nNd3RaIaSREO50NvNywXIIt/OmCiRqI7JtOcn4eyh1I4j9WtlbMhRJLfwPMAgY5ep\nTsWcURmhVofF2wVoFbib3JGCfA7tz/gmP5YoEKnf/cumKmF3e9LrZb8zwm7bTHUV\niwIDAQAB\n-----END PUBLIC KEY-----'
mst_payment_processor_client_cert='-----BEGIN CERTIFICATE-----\nPEM DATA\n-----END CERTIFICATE-----'
mst_payment_processor_client_cert_private_key='-----BEGIN RSA PRIVATE KEY-----\nPEM DATA\n-----END RSA PRIVATE KEY-----'
mst_payment_processor_client_cert_root_ca='-----BEGIN CERTIFICATE-----\nPEM DATA\n-----END CERTIFICATE-----'
sacrt_payment_processor_client_cert='-----BEGIN CERTIFICATE-----\nPEM DATA\n-----END CERTIFICATE-----'
sacrt_payment_processor_client_cert_private_key='-----BEGIN RSA PRIVATE KEY-----\nPEM DATA\n-----END RSA PRIVATE KEY-----'
sacrt_payment_processor_client_cert_root_ca='-----BEGIN CERTIFICATE-----\nPEM DATA\n-----END CERTIFICATE-----'
sbmtd_payment_processor_client_cert='-----BEGIN CERTIFICATE-----\nPEM DATA\n-----END CERTIFICATE-----'
sbmtd_payment_processor_client_cert_private_key='-----BEGIN RSA PRIVATE KEY-----\nPEM DATA\n-----END RSA PRIVATE KEY-----'
sbmtd_payment_processor_client_cert_root_ca='-----BEGIN CERTIFICATE-----\nPEM DATA\n-----END CERTIFICATE-----'

testsecret="Hello from the local environment!"
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ updates:
include: "scope"
labels:
- "dependencies"
- package-ecosystem: "pip"
directory: "/docs" # requirements.txt
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "dependencies"
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
Expand Down
74 changes: 16 additions & 58 deletions .github/workflows/check-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,39 @@ name: Check access to API

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select the API environment
options: [all, prod, qa]
schedule:
- cron: "0 12 * * *"

jobs:
check-api:
runs-on: ubuntu-latest
env:
SHOULD_RUN: |
${{ github.event_name == 'schedule'
|| github.event.inputs.environment == 'all'
|| github.event.inputs.environment == matrix.name
}}
strategy:
fail-fast: false
matrix:
include:
- name: prod
cert: API_CHECK_PROD_CERT
key: API_CHECK_PROD_KEY
ca-cert: API_CHECK_PROD_CA_CERT
url: API_CHECK_PROD_URL
data: API_CHECK_PROD_DATA

- name: qa
cert: API_CHECK_QA_CERT
key: API_CHECK_QA_KEY
ca-cert: API_CHECK_QA_CA_CERT
url: API_CHECK_QA_URL
data: API_CHECK_QA_DATA

name: Check API endpoint (${{ matrix.name }})
participant: [mst, sacrt, sbmtd]
env: [qa, prod]
steps:
- name: Echo workflow run information
run: |
echo "Triggering event name: ${{ github.event_name }}, \
APIs to check: ${{ github.event.inputs.environment }}"
- uses: actions/checkout@v4
with:
repository: "cal-itp/littlepay"

- name: Decode cert files
if: contains(env.SHOULD_RUN, 'true')
- name: Install the littlepay library
run: |
mkdir $RUNNER_TEMP/${{ matrix.name }}
temp_dir=$RUNNER_TEMP/${{ matrix.name }}

cat > $temp_dir/cert.pem <<- EOM
${{ secrets[matrix.cert] }}
EOM

cat > $temp_dir/key.pem <<- EOM
${{ secrets[matrix.key] }}
EOM
python3 -m pip install --upgrade pip
pip install -e .

cat > $temp_dir/cacert.ca <<- EOM
${{ secrets[matrix.ca-cert] }}
- name: Create config file and set config
run: |
cat > config.yaml <<- EOM
${{ secrets.API_CHECK_CONFIG }}
EOM
littlepay config config.yaml

- name: Call API endpoint
if: contains(env.SHOULD_RUN, 'true')
- name: Run littlepay to get access token
run: |
temp_dir=$RUNNER_TEMP/${{ matrix.name }}
curl -i --url ${{ secrets[matrix.url] }} \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--data '${{ secrets[matrix.data] }}' \
--cert $temp_dir/cert.pem \
--key $temp_dir/key.pem \
--cacert $temp_dir/cacert.ca > $temp_dir/payload.txt

test $(head -n 1 $temp_dir/payload.txt | grep -o 201)
littlepay switch env ${{ matrix.env }}
littlepay switch participant ${{ matrix.participant }}

# https://www.ravsam.in/blog/send-slack-notification-when-github-actions-fails/#using-notify-slack-action
- name: Report failure to Slack
if: always()
uses: ravsamhq/notify-slack-action@v2
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,17 @@ jobs:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_PREVIEW_APP_SITE_ID }}

- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.number }}
comment-author: "github-actions[bot]"
body-includes: "Preview url: https://"

- name: Add Netlify link PR comment
uses: actions/github-script@v7
if: steps.find-comment.outputs.comment-id == ''
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests-cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:

- name: Start app
run: |
touch .env
docker compose up --detach client server
cp .env.sample .env
docker compose up --detach server
docker compose run --detach --service-ports client bin/test_start.sh

- name: Run Cypress tests
uses: cypress-io/github-action@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:

- name: Start app
run: |
touch .env
cp .env.sample .env
docker compose up --detach client

- name: Run Lighthouse tests for a11y
uses: treosh/lighthouse-ci-action@10.1.0
uses: treosh/lighthouse-ci-action@11.4.0
with:
urls: |
http://localhost:8000
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.db
*.env
*fixtures.json
!benefits/core/migrations/local_fixtures.json
*.mo
*.tfbackend
*.tmp
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
args: ["--maxkb=1500"]

- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.2.0
hooks:
- id: black
types:
Expand Down
53 changes: 39 additions & 14 deletions benefits/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,47 @@
The core application: Admin interface configuration.
"""

import logging
import requests

from django.conf import settings
from django.contrib import admin
from . import models

logger = logging.getLogger(__name__)


GOOGLE_USER_INFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo"


for model in [
models.EligibilityType,
models.EligibilityVerifier,
models.PaymentProcessor,
models.PemData,
models.TransitAgency,
]:
logger.debug(f"Register {model.__name__}")
admin.site.register(model)


if settings.ADMIN:
import logging
from django.contrib import admin
from . import models
def pre_login_user(user, request):
logger.debug(f"Running pre-login callback for user: {user.username}")
token = request.session.get("google_sso_access_token")
if token:
headers = {
"Authorization": f"Bearer {token}",
}

logger = logging.getLogger(__name__)
# Request Google user info to get name and email
response = requests.get(GOOGLE_USER_INFO_URL, headers=headers, timeout=settings.REQUESTS_TIMEOUT)
user_data = response.json()
logger.debug(f"Updating user data from Google for user with email: {user_data['email']}")

for model in [
models.EligibilityType,
models.EligibilityVerifier,
models.PaymentProcessor,
models.PemData,
models.TransitAgency,
]:
logger.debug(f"Register {model.__name__}")
admin.site.register(model)
user.first_name = user_data["given_name"]
user.last_name = user_data["family_name"]
user.username = user_data["email"]
user.email = user_data["email"]
user.save()
else:
logger.warning("google_sso_access_token not found in session.")
26 changes: 21 additions & 5 deletions benefits/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Generated by Django 4.2.4 on 2023-08-16 15:06
# Generated by Django 5.0.1 on 2024-02-06 18:09

from django.db import migrations, models
import benefits.core.models
import benefits.secrets
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand All @@ -17,7 +20,10 @@ class Migration(migrations.Migration):
("sign_out_button_template", models.TextField(null=True)),
("sign_out_link_template", models.TextField(null=True)),
("client_name", models.TextField()),
("client_id", models.TextField()),
(
"client_id_secret_name",
benefits.core.models.SecretNameField(max_length=127, validators=[benefits.secrets.SecretNameValidator()]),
),
("authority", models.TextField()),
("scope", models.TextField(null=True)),
("claim", models.TextField(null=True)),
Expand All @@ -41,7 +47,12 @@ class Migration(migrations.Migration):
("active", models.BooleanField(default=False)),
("api_url", models.TextField(null=True)),
("api_auth_header", models.TextField(null=True)),
("api_auth_key", models.TextField(null=True)),
(
"api_auth_key_secret_name",
benefits.core.models.SecretNameField(
max_length=127, null=True, validators=[benefits.secrets.SecretNameValidator()]
),
),
("jwe_cek_enc", models.TextField(null=True)),
("jwe_encryption_alg", models.TextField(null=True)),
("jws_signing_alg", models.TextField(null=True)),
Expand Down Expand Up @@ -80,8 +91,13 @@ class Migration(migrations.Migration):
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("label", models.TextField()),
("text", models.TextField(null=True)),
("remote_url", models.TextField(null=True)),
(
"text_secret_name",
benefits.core.models.SecretNameField(
max_length=127, null=True, validators=[benefits.secrets.SecretNameValidator()]
),
),
],
),
migrations.CreateModel(
Expand Down