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

Security features v2.6.2 #1731

Closed
wants to merge 188 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
91a5791
fix DatabaseResourceArn SSM param (#1398)
petrkalos Jul 22, 2024
2deee63
fix delete_env parameter (#1397)
petrkalos Jul 22, 2024
e67bbde
Fix deprecated mui tree view (#1427)
noah-paige Jul 23, 2024
6ef41a4
Add init for resource lock (#1426)
noah-paige Jul 23, 2024
1cec5fe
Database tables and enums for metadata forms (#1422)
SofiaSazonova Jul 23, 2024
3273bcb
Dependencies: Upgrade `fast-xml-parser` to 4.4.1 (#1441)
dlpzx Jul 30, 2024
9356074
Fix: Typo, missing @staticmethod in ResourcePolicyRepository method (…
dlpzx Jul 30, 2024
6f19119
Utils for enum-queries (#1435)
SofiaSazonova Jul 30, 2024
8eb1bd0
Feat: API call to query Enum values - continuation - semgrep fix (#1445)
SofiaSazonova Jul 31, 2024
276dceb
Add Redshift datasets module (#1424)
dlpzx Aug 1, 2024
59d0650
Fix for getting correct gluedb name for central cataloged dataset (#1…
TejasRGitHub Aug 1, 2024
586864c
pass ShareableType instead of it's value and log exception details (#…
petrkalos Aug 5, 2024
2277dbb
Redshift dataset module testing: Re-added client factories, mocking c…
dlpzx Aug 5, 2024
fec4ecc
Redshift data sharing - Cluster encryption guardrails and information…
dlpzx Aug 6, 2024
5dd10c9
Redshift data sharing - frontend changes in the Catalog - clean (#1458)
dlpzx Aug 6, 2024
f69af72
Issue1456: Fix for persistent email reminders (#1457)
anushka-singh Aug 6, 2024
997177f
Redshift data sharing - Redshift connection types and namespace Id (#…
dlpzx Aug 7, 2024
3ed9536
Redshift data sharing - Boilerplate for redshift dataset sharing modu…
dlpzx Aug 7, 2024
a19ecee
hide access point consumer details if access points feature is disabl…
zsaltys Aug 7, 2024
0ff5c3f
Redshift data sharing - Make ShareObject.IAMRole a generic "Role" (#1…
dlpzx Aug 8, 2024
7ca67b8
Metadata forms-2: Create, display list, search list (#1444)
SofiaSazonova Aug 8, 2024
773ebd8
Fix: Remove enums from i-tests for MFs (#1473)
SofiaSazonova Aug 8, 2024
3abeeeb
move backend approval_tests as the last step within the backend stage…
petrkalos Aug 8, 2024
13c900f
Fix local share processors registered (#1470)
noah-paige Aug 8, 2024
332a56b
Issue1468: Submit request redirect (#1469)
anushka-singh Aug 8, 2024
49a0a16
update checkov baseline for cdk synth output (#1450)
noah-paige Aug 9, 2024
d769afc
Metadata forms 3: Metadata Form View page. Add, Edit fields (#1455)
SofiaSazonova Aug 12, 2024
d85f0c4
Row/Column Level Data Filters (#1438)
noah-paige Aug 13, 2024
3269cb7
Fix history of alembic migration scripts data filters vs metadata for…
dlpzx Aug 13, 2024
b640e88
Redshift data sharing - Polish frontend views for Redshit shares (#1477)
dlpzx Aug 13, 2024
1abb470
Bugfix: Parsing error in Admin settings tab (#1482)
SofiaSazonova Aug 14, 2024
7774aad
Redshift data sharing - Add sharing tasks to process Redshift datasha…
dlpzx Aug 14, 2024
20f79ba
Upgrade axios version (#1483)
noah-paige Aug 14, 2024
3c4ce7c
Run reapply automatically if Share Verifier Task detects Unhealthy Sh…
noah-paige Aug 14, 2024
fa569dd
Save data filter perms before backfilling (#1485)
noah-paige Aug 15, 2024
050bc60
Updated glue crawler security config (#1434)
mourya-33 Aug 15, 2024
fe6c895
Metadata forms 4: Access Control (#1474)
SofiaSazonova Aug 16, 2024
e6fe0f3
fix table share revoke with no filters (#1493)
noah-paige Aug 21, 2024
c4290db
allow dbmigrations lambda to invoke any alembic command (#1488)
petrkalos Aug 21, 2024
24fca5f
Metadata forms 5: UI improvement + possible values validation (#1480)
SofiaSazonova Aug 21, 2024
c677f8e
Import Datasets: Validate that bucket is unique (#1498)
SofiaSazonova Aug 26, 2024
286efbf
check bucket encryption type: key|alias (#1499)
SofiaSazonova Aug 26, 2024
e76a713
Modifying Regex for fixing redirection not working when visitin s3-da…
TejasRGitHub Aug 27, 2024
757984c
Make log query period configurable (#1503)
SofiaSazonova Aug 29, 2024
ae445d8
Validate imported resource names via NamingConventionService (#1501)
SofiaSazonova Aug 29, 2024
97717f6
S3Bucket WRITE/MODIFY permissions (#1472)
petrkalos Sep 2, 2024
0e1dc90
Allow origins conf changes (#1486)
mourya-33 Sep 3, 2024
eb89983
fix importing sse encrypted buckets (#1514)
petrkalos Sep 3, 2024
76a7a3e
feat(GH-1083) share expiration (#1489)
TejasRGitHub Sep 3, 2024
19cb45f
Redshift data sharing - Add interface for share validations and Redsh…
dlpzx Sep 3, 2024
c7e73d8
Bump flask-cors from 4.0.1 to 5.0.0 in /backend (#1515)
dependabot[bot] Sep 3, 2024
d1cfd18
Bump webpack to 5.94.0 (#1517)
noah-paige Sep 4, 2024
c9af1ee
Bump micromatch from 4.0.7 to 4.0.8 in /frontend (#1518)
dependabot[bot] Sep 4, 2024
ae16cc8
Update baseline removing checkov exception for glue security config (…
noah-paige Sep 4, 2024
9840995
Redshift data sharing - Added methods from sharing back to redshift d…
dlpzx Sep 4, 2024
adf395f
add docs on how to create table filters and assign to shares (#1506)
noah-paige Sep 4, 2024
d66d5a7
Metadata forms 6: attach MF to Orgs, Envs and Datasets (#1495)
SofiaSazonova Sep 9, 2024
fd3dc9d
Redshift data sharing - Documentation 1 - Redshift Connections and Da…
dlpzx Sep 10, 2024
02ccb28
Redshift data sharing - Documentation 2 - Redshift Sharing (#1519)
dlpzx Sep 10, 2024
1804aab
Upgrade `path-to-regexp` to 0.1.10 (#1525)
dlpzx Sep 10, 2024
cf3b457
Add External Id Conditions to Deployment Roles (#1521)
noah-paige Sep 10, 2024
9b8197c
Add bucket versioning (#1522)
noah-paige Sep 10, 2024
7af8b11
Upgrade body parser dependency (#1530)
noah-paige Sep 11, 2024
73c6b7b
Increase CodeBuild timeout for integration tests (#1532)
dlpzx Sep 11, 2024
565c9ce
Add bucket versioning pt 2 (#1529)
noah-paige Sep 11, 2024
5f7db6c
Upgrade send to 0.19.0 and express to 4.20.0 (#1542)
dlpzx Sep 12, 2024
5b9f689
Config log retention (#1527)
noah-paige Sep 12, 2024
f91aebc
Add check to skip processor initialization if there are not shareable…
dlpzx Sep 13, 2024
97d1827
Updating logic to check if expiration is changed on the UI (#1545)
TejasRGitHub Sep 13, 2024
405019d
Add Dataset integration tests - Tables, Folders (#1391)
noah-paige Sep 13, 2024
3d4d648
add mlstudio integ tests (#1535)
petrkalos Sep 13, 2024
75971b8
Allow configurable Region to run CDK IaC checks (#1531)
noah-paige Sep 16, 2024
7eb8335
Feat/integration tests dataset filters (#1539)
noah-paige Sep 16, 2024
cc6ac15
Increase access point creation buffer time and fix bug in share cross…
SofiaSazonova Sep 17, 2024
f683ecd
Add Dataset integration tests - Dataset missing tests, Table Profilin…
dlpzx Sep 18, 2024
1570ed3
Add Permissions integration tests (#1550)
dlpzx Sep 18, 2024
47697ca
Add Stacks and KeyValueTags integration tests (#1551)
dlpzx Sep 19, 2024
2749ce5
Add VPC network integration tests + fix tags bug in networks (#1555)
dlpzx Sep 20, 2024
d5226c5
Add Glossaries integration tests (#1556)
dlpzx Sep 20, 2024
95e278c
Add Redshift connection tooltips and info + restrict to DATA_USER con…
dlpzx Sep 23, 2024
93bd073
fix setting maintenance modes enum (#1567)
noah-paige Sep 23, 2024
dcc3849
Feat/integration tests dashboards (#1560)
noah-paige Sep 23, 2024
b9915ef
Upgrade rollup to non-vulnerable version 2.79.1 -> 3.29.5 (#1571)
dlpzx Sep 24, 2024
59f0b26
Add Dataset integration tests - Table Columns (#1548)
dlpzx Sep 24, 2024
075b43c
[Gh-1528] Configurable stack logs display (#1559)
TejasRGitHub Sep 25, 2024
2005863
Add Dataset integration tests - S3 Share requests (#1389)
SofiaSazonova Sep 25, 2024
6500916
[Gh 1570] feature flag for table metrics (#1574)
TejasRGitHub Sep 25, 2024
ab7e2a9
migrate local server to FastAPI (#1577)
petrkalos Sep 26, 2024
c903d99
don't import dataall from integtest (#1581)
petrkalos Sep 26, 2024
a535c9c
increase codebuild timeout for integration tests (#1584)
petrkalos Sep 26, 2024
0b1295a
Fialed test fix: rename fixture session_cross_acc_env_1 (#1586)
SofiaSazonova Sep 27, 2024
4b67986
Fix wrong environment in the verification of redshift role (#1587)
dlpzx Sep 27, 2024
1e2c388
Metadata form 7: Access control and deletion behaviour (#1540)
SofiaSazonova Sep 30, 2024
a3c7bb8
Integration Test CICD: iam role bugfix (#1589)
SofiaSazonova Oct 1, 2024
698d5ec
Enable hyperlinks in dataset description (#1591)
rbernotas Oct 1, 2024
c5a88c7
Bandit fix: explicitly install typing-extensions (#1600)
SofiaSazonova Oct 1, 2024
07b2219
Add schema in database routines in metadata forms migration script (#…
dlpzx Oct 1, 2024
9204f0a
Fixes to integration tests (#1602)
noah-paige Oct 1, 2024
cb909e9
Add integration tests feed (#1579)
noah-paige Oct 1, 2024
0931949
add integration tests votes (#1578)
noah-paige Oct 1, 2024
0e176d2
retry for LF grant_permissions (#1585)
SofiaSazonova Oct 2, 2024
aa2a4f1
MF7 bugfix (#1595)
SofiaSazonova Oct 2, 2024
d125400
Fix share expiration date calculation for end-of-month days (#1594)
dlpzx Oct 2, 2024
34d5651
New permission model for Redshift ADMIN connections (#1573)
dlpzx Oct 2, 2024
b177279
warn users when evaluating a non-readonly share request (#1568)
petrkalos Oct 2, 2024
87a6e7b
CICD Integration tests: s3 dataset shares, persistent shares (#1580)
SofiaSazonova Oct 2, 2024
4fd6caa
CICD Integration test: table test fix (#1605)
SofiaSazonova Oct 2, 2024
c5f3f9e
CICD Integration test: iam client fix (#1604)
SofiaSazonova Oct 2, 2024
8f4c306
Extend id token duration if tests included as part of pipeline (#1606)
noah-paige Oct 4, 2024
0619036
Pipeline Module Updates (#1616)
noah-paige Oct 8, 2024
4957f5b
Clean up S3 Buckets in integration test (#1603)
dlpzx Oct 8, 2024
3f97f9a
Integration tests - refresh tokens of AWS Clients (#1607)
dlpzx Oct 8, 2024
25c4202
try to create AP every time, catch if already exists (#1609)
SofiaSazonova Oct 8, 2024
6f37f94
CICD: S3 dataset bug, position arguments vs arguments by name (#1612)
SofiaSazonova Oct 8, 2024
e76369d
Fix - clean up buckets integration test - PR overwrite (#1622)
dlpzx Oct 9, 2024
3f9a977
CICD: assume consumption role from environment client (#1624)
SofiaSazonova Oct 9, 2024
abbb10a
CICD: share tests fixes (#1625)
SofiaSazonova Oct 10, 2024
1a0c4b5
Dashboard Integration Test Improvements (#1623)
noah-paige Oct 10, 2024
9863ff0
set typeguard version 4.2.1 (#1634)
noah-paige Oct 11, 2024
0eed4cd
Restrict invitation to Redshift Connections and edit permission name …
dlpzx Oct 14, 2024
25dd41a
Metadata form versioning - 1 (#1637)
SofiaSazonova Oct 14, 2024
8dfd9ba
Integration tests executed on a real deployment as part of the CICD -…
dlpzx Oct 15, 2024
53181b9
User modal dialog - team link (#1627)
rbernotas Oct 16, 2024
85dbfdc
Integration tests executed on a real deployment as part of the CICD -…
dlpzx Oct 16, 2024
18d375b
Metadata versioning 2 (#1641)
SofiaSazonova Oct 16, 2024
5a5953c
Changes to the logic of calculating expiration date (#1635)
TejasRGitHub Oct 17, 2024
1813022
Metadata form Userguide (#1596)
SofiaSazonova Oct 18, 2024
e7c8403
Fix error message of Redshift share verifier (#1647)
dlpzx Oct 18, 2024
378cd02
Fix: check if Redshift table exists before publishing it to data.all …
dlpzx Oct 21, 2024
3747c9d
Integration tests executed on a real deployment as part of the CICD -…
dlpzx Oct 22, 2024
6cf2389
Upgrade `http-proxy-middleware` 2.0.7 (#1656)
dlpzx Oct 24, 2024
a4ba6cb
Add forceDelete to shareObjects to clean-up all shareItems (#1646)
dlpzx Oct 24, 2024
a84d529
Fix: integration tests missing default value for principalRoleName an…
dlpzx Oct 25, 2024
39891fe
fix: missing CREATE_SHARE_OBJECT permission in integration tests (#1663)
dlpzx Oct 25, 2024
8fff964
Fix: Remove optional AllowWrites - not supported in all regions (#1664)
dlpzx Oct 25, 2024
4f423d3
Fix: Remove optional AllowWrites 2 - not supported in all regions (…
dlpzx Oct 28, 2024
fc2e97e
Userguide signout flow (#1629)
noah-paige Oct 28, 2024
472060a
Metadata form versioning - 3 (#1648)
SofiaSazonova Oct 28, 2024
e1f5706
Added error view and unified utility to check tenant user (#1657)
dlpzx Oct 28, 2024
d57a584
Add permission checks to markNotificationAsRead + deleteNotification …
noah-paige Oct 28, 2024
21ff8dc
log API handler response only for LOG_LEVEL DEBUG. Set log level INFO…
dlpzx Oct 28, 2024
bd39b45
Add Removal Policy Retain to Bucket Policy IaC (#1660)
noah-paige Oct 28, 2024
8e947d9
Limit Response info dataset queries (#1665)
noah-paige Oct 28, 2024
7fbe26e
Extend Tenant Perms Coverage (#1630)
noah-paige Oct 28, 2024
92b591f
ES Search Query Collect All Response (#1631)
noah-paige Oct 29, 2024
071a025
Bump werkzeug from 3.0.3 to 3.0.6 in /backend/dataall/base/cdkproxy (…
dependabot[bot] Oct 30, 2024
0949893
Bump werkzeug 3.0.0 to 3.0.6 in tests and integration tests (#1672)
dlpzx Oct 30, 2024
4457130
test unhealthy shares (#1649)
petrkalos Oct 30, 2024
0bf17f6
assert successful updates based on stack's last log timestamp (#1676)
petrkalos Oct 31, 2024
0d89899
add salt to FrontendCognitoConfig to make it always run (#1674)
petrkalos Oct 31, 2024
a0c63a4
Upgrade Spark version to 3.3 (#1675)
noah-paige Oct 31, 2024
223b0f5
Lambda Event Logs Handling (#1678)
noah-paige Nov 1, 2024
f66bac0
add custom domain support for apigw (#1679)
petrkalos Nov 5, 2024
b091eee
add warning to untrust data.all account when removing an environment …
petrkalos Nov 6, 2024
dd8e6a9
Restrict pivotRole permissions with DENY statement (#1681)
dlpzx Nov 7, 2024
5069bf8
Added Token Validations (#1682)
noah-paige Nov 7, 2024
a9471a3
get-parameter CloudfrontDistributionDomainName from us-east-1 (#1687)
petrkalos Nov 8, 2024
7213603
Tests/extend token validity (#1669)
noah-paige Nov 11, 2024
0d73611
Updating overly permissive policies tagged by checkov for environment…
mourya-33 Nov 12, 2024
bab4a03
Update sanitization technique (#1692)
noah-paige Nov 12, 2024
0bd26d8
Fix/input validation (#1693)
noah-paige Nov 13, 2024
d9f90df
Move worksheet logic to service layer (#1696)
dlpzx Nov 14, 2024
b30a354
Separating Out Access Logging (#1695)
noah-paige Nov 14, 2024
1f625f2
return EnvironmentLogsBucketName from integraiton test getEnv query (…
noah-paige Nov 15, 2024
f3785be
add explicit token duration config for both JWTs (#1698)
noah-paige Nov 15, 2024
8253b9d
update fastapi dependency (#1699)
noah-paige Nov 15, 2024
941fe1f
Upgrade "cross-spawn" to "7.0.5" (#1701)
dlpzx Nov 18, 2024
64da618
Add MANAGE_SHARES permissions (#1702)
dlpzx Nov 19, 2024
f5ddf36
Disable introspection on prod sizing (#1704)
noah-paige Nov 20, 2024
9bcea9e
Add snyk workflow on schedule (#1705)
noah-paige Nov 20, 2024
882dfca
Bump python runtime to bump cdk klayers cryptography version (#1707)
noah-paige Nov 20, 2024
5c0b208
tenant-permission tests (#1694)
dlpzx Nov 20, 2024
10f278c
Fix Snyk Workflow to Find Project Deps (#1708)
noah-paige Nov 21, 2024
0215cc0
Added permission check - is tenant to update SSM parameters API (#1714)
dlpzx Nov 25, 2024
ea5e943
Add GET_SHARE_OBJECT permissions to get data filters API (#1717)
dlpzx Nov 25, 2024
c52a620
Add permissions on list datasets for env group + cosmetic S3 Datasets…
dlpzx Nov 25, 2024
05bc85a
Add GET_WORKSHEET permission in RUN_SQL_QUERY (#1716)
dlpzx Nov 25, 2024
d76d55c
Unify Logger Config for Tasks (#1709)
noah-paige Nov 26, 2024
b5f1131
Change Snyk Actions (#1713)
noah-paige Nov 26, 2024
d23b690
Fix integration tests for list_environment_datasets unauthorized case…
dlpzx Nov 26, 2024
338c6ee
Added permissions to Quicksight monitoring service layer (#1715)
dlpzx Nov 26, 2024
553037e
make dashboards optional based on config (#1677)
petrkalos Nov 27, 2024
90dd1e3
Add LIST_ENVIRONMENT_DATASETS permission for listing shared datasets …
dlpzx Nov 28, 2024
a79fb35
Add omics create_run unauthorized test and improve other tests (#1723)
dlpzx Nov 28, 2024
08f24f2
Introduce is_owner permissions to Glossary mutations + add new integr…
dlpzx Nov 29, 2024
32d02ad
Refactor env permissions + modify getTrustAccount (#1712)
dlpzx Dec 3, 2024
688bd0b
Avoid infinite loop in glossaries checks (#1725)
dlpzx Dec 3, 2024
5438bdb
Feed consistent permissions (#1722)
dlpzx Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
546 changes: 542 additions & 4 deletions .checkov.baseline

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install typing-extensions
python -m pip install bandit
- name: Bandit
run: bandit -r -lll -ii .
49 changes: 44 additions & 5 deletions .github/workflows/checkov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,56 @@ permissions:

jobs:
build:

env:
CDK_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
CDK_DEFAULT_ACCOUNT: 111111111111
GITHUB_ACTIONS: true
CHECKOV_ACTIONS: true
DATAALL_REPO_BRANCH: main
strategy:
matrix:
python-version: [3.9]
services:
postgres:
image: postgres
env:
POSTGRES_DB: dataall
POSTGRES_PASSWORD: docker
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
- name: Git clone
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
- name: Install CDK
run: |
npm install -g aws-cdk cdk-nag
cdk --version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Upgrade Pip
run: python -m pip install --upgrade pip
- name: Install Requirements
run: python -m pip install -r deploy/requirements.txt
- name: CDK Synth
run: |
npx cdk synth
- name: Resources CDK Synth
run: make checkov-synth
- name: Test with Checkov
id: checkov
uses: bridgecrewio/checkov-action@master
uses: bridgecrewio/checkov-action@v12.2845.0
with:
directory: .
quiet: true
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/snyk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Snyk

on:
workflow_dispatch:

schedule:
- cron: "0 9 * * 1" # runs each Monday at 9:00 UTC

permissions:
contents: read
security-events: write

jobs:
security:
strategy:
matrix:
python-version: [3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install All Requirements
run: make install
- name: Run Snyk to check for vulnerabilities
run: snyk test --all-projects --detection-depth=5 --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --all-projects --detection-depth=5 --severity-threshold=high
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ yarn-debug.log*
yarn-error.log*
.idea
/.ruff_cache/
/testdata.json
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ venv:
@python3 -m venv "venv"
@/bin/bash -c "source venv/bin/activate"

install: upgrade-pip install-deploy install-backend install-cdkproxy install-tests
install: upgrade-pip install-deploy install-backend install-cdkproxy install-tests install-integration-tests install-custom-auth install-userguide

upgrade-pip:
pip install --upgrade pip setuptools
Expand All @@ -36,6 +36,12 @@ install-tests:
install-integration-tests:
pip install -r tests_new/integration_tests/requirements.txt

install-custom-auth:
pip install -r deploy/custom_resources/custom_authorizer/requirements.txt

install-userguide:
pip install -r documentation/userguide/requirements.txt

lint:
pip install ruff
ruff check --fix
Expand All @@ -51,6 +57,10 @@ check-security: upgrade-pip install-backend install-cdkproxy
bandit -lll -r backend
safety check --ignore=51668,70612,70624

checkov-synth: upgrade-pip install-backend install-cdkproxy install-tests
export PYTHONPATH=./backend:/./tests && \
python -m pytest -v -ra -k test_checkov tests

test:
export PYTHONPATH=./backend:/./tests && \
python -m pytest -v -ra tests/
Expand Down Expand Up @@ -78,7 +88,7 @@ deploy-image:
docker push ${account}.dkr.ecr.${region}.amazonaws.com/${repo}:${image-tag}

assume-role:
aws sts assume-role --role-arn "arn:aws:iam::${REMOTE_ACCOUNT_ID}:role/${REMOTE_ROLE}" --role-session-name "session1" >.assume_role_json
aws sts assume-role --role-arn "arn:aws:iam::${REMOTE_ACCOUNT_ID}:role/${REMOTE_ROLE}" --external-id ${EXTERNAL_ID} --role-session-name "session1" >.assume_role_json
echo "export AWS_ACCESS_KEY_ID=$$(cat .assume_role_json | jq '.Credentials.AccessKeyId' -r)" >.env.assumed_role
echo "export AWS_SECRET_ACCESS_KEY=$$(cat .assume_role_json | jq '.Credentials.SecretAccessKey' -r)" >>.env.assumed_role
echo "export AWS_SESSION_TOKEN=$$(cat .assume_role_json | jq '.Credentials.SessionToken' -r)" >>.env.assumed_role
Expand Down
Binary file modified UserGuide.pdf
Binary file not shown.
21 changes: 16 additions & 5 deletions backend/api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
attach_tenant_policy_for_groups,
check_reauth,
validate_and_block_if_maintenance_window,
redact_creds,
)
from dataall.core.tasks.service_handlers import Worker
from dataall.base.aws.sqs import SqsQueue
from dataall.base.context import set_context, dispose_context, RequestContext
from dataall.base.db import get_engine
from dataall.base.loader import load_modules, ImportMode

from graphql.pyutils import did_you_mean

logger = logging.getLogger()
logger.setLevel(os.environ.get('LOG_LEVEL', 'INFO'))
Expand All @@ -31,11 +33,17 @@
for name in ['boto3', 's3transfer', 'botocore', 'boto']:
logging.getLogger(name).setLevel(logging.ERROR)

ALLOW_INTROSPECTION = True if os.getenv('ALLOW_INTROSPECTION') == 'True' else False

if not ALLOW_INTROSPECTION:
did_you_mean.__globals__['MAX_LENGTH'] = 0

load_modules(modes={ImportMode.API})
SCHEMA = bootstrap_schema()
TYPE_DEFS = gql(SCHEMA.gql(with_directives=False))
ENVNAME = os.getenv('envname', 'local')
ENGINE = get_engine(envname=ENVNAME)
ALLOWED_ORIGINS = os.getenv('ALLOWED_ORIGINS', '*')
Worker.queue = SqsQueue.send


Expand Down Expand Up @@ -83,6 +91,7 @@ def handler(event, context):
Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
"""

event = redact_creds(event)
log.info('Lambda Event %s', event)
log.debug('Env name %s', ENVNAME)
log.debug('Engine %s', ENGINE.engine.url)
Expand All @@ -92,7 +101,7 @@ def handler(event, context):
'statusCode': 200,
'headers': {
'content-type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Origin': ALLOWED_ORIGINS,
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': '*',
},
Expand Down Expand Up @@ -135,18 +144,20 @@ def handler(event, context):
else:
raise Exception(f'Could not initialize user context from event {event}')

success, response = graphql_sync(schema=executable_schema, data=query, context_value=app_context)
success, response = graphql_sync(
schema=executable_schema, data=query, context_value=app_context, introspection=ALLOW_INTROSPECTION
)

dispose_context()
response = json.dumps(response)

log.info('Lambda Response %s', response)

log.info('Lambda Response Success: %s', success)
log.debug('Lambda Response %s', response)
return {
'statusCode': 200 if success else 400,
'headers': {
'content-type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Origin': ALLOWED_ORIGINS,
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': '*',
},
Expand Down
2 changes: 1 addition & 1 deletion backend/aws_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dataall.base.loader import load_modules, ImportMode

logger = logging.getLogger()
logger.setLevel(os.environ.get('LOG_LEVEL'))
logger.setLevel(os.environ.get('LOG_LEVEL', 'INFO'))
log = logging.getLogger(__name__)

ENVNAME = os.getenv('envname', 'local')
Expand Down
11 changes: 11 additions & 0 deletions backend/dataall/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
from . import core, version
from .base import utils, db, api
import logging
import os
import sys

logging.basicConfig(
level=os.environ.get('LOG_LEVEL', 'INFO'),
handlers=[logging.StreamHandler(sys.stdout)],
format='[%(levelname)s] %(message)s',
)
for name in ['boto3', 's3transfer', 'botocore', 'boto', 'urllib3']:
logging.getLogger(name).setLevel(logging.ERROR)
1 change: 1 addition & 0 deletions backend/dataall/base/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from dataall.base.api import gql
from dataall.base.api.constants import GraphQLEnumMapper
from dataall.base.api.queries import enumsQuery


def bootstrap():
Expand Down
8 changes: 8 additions & 0 deletions backend/dataall/base/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def to_label(cls, value):
return c.name
return None

@classmethod
def has_value(cls, value):
return value in cls._value2member_map_

@classmethod
def has_key(cls, key):
return key in cls._member_map_


class SortDirection(GraphQLEnumMapper):
asc = 'asc'
Expand Down
2 changes: 1 addition & 1 deletion backend/dataall/base/api/gql/graphql_type_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def gql(self):
elif isinstance(self.of_type, Thunk):
return template(self.of_type.target.name)
else:
raise Exception('Cant gql ')
raise Exception(f'Cant gql {self.of_type}')

return Modifier

Expand Down
11 changes: 11 additions & 0 deletions backend/dataall/base/api/queries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dataall.base.api import gql
from dataall.base.api.resolvers import enum_resolver
from dataall.base.api.types import EnumResult

enumsQuery = gql.QueryField(
name='queryEnums',
args=[gql.Argument(name='enums_names', type=gql.ArrayType(gql.String))],
type=gql.ArrayType(EnumResult),
resolver=enum_resolver,
test_scope='Enums',
)
14 changes: 14 additions & 0 deletions backend/dataall/base/api/resolvers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from dataall.base.api.constants import GraphQLEnumMapper


def enum_resolver(context, source, enums_names):
result = []
for enum_class in GraphQLEnumMapper.__subclasses__():
if enum_class.__name__ in enums_names:
result.append(
{
'name': enum_class.__name__,
'items': [{'name': item.name, 'value': str(item.value)} for item in enum_class],
}
)
return result
17 changes: 17 additions & 0 deletions backend/dataall/base/api/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from dataall.base.api import gql

EnumItem = gql.ObjectType(
name='EnumItem',
fields=[
gql.Field(name='name', type=gql.String),
gql.Field(name='value', type=gql.String),
],
)

EnumResult = gql.ObjectType(
name='EnumResult',
fields=[
gql.Field(name='name', type=gql.String),
gql.Field(name='items', type=gql.ArrayType(EnumItem)),
],
)
37 changes: 28 additions & 9 deletions backend/dataall/base/aws/cognito.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ class Cognito(ServiceProvider):
def __init__(self):
self.client = boto3.client('cognito-idp', region_name=os.getenv('AWS_REGION', 'eu-west-1'))

def get_cognito_users(self, groupName):
envname = os.getenv('envname', 'local')
parameter_path = f'/dataall/{envname}/cognito/userpool'
ssm = boto3.client('ssm', region_name=os.getenv('AWS_REGION', 'eu-west-1'))
user_pool_id = ssm.get_parameter(Name=parameter_path)['Parameter']['Value']
paginator = self.client.get_paginator('list_users_in_group')
pages = paginator.paginate(UserPoolId=user_pool_id, GroupName=groupName)
cognito_user_list = []
for page in pages:
cognito_user_list += page['Users']

return cognito_user_list

def get_user_emailids_from_group(self, groupName):
try:
envname = os.getenv('envname', 'local')
parameter_path = f'/dataall/{envname}/cognito/userpool'
ssm = boto3.client('ssm', region_name=os.getenv('AWS_REGION', 'eu-west-1'))
user_pool_id = ssm.get_parameter(Name=parameter_path)['Parameter']['Value']
paginator = self.client.get_paginator('list_users_in_group')
pages = paginator.paginate(UserPoolId=user_pool_id, GroupName=groupName)
cognito_user_list = []
for page in pages:
cognito_user_list += page['Users']
cognito_user_list = self.get_cognito_users(groupName)
group_email_ids = []
attributes = []
# Make a flat list
Expand All @@ -39,6 +44,20 @@ def get_user_emailids_from_group(self, groupName):
else:
return group_email_ids

def get_user_list_from_group(self, groupName):
try:
cognito_user_list = self.get_cognito_users(groupName)
group_usernames = [user['Username'] for user in cognito_user_list]
except Exception as e:
envname = os.getenv('envname', 'local')
if envname in ['local', 'dkrcompose']:
log.error('Local development environment does not support Cognito')
return ['[email protected]']
log.error(f'Failed to get usernames for Cognito group {groupName} due to {e}')
raise e
else:
return group_usernames

def list_groups(self, envname: str, region: str):
user_pool_id = None
groups = []
Expand Down
3 changes: 1 addition & 2 deletions backend/dataall/base/aws/quicksight.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

from .sts import SessionHelper

logger = logging.getLogger('QuicksightHandler')
logger.setLevel(logging.DEBUG)
logger = logging.getLogger(__name__)


class QuicksightClient:
Expand Down
Loading
Loading