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

Jvd/orgs #141

Merged
merged 4 commits into from
Apr 22, 2024
Merged

Jvd/orgs #141

merged 4 commits into from
Apr 22, 2024

Conversation

jduss4
Copy link
Contributor

@jduss4 jduss4 commented Apr 19, 2024

Changes proposed in this pull request:

Fulfills step 2 of #102

  • adds example-fied API responses for /v3 org endpoints (org list, org, org users)
  • moves cloudfoundry tests to __tests__
  • takes existing getCFApps function and makes reusable for listing apps and orgs
  • adds useUnknownInCatchVariables for tsconfig to get around using any for error (see docs)

This is an extremely rough implementation of grabbing information about orgs the user has access to. It lacks error handling and jumps straight to the .resources portion of an API response. Now that our users can successfully receive org information from the CF API, we will want to invest time thinking about additional response data we want to use, like pagination / count, understand CF error messages beyond just the returning http code, etc. This will require refactoring in the cloudfoundry.ts file and possibly api.js.
The UI is left untested as it is expected to change drastically in the near future.

Things to check

  • For any logging statements, is there any chance that they could be logging sensitive data?
  • Are log statements using a logging library with a logging level set? Setting a logging level means that log statements "below" that level will not be written to the output. For example, if the logging level is set to INFO and debugging statements are written with log.debug or similar, then they won't be written to the otput, which can prevent unintentional leaks of sensitive data.
  • Have you updated or added relevant documentation (README, ADRs, explainers, etc)?

Security considerations

The API requests are available to unauthenticated users, although without a correct token for the CF API they will receive a 401 response.
In the test mock files, I have replaced all GUIDs, usernames, org names, etc to make for a generic but realistic API response.

api/cloudfoundry.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
/v3/organizations
/v3/organizations/[guid]
/v3/organizations/[guid]/users

swaps out actual guids, org names, and user names but otherwise
leaves the responses intact
instructs jest to ignore mocks directory

adds interface for api org response
.prettierignore Outdated Show resolved Hide resolved
Co-authored-by: Eleni Chappen <eleni.chappen@gsa.gov>
Copy link
Contributor

@echappen echappen left a comment

Choose a reason for hiding this comment

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

looks great, thanks!

@jduss4 jduss4 merged commit df582fe into main Apr 22, 2024
3 checks passed
@jduss4 jduss4 deleted the jvd/orgs branch April 22, 2024 19:21
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.

2 participants