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

Mc 568 containerize flask app #571

Conversation

maxachis
Copy link
Contributor

Fixes

Description

  • Creates dockerfile for Flask app

Testing

  • Running tests on Dockerfile image locally caused them to past.
  • The tests themselves should continue to pass in GitHub Actions
  • However: Should we update the GitHub action to somehow start up the docker container and then run the tests through that? Or is the fact that it's already in a GitHub action be sufficient containerization?

Performance

  • The nature of a docker container incurs performance overhead (though not too much) compared to running the source code raw.

Docs

  • Documentation has not been updated.

Breaking Changes

  • No breaking changes

maxachis and others added 30 commits November 1, 2024 16:23
…_clarify_oauth_docs

503 - Enhance `/data-sources` `PUT` method.
…_link_unlink_data_requests_with_locations

Add logic for linking/unlinking data requests with locations; add `lo…
…_encrypt_api_keys

Mc 388 encrypt api keys
* feat: miscellaneous client search updates

* fix: use replace for swipe nav
…_signup_existing_email

Mc 501 signup existing email
…_correct_required_api_schema

Remove `required` status from some schema fields
…_standardize_auth_token_responses

Standardize `/refresh-session` response to align with `/login`. Update test and internal logic accordingly.
…_update_data_requests_put_logic_and_tests

Update `/data-requests` `PUT` logic and tests
* Refactor/consolidate test setup for data_requests and data_sources integration tests.

* Add header comment to enums.py module

* Create separate module for subquery logic

* Adjust import of SubqueryParameters; change argument name

* Remove unused columns, variables, and imports

* Add logic for subquery parameters

* Create formatting for subqueries; remove unused functions

* Rename and add DataRequestsGetSchema

* Add logic for results formatting with subqueries

* Refactor special iteration logic; add data_sources relationship logic

* Update import logic and subquery parameter naming

* Update Data Sources schemas

* Migrate schemas to separate function; add subquery logic

* Update parameter naming

* Refactor subquery logic

* Update import

* Update tests;

* add session-wide setup for some fixtures.
* Add rate limiting setup.

* Begin expanding TestDataCreator

* Remove data_source_ids from GetSchema

* Remove unused functions

* Remove check for `agency_ids` in `test_select_from_relation_subquery`

* Mark TestDataGenerator for deprecation

* Migrate `get_data_to_post` to `get_sample_agency_post_parameters` from `common_test_data` module

* Rename `data_source_queries.py` to `data_sources_logic.py`

* Adjust test_get_data_requests to always produce a data request prior to running the test

* Remove unused code

* Lightly refactor load_options in `create_selection_query`

* Correct DataSourceBaseSchema and update test_data_requests.py to check for presence of schema in at least some of returned data in GET MANY request

* Intermediate work

* Create `get_linked_rows` logic.

* LIBTYFI: Remove unused test fixtures.

Modify some tests so that these fixtures were replaced with other, more concise logic, so as to reduce redundancy.

* Fix breaking tests.

* Update Result formatting for `get_linked_rows`

* Update `get_data_request_related_sources` to use generalized database client method.

* LIBTYFI: Refactor Subquery Result Formatting logic.

* Update data_sources outer model in the schema.

* Comment out test which fails due to stage-specific environment causes.

* Remove minor test which fails in GitHub actions due to import issue.

* Initial metadata implementation

* Resolve merge conflicts

* Add comments

* Begin developing endpoint schema config and apply to `/data-requests` GET-MANY endpoint.

* Correct bug in EndpointSchemaConfigs

* Rename variables, correct DataRequests GetByID schema error.

* Reorganize dynamic schema/dto logic into separate directory.

* Reorganize dynamic schema/dto logic into separate directory.

* Reorganize dynamic schema/dto logic into separate directory.

* Create schema helpers for creating common schema classes; rename GetManyBaseSchema to GetManyRequestsBaseSchema

* Begin converting agencies to organized endpoint schema config

* Add AGENCIES_POST, AGENCIES_BY_ID_PUT to endpoint schema config

* Add AGENCIES_POST, AGENCIES_BY_ID_PUT to endpoint schema config

* refactor: `Form` -> `FormV2` and `PdapInput` -> v2 input components (#128)

* chore(deps): bump design-system

* refactor: Form -> FormV2

* Add Data Sources to Endpoint Schema Config

* Update Data Sources to use updated configuration.

* Add `request_urgency` to `data_requests`, add test for `api_doc_load`, other minor modifications.

* Changes for 299 - Github Issue Posting

Changes:
* Add Endpoint for adding Data Request to Github Issues, and associated logic and tests
* Add `PyGithub` as a dependency
LIBTYFI:
* Create `third_party_interaction_logic` directory
* Move `callback_` logic to relevant directories
* Update `PsycopgResources.handle_exceptions` to simplify logic
* Update `test_data_creator_flask` to propagate exceptions on error
* Create `manual_tests` directory

* Update README with new environment variable information

* Implement Github Synchronize logic.

* Fix broken test and add timeout to `requests.post`

* Reformat with black

* Add metadata logic

* Integrate metadata logic

* Sort database query results

* Cleanup

* Create endpoint for following/unfollowing searches, as well as getting all searches for a specific user, or overall

LIBTYFI:
* Replace prior database client create/update/delete Postgres logic with (more concise) SQLAlchemy logic.

* Correct bug in `/search/follow` `GET` endpoint.

LIBTYFI: Add additional error checking in Restx Dynamic Model creator

* Fix bug in `/search/follow` `POST` and `DELETE` routes.

Incorrect schemas specified.

* Begin work on converting airtable_uids to integer ids

* Complete work converting airtable uids to integer ids

* Complete work converting airtable uids to integer ids

* refactor: airtable_uuid -> id (#135)

* Multiple changes
* Implement data requests with locational association
* Add endpoint(s) for associating agencies with data sources
* Add logic accounting for title in data requests

* Refine `test_approval_status_updated_at`

* Create first draft of `test_notifications_followed_searches`

* Refactor test_notifications_follow_searches:

* Include draft for test_notifications_permission_denied
 * Develop EndpointCaller helper class

* Correct bug in `/typeahead-locations` API documentation.

* Remove tests that were more trouble than they were worth

- These tests broke when I changed unrelated logic; that's indicative that these tests were not properly designed, so I'm getting rid of them.

* Remove tests that were more trouble than they were worth

- These tests broke when I changed unrelated logic; that's indicative that these tests were not properly designed, so I'm getting rid of them.

* Shorten request urgency enum

* Correct location infos, fix schema bug

* Correct data requests locations schema bug

* Porgress on database view creation logic

* Hotfix: Fix `data_requests.coverage_range` to be `Optional[str]`; update `test_data_requests_post` to include a check for this parameter.

* Begin draft

* feat: request route (#141)

* refactor: updates to prep for requests

* chore: bump design-system

* refactor: miscellaneous updates to typeahead
Make more generic and flexible,
Allow for passing scoped slot for special formatting

* chore(deps): bump design-system

* feat: new request

* fix: refresh token type errors

* chore(deps): bummp design-system to latest beta

* refactor: misc auth updates

* refactor: add locations on select from typeahead

* feat(client): update request button min width

* Progress Notification Architecture development.

* Complete draft of notification architecture development

* Add `dominate` to requirements.txt

* Add more detailed description to `/notifications` `POST` endpoint.

* Update `/notifications` api documentation.

* Create `Recent Searches` logic
* Update `/search` `GET` endpoint call to log recent searches
* Create `/user/recent-searches` `GET` endpoint for retrieving recent searches for user
* Update existing tests to validate the above behavior.

* Update `/data-requests` `GET MANY` logic to allow filtering by request status

* Update webhook_logic.py

* Refactor Github OAuth logic

* Add and enhance documentation
* Combine `/login-with-github` and `/create-user-with-github` into a single `/login-with-github` endpoint
* Enhance integration tests, remove redundant tests

* Fix bugs after merge

* Fix bugs in `data_sources` model:
* `tags` and `agency_aggregation` now accurately reflect their database types.

* Create `get_record_type_id_by_name` method

* Update `DataSourcesPutSchema` to exclude `id` and `data_source_request`

* Update `update_data_source_wrapper` function to optionally swap `record_type_name` with corresponding `record_type_id` key and value

* Enhance `test_data_sources_by_id_put`: test for all editable parameters now

* Add logic for linking/unlinking data requests with locations; add `location_id` to `typeahead/locations` logic

* Rename `get_api_key_for_user` to `create_api_key_for_user`

* Reorganize API key logic; remove redundant tests.

* Add API logic to encrypt API keys with SHA256 hash

* feat: miscellaneous client search updates (#150)

* feat: miscellaneous client search updates

* fix: use replace for swipe nav

* Add test for checking duplicate user creation logic.

* Remove `required` status from some schema fields

* Standardize `/refresh-session` response to align with `/login`. Update test and internal logic accordingly.

* Update `/data-requests` `PUT` logic and tests

* format with black (#156)

---------

Co-authored-by: Kylie <[email protected]>
Co-authored-by: Joshua Graber <[email protected]>
Co-authored-by: Josh <[email protected]>
…_github_access_token

Change Github Access Token to JWT with Expiry of 5 minutes.
…tion_provided column

* Add test for update_broken_source_url_as_of
…_update_broken_source_url_as_of

* Adjust logic to account for removed data_sources.record_download_op…
…_update_integration_tests

Update Integration tests to include all possible inputs
joshuagraber and others added 26 commits December 16, 2024 15:59
and miscellaneous other fixes
…_standardize_locations

Mc 561 standardize locations
# Conflicts:
#	.github/workflows/run_pytest.yml
#	README.md
#	app.py
#	client/.eslintrc.json
#	client/package-lock.json
#	client/package.json
#	client/src/App.vue
#	client/src/components/AuthWrapper.vue
#	client/src/components/SearchForm.vue
#	client/src/components/TypeaheadInput.vue
#	client/src/pages/change-password.vue
#	client/src/pages/data-source.[id].vue
#	client/src/pages/index.vue
#	client/src/pages/reset-password.vue
#	client/src/pages/search.results.vue
#	client/src/pages/sign-in.vue
#	client/src/pages/sign-out.vue
#	client/src/pages/sign-up.vue
#	client/src/router.js
#	client/src/stores/auth.js
#	client/src/stores/search.js
#	client/vite.config.js
#	conftest.py
#	database_client/database_client.py
#	database_client/dynamic_query_constructor.py
#	database_client/models.py
#	database_client/result_formatter.py
#	database_client/subquery_logic.py
#	middleware/access_logic.py
#	middleware/common_response_formatting.py
#	middleware/custom_dataclasses.py
#	middleware/decorators.py
#	middleware/dynamic_request_logic/get_related_resource_logic.py
#	middleware/dynamic_request_logic/post_logic.py
#	middleware/dynamic_request_logic/supporting_classes.py
#	middleware/enums.py
#	middleware/location_logic.py
#	middleware/primary_resource_logic/agencies.py
#	middleware/primary_resource_logic/api_key_logic.py
#	middleware/primary_resource_logic/callback_primary_logic.py
#	middleware/primary_resource_logic/data_requests.py
#	middleware/primary_resource_logic/data_sources_logic.py
#	middleware/primary_resource_logic/github_issue_app_logic.py
#	middleware/primary_resource_logic/login_queries.py
#	middleware/primary_resource_logic/notifications_logic.py
#	middleware/primary_resource_logic/reset_token_queries.py
#	middleware/primary_resource_logic/search_logic.py
#	middleware/primary_resource_logic/user_profile.py
#	middleware/primary_resource_logic/user_queries.py
#	middleware/schema_and_dto_logic/common_schemas_and_dtos.py
#	middleware/schema_and_dto_logic/dynamic_logic/model_helpers_with_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_dtos/data_requests_dtos.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/agencies_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/auth_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/data_requests_base_schema.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/data_sources_base_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/github_issue_app_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/refresh_session_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/search_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/typeahead_suggestion_schemas.py
#	middleware/schema_and_dto_logic/primary_resource_schemas/user_profile_schemas.py
#	middleware/schema_and_dto_logic/schema_helpers.py
#	middleware/third_party_interaction_logic/callback_oauth_logic.py
#	middleware/third_party_interaction_logic/github_issue_api_logic.py
#	middleware/third_party_interaction_logic/mailgun_logic.py
#	middleware/util.py
#	middleware/webhook_logic.py
#	requirements.txt
#	resources/Agencies.py
#	resources/ApiKeyResource.py
#	resources/CreateTestUserWithElevatedPermissions.py
#	resources/DataRequests.py
#	resources/DataSources.py
#	resources/GithubDataRequests.py
#	resources/LinkToGithub.py
#	resources/Login.py
#	resources/LoginWithGithub.py
#	resources/Notifications.py
#	resources/RefreshSession.py
#	resources/ResetPassword.py
#	resources/Search.py
#	resources/TypeaheadSuggestions.py
#	resources/UniqueURLChecker.py
#	resources/User.py
#	resources/UserProfile.py
#	resources/endpoint_schema_config.py
#	resources/resource_helpers.py
#	tests/conftest.py
#	tests/helper_scripts/common_endpoint_calls.py
#	tests/helper_scripts/common_test_data.py
#	tests/helper_scripts/common_test_functions.py
#	tests/helper_scripts/constants.py
#	tests/helper_scripts/helper_classes/TestDataCreatorDBClient.py
#	tests/helper_scripts/helper_functions.py
#	tests/helper_scripts/run_and_validate_request.py
#	tests/integration/test_agencies.py
#	tests/integration/test_api_doc_load.py
#	tests/integration/test_api_key.py
#	tests/integration/test_archives.py
#	tests/integration/test_check_api_key.py
#	tests/integration/test_data_requests.py
#	tests/integration/test_data_sources.py
#	tests/integration/test_data_sources_map.py
#	tests/integration/test_github_data_requests_issues.py
#	tests/integration/test_homepage_search_cache.py
#	tests/integration/test_link_to_github.py
#	tests/integration/test_login.py
#	tests/integration/test_login_with_github.py
#	tests/integration/test_notifications.py
#	tests/integration/test_permissions.py
#	tests/integration/test_refresh_session.py
#	tests/integration/test_request_reset_password.py
#	tests/integration/test_reset_password.py
#	tests/integration/test_reset_token_validation.py
#	tests/integration/test_search.py
#	tests/integration/test_typeahead_suggestions.py
#	tests/integration/test_user.py
#	tests/integration/test_user_profile.py
#	tests/middleware/test_callback_primary_logic.py
#	tests/middleware/test_login_queries.py
#	tests/resources/test_DataRequests.py
#	tests/resources/test_Search.py
#	tests/test_database.py
#	tests/test_database_client.py
#	tests/test_endpoints.py
#	tests/test_schema_aligned_with_db_table.py
#	tests/test_schema_validation.py
#	tests/utilities/test_rate_limiter.py
#	utilities/namespace.py
…_email_template

Update email template for signup link.
…_update_user_recent_searches

Mc 569 update user recent searches
…_id_to_location_id

Convert references to location's `id` to `location_id`
@maxachis
Copy link
Contributor Author

WRONG REPO

@maxachis maxachis closed this Dec 20, 2024
Copy link

gitguardian bot commented Dec 20, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14602283 Triggered Generic Password 9d43bd0 tests/integration/test_signup.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants