Skip to content

Api key #1011

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

Merged
merged 92 commits into from
Mar 29, 2023
Merged

Api key #1011

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
c7b0120
Cleanup unused imports && added role definition and security
Oct 18, 2022
a700ef2
Simple api role checking
dmytrotsko Oct 18, 2022
75509cb
Render api key warnings
dmytrotsko Oct 18, 2022
a796e2c
Move tests
dmytrotsko Oct 18, 2022
8d48b20
Add api user ddl
dmytrotsko Oct 18, 2022
c753f73
tests
dmytrotsko Oct 18, 2022
a15a36e
improve dockerignore
dmytrotsko Oct 18, 2022
4fc210d
support api date via env
dmytrotsko Oct 18, 2022
ee0c087
start with admin interface
dmytrotsko Oct 18, 2022
0446ea9
start with simple admin interface
dmytrotsko Oct 18, 2022
c7ca927
very basic admin interface
dmytrotsko Oct 18, 2022
d066a90
list all known roles
dmytrotsko Oct 18, 2022
8b09387
remove log statement
dmytrotsko Oct 18, 2022
e940f8b
fixup tests
dmytrotsko Oct 18, 2022
8bb2789
add record flag to user
dmytrotsko Oct 18, 2022
3161d2e
basic record based on flag logging
dmytrotsko Oct 18, 2022
9ab8978
rename column to tracking
dmytrotsko Oct 18, 2022
54dc83c
add webhook endpoint for google forms and simplify table
dmytrotsko Oct 18, 2022
62122cf
tests for simplified api_user
dmytrotsko Oct 18, 2022
32096ac
prepare for sending mails with mailgun
dmytrotsko Oct 18, 2022
45414bc
disable security check for test setup
dmytrotsko Oct 18, 2022
60f7cd6
fix tests
dmytrotsko Oct 18, 2022
dac3fcb
add registered flag
dmytrotsko Oct 18, 2022
d880795
request a simple api key form with recaptcha check
dmytrotsko Oct 18, 2022
e76cde4
implement rate limiting
dmytrotsko Oct 18, 2022
f1f008e
registered flag not saved
dmytrotsko Oct 18, 2022
98315c6
mark all tests no rate limit
dmytrotsko Oct 18, 2022
f897e28
add link to registration form within api key form
dmytrotsko Oct 18, 2022
b345f76
elevate sqlalchemy log level to ERROR for test purpose
dmytrotsko Oct 18, 2022
5ce96bd
add structlog to requirements
dmytrotsko Oct 18, 2022
f851d5b
add structured logging module
dmytrotsko Oct 18, 2022
38abd83
implement api key scrubbing logs and getter functions for User class
dmytrotsko Oct 18, 2022
d65acb8
minor commenting change
dmytrotsko Oct 18, 2022
5aee08f
change logging to kward format and add a get function for API key
dmytrotsko Oct 18, 2022
7378e8d
move mask_apikey function out of User class
dmytrotsko Oct 18, 2022
02a535b
minor change in variable name
dmytrotsko Oct 18, 2022
c18a122
Fixed test
dmytrotsko Oct 18, 2022
da947fd
added missing import
dmytrotsko Oct 18, 2022
4732467
Fixed _is_public_route method. Added URL_PREFIX to list of routes
dmytrotsko Oct 24, 2022
ae1e6a1
Merge pull request #2 from dmytrotsko/fix_admin_endpoint_access
dmytrotsko Oct 24, 2022
16a154c
Added email column to User table
dmytrotsko Oct 25, 2022
4b5fa65
Merge branch 'api_key' of github.com:dmytrotsko/delphi-epidata into a…
dmytrotsko Oct 25, 2022
a8011fd
Fixed tests
dmytrotsko Oct 25, 2022
6775384
Added Dockerfile for Redis
dmytrotsko Oct 25, 2022
7e11435
Made email optional
dmytrotsko Oct 25, 2022
74fd290
Added email address validaiton
dmytrotsko Oct 26, 2022
8d496ba
Fixed API key creation via /create_key endpoint
dmytrotsko Oct 27, 2022
3bc7095
Fixed /register endpoint after google script refactoring
dmytrotsko Oct 27, 2022
e39c82a
Fixed registration
dmytrotsko Oct 28, 2022
be80550
Reverted some changes in _config.py
dmytrotsko Oct 28, 2022
8f21122
Reverted changes in .env.example
dmytrotsko Nov 2, 2022
71bb186
Code refactoring
dmytrotsko Nov 2, 2022
aea77eb
Removed unused variables
dmytrotsko Nov 2, 2022
b7a6078
Code cleaning
dmytrotsko Nov 2, 2022
635be31
Removed unused variables
dmytrotsko Nov 3, 2022
93b056e
Removed default redis configuration file (it is not needed for now)
dmytrotsko Nov 3, 2022
df11183
Moved BASE_URL and auth to setUP, formatted code
dmytrotsko Nov 3, 2022
b63faa3
Moved BASE_URL and auth to setUP(), formatted code
dmytrotsko Nov 3, 2022
9ed758b
Revert "Moved BASE_URL and auth to setUP(), formatted code"
dmytrotsko Nov 3, 2022
02083a0
Formatted code & removed unused imports.
dmytrotsko Nov 4, 2022
99f75a6
Created staticmethod _make_rqeuest() and reused it in test_caching() …
dmytrotsko Nov 7, 2022
f94ec4d
Returned BASE_URL and auth back, because if we use default BASE_URL f…
dmytrotsko Nov 7, 2022
0480172
Completely removed patch_flask_config() function as it is useless. Th…
dmytrotsko Nov 7, 2022
3586bcf
Removed duplicated _logger.py file (this is exact copy of src/acquisi…
dmytrotsko Nov 7, 2022
1ee16f7
Fixed test
dmytrotsko Nov 8, 2022
7ce411b
Removed unused method
dmytrotsko Nov 8, 2022
68240ca
Added missing changes in Dockerfiles for copying logger
dmytrotsko Nov 8, 2022
d350347
Fixed misspelled filename
dmytrotsko Nov 9, 2022
4bca6b4
Added missing variable in CSVPrinter
dmytrotsko Nov 9, 2022
3cf15da
Formatted code
dmytrotsko Nov 9, 2022
ad00db5
Removed tests for admin endpoint for now
dmytrotsko Nov 9, 2022
4285b87
Moved config variables from _security to _config. Removed duplicated …
dmytrotsko Nov 9, 2022
ec67149
Added missing changes
dmytrotsko Nov 15, 2022
7a364d9
Replaced db.execute delete and update with built-it sqlalchemy functi…
dmytrotsko Nov 15, 2022
e4ae70c
Removed email field. Edited google form link to prefill tracking cons…
dmytrotsko Nov 15, 2022
c21689d
Removed api_user ddl
dmytrotsko Nov 24, 2022
1ebff22
Changed user roles to use m2m table instead of string in api_user table
dmytrotsko Nov 28, 2022
c49c1f8
Added new variable for api key expiration date
dmytrotsko Nov 28, 2022
c54412c
Updated admin endpoint. Removed email from user details and added cre…
dmytrotsko Nov 28, 2022
6c50703
Updated integration tests
dmytrotsko Nov 28, 2022
3e34e3c
Updated endpoints to register user role on endpoint load
dmytrotsko Nov 28, 2022
8fbae7d
Removed user_role FK in api_user table.
dmytrotsko Nov 30, 2022
95507c2
Updated according to new structure
dmytrotsko Nov 30, 2022
597eeb4
Removed API_KEY_EXPIRE_AFTER variable
dmytrotsko Nov 30, 2022
08bd2b6
Removed creation_date, expiration_date and last_api_access_date from …
dmytrotsko Nov 30, 2022
c436b0a
Added roles registraion on endpoints load
dmytrotsko Nov 30, 2022
199d434
Removed role registration statement
dmytrotsko Nov 30, 2022
4422a5e
Fixed integration tests. Actually reverted latest changes as api_user…
dmytrotsko Nov 30, 2022
806d6e4
Added new ddls
dmytrotsko Nov 30, 2022
82a0e25
Merge branch 'dev' into api_key
dmytrotsko Nov 30, 2022
58f715d
Fixed wrong import
dmytrotsko Dec 1, 2022
73efe70
Fixed issue after resolving conflicts
dmytrotsko Dec 1, 2022
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
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/delphi-epidata
/.mypy_cache
**/.mypy_cache
/.github
/docs
__pycache__
/node_modules
**/__pycache__
**/.pytest_cache
**/node_modules
20 changes: 5 additions & 15 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
FLASK_DEBUG=True
SQLALCHEMY_DATABASE_URI=sqlite:///test.db
FLASK_SECRET=abc
SECRET_TWITTER=abc
SECRET_GHT=abc
SECRET_FLUVIEW=abc
SECRET_CDC=abc
SECRET_SENSORS=abc
SECRET_SENSOR_TWTR=abc
SECRET_SENSOR_GFT=abc
SECRET_SENSOR_GHT=abc
SECRET_SENSOR_GHTJ=abc
SECRET_SENSOR_CDC=abc
SECRET_SENSOR_QUID=abc
SECRET_SENSOR_WIKI=abc
SECRET_QUIDEL=abc
SECRET_NOROSTAT=abc
SECRET_AFHSB=abc
#API_REQUIRED_STARTING_AT=2021-07-30
API_KEY_ADMIN_PASSWORD=abc
API_KEY_REGISTER_WEBHOOK_TOKEN=abc
RECAPTCHA_SITE_KEY
RECAPTCHA_SECRET_KEY
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you able to get the recaptcha checks working on the key request form?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, but going to check it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPD: it is working. I just registered new reCaptcha application and obtained new RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY.
image

2 changes: 2 additions & 0 deletions dev/docker/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# start with the `delphi_python` image
FROM delphi_python

COPY repos/delphi/delphi-epidata/src/acquisition/covidcast/logger.py /usr/src/app/delphi/epidata/server/_logger.py

RUN pip install --no-cache-dir -r repos/delphi/delphi-epidata/requirements.txt -r repos/delphi/delphi-epidata/requirements.dev.txt
3 changes: 3 additions & 0 deletions dev/docker/redis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM redis

CMD ["redis-server"]
2 changes: 1 addition & 1 deletion devops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt -r requirements_also.txt
# the file /tmp/requirements.txt is created in the parent docker definition. (see:
# https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile#L5 )
# this combined requirements installation ensures all version constrants are accounted for.

# disable python stdout buffering
ENV PYTHONUNBUFFERED 1

COPY ./devops/gunicorn_conf.py /app
COPY ./devops/start_wrapper.sh /
COPY ./src/server/ /app/app/
COPY ./src/acquisition/covidcast/logger.py /app/app/_logger.py
COPY --from=builder ./src/build/lib/ /app/app/lib/
RUN rm -rf /app/app/__pycache__ /app/app/*.php \
&& chmod -R o+r /app/app \
Expand Down
Loading