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

[C4GT Community]: Replace FromOriginMatchHeader secret to locally set environment variable #57

Open
7 tasks
codecakes opened this issue Sep 2, 2024 · 5 comments · May be fixed by #109
Open
7 tasks
Labels
bug Something isn't working C4GT Coding C4GT Community good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@codecakes
Copy link
Contributor

Ticket Contents

Description

There is a binder FromHeader here:

https://github.com/Xcov19/project-healthcare/blob/e8fb0a6a8a6cbcb0f7fd1b8f7429790eadea2930/xcov19/app/settings.py#L48

and here:
https://github.com/Xcov19/project-healthcare/blob/e8fb0a6a8a6cbcb0f7fd1b8f7429790eadea2930/xcov19/app/middleware.py#L20

which are currently hardcoded. It needs to be replaced with a value sourced directly from environment variable. The value can be any sophisticated super secret string one can conjure in the localhost.

The code describes where and why this is used.

Reference: You see this getting used during API calls here: https://project-healthcare.onrender.com/docs

Goals

Goals

  • Refactor to use locally generated from environment variable
  • make run and smoke test to verify APIs don't break after refactor

Expected Outcome

  • No change in API behaviour
  • Sending wrong secret in the API call which is different from locally generated secret fails

Acceptance Criteria

There is a Pytest e2e Testsuite which tests for the expected outcomes in the following cases:

  • Test asserts true when no change in API behaviour when correct secret is supplied
  • Test asserts failure when sending wrong secret in the API call which is different from locally generated secret fails
  • No mocks are used.

See https://tonybaloney.github.io/posts/async-test-patterns-for-pytest-and-unittest.html

Implementation Details

  1. Ensure locally sourced env var is set in `settings.py``
  2. It is then set in https://github.com/Xcov19/project-healthcare/blob/e8fb0a6a8a6cbcb0f7fd1b8f7429790eadea2930/xcov19/app/settings.py#L48
  3. The placeholder string is replaced in relevant places with locally set env variable

Mockups/Wireframes

No response

Product Name

project-healthcare

Organisation Name

XCoV19

Domain

Healthcare

Tech Skills Needed

CI/CD, Debugging, Python, RESTful APIs, Swagger, Test, Testing Library

Mentor(s)

@codecakes

Complexity

Medium

Category

API, Backend, Beginner Friendly, CI/CD, Testing

@codecakes codecakes added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed C4GT Community C4GT Coding labels Sep 2, 2024
@codecakes codecakes added this to the v1 milestone Sep 2, 2024
@TheSciPro
Copy link

Hey,
Is this issue still open?

@codecakes
Copy link
Contributor Author

Hey, Is this issue still open?

@TheSciPro
Yes. you can check all issues by their status

@MustafaAkolawala
Copy link

Hello,
can I get this issue assigned to me

@prajwal2431
Copy link

assign this issue to me

@codecakes
Copy link
Contributor Author

@prajwal2431 @TheSciPro @MustafaAkolawala if you follow the necessary actions asked in this issue, you are free to raise a PR. It is a on a first-come first-serve basis. Some general pointers to follow when implementing PR for this issue are given here: #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C4GT Coding C4GT Community good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
4 participants