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

PIMS-2106: Address WAVA Scan Findings #2781

Merged
merged 3 commits into from
Nov 5, 2024
Merged

PIMS-2106: Address WAVA Scan Findings #2781

merged 3 commits into from
Nov 5, 2024

Conversation

LawrenceLau2020
Copy link
Collaborator

@LawrenceLau2020 LawrenceLau2020 commented Oct 31, 2024

🎯 Summary

PIMS-2106
It seems that some of the findings of the WAVA report such as "Cookie with Insecure or Improper or Missing SameSite attribute" is out of our control, as these cookies are being sent by the service sending back the response (keycloak, siteminder, etc.)

Changes

  • Added security headers based on an existing repo mentioned by Garry in the Jira ticket.
  • Modified the content security policy somewhat to allow for requests to unpkg.com, cdnjs.cloudflare so that the map displays correctly.
  • Also removed "'Access-Control-Allow-Origin', '*'" as this can potentially be a security issue, please test to see nothing broke.
  • This is a preliminary change. Feedback and additional suggestions are welcome!

Testing

  • To test you will need to run the react-app and the express-api as docker containers
    docker-compose build pims-app-v2 and docker-compose build pims-api-v2
    and then to run the containers: docker-compose up pims-app-v2 -d

  • Once the application is running, you'll need to check the console for any errors, and also make sure everything is working as expected. I did do some testing with the map filter and creating of a project, which seemed to work. You may need to edit the content security policy if some url was missed (eg. an image not loading when it should be)

  • This is kind of hard to test, other than making sure everything still works and then merging to dev to let the OWASP scan run in Openshift, but if you have time and want to try you can always try installing the opensource OWASP ZAP scanning tool, running it as a docker container, and follow the instructions mentioned from the documentation here: https://www.zaproxy.org/docs/docker/about/

  • Also, note that currently we are not doing an "in depth" application scan by logging in and testing each of the pages which would involve adding some authentication to the existing OWASP scan and more configuration.

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

Copy link

🚀 Deployment Information

The Express API Image has been built with the tag: 2781. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the API deployment. For more updates please monitor Image Tags Page on Wiki.

Copy link

🚀 Deployment Information

The React APP Image has been built with the tag: 2781. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the APP deployment. For more updates please monitor Image Tags Page on Wiki.

@github-actions github-actions bot added the Tests label Oct 31, 2024
add_header Pragma "no-cache";

# Content Security Policy
add_header Content-Security-Policy "default-src 'none'; frame-src 'self' *.gov.bc.ca; script-src 'nonce-windowsp' 'self' *.gov.bc.ca https://maps.googleapis.com https://unpkg.com; style-src 'self' 'unsafe-inline' https://unpkg.com https://cdnjs.cloudflare.com; font-src 'self' *.gov.bc.ca; img-src 'self' *.gov.bc.ca data: tile.openstreetmap.org https://maps.googleapis.com https://unpkg.com https://cdnjs.cloudflare.com https://openmaps.gov.bc.ca; connect-src 'self' *.gov.bc.ca https://openmaps.gov.bc.ca; manifest-src 'self';";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is the maps.googleapis.com used?

Copy link
Collaborator Author

@LawrenceLau2020 LawrenceLau2020 Oct 31, 2024

Choose a reason for hiding this comment

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

Good catch, that was probably copied and pasted from the other repo. I can remove it.

@@ -1,4 +1,26 @@
server {
# Enable HTTP Strict Transport Security (HSTS) to force clients to always
# connect via HTTPS (do not use if only testing)
add_header Strict-Transport-Security "max-age=31536000;";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure how this still works with localhost. Doesn't seem to impede it, but it's not https there.

Copy link
Collaborator

@dbarkowsky dbarkowsky left a comment

Choose a reason for hiding this comment

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

Everything seems to work in local. Let's see how it affects DEV.

@LawrenceLau2020 LawrenceLau2020 merged commit a8b6da9 into main Nov 5, 2024
12 checks passed
@LawrenceLau2020 LawrenceLau2020 deleted the PIMS-2106 branch November 5, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

2 participants