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

As ACF tech lead, I need the nightly-owasp-scan CircleCI workflow to run successfully and exclude non-TDP URLs in scan report #1534

Closed
5 tasks done
ADPennington opened this issue Jan 11, 2022 · 9 comments · Fixed by #1673
Assignees

Comments

@ADPennington
Copy link
Collaborator

ADPennington commented Jan 11, 2022

Context:

the nightly OWASP scans have been timing out more frequently, at the backend scan step. As a reminder, we run these security vulnerability scans and store them in the staging backend (for now) to meet ACF OCIO compliance standards (ref).

See screenshot of workflow 30-day success rate as of 2/15 below:
1534_216

The error message in the job is: Too long with no output (exceeded 10m0s): context deadline exceeded. According to CircleCI documentation, 10 minutes is the default timeout setting, and some suggestions are offered therein to resolve, including increasing the timeout.

After some investigations noted in the 2/14 and 2/15 comments below, we decided that we need to increase the timeout and also prevent the non-TDP URLs from being scanned for security vulnerabilities which appears to be the root cause of the timeout.

ACs:

  • nightly-owasp-scan workflow scan runs without timing out at 10min
  • non-TDP URLs are not reported in the backend scan

Tasks:

  • Decide strategy for excluding non-TDP URLs from being scanned
  • Increase timeout to > 10min
  • Determine strategy for testing fix for qasp review

Supporting Documentation:

@valcollignon
Copy link

Ticket needs to be refined further before being picked up. @ADPennington will continue to monitor. If success rate falls further (50% or below), she will make a note and will bring issue back up in a future backlog refinement.

@ADPennington
Copy link
Collaborator Author

ADPennington commented Feb 10, 2022

it's been a tough week for owasp. this is just an update for awareness.

210owasp2

Realizing that we didnt decide on the baseline for the success rate monitoring. 90 days feels a bit long, I recommend 30 days (we're still above the threshold), since we provide monthly updates to OCIO. cc: @valcollignon @lfrohlich @abottoms-coder

30 day snapshot as of 2/10/22
210owasp3

90 day snapshot as of 2/10/22
210owasp1

@lfrohlich
Copy link
Collaborator

@ADPennington 30 days makes sense to me. Thanks for continuing to monitor.

@ADPennington
Copy link
Collaborator Author

ADPennington commented Feb 14, 2022

2/14 Update:

Backend scan step continues to fail. We've now had 9 consecutive days of owasp job failure (see below) and will soon reach the 50% threshold. cc: @abottoms-coder @lfrohlich @valcollignon
214owasp

I've been investigating how long it takes for the zap results to be produced since the default timeout in CI is 10 min. Some notes:

  • ran the nightly scan against backend (since this is what is timing out in CI) locally via bash -x ./scripts/zap-scanner.sh backend nightly . its taking the report 11-13 minutes to be produced.
  • Given the above, I tested increasing the timeout to 15min on my fork and have been monitoring the CI results over the weekend, it's been successful. code change snippet below.
 run-owasp-scan:
    ...
    steps:
      - run:
          name: Execute OWASP ZAP vulnerability scan
          #wait up to 15 minutes for zap results
          no_output_timeout: 15m
          command: ./scripts/zap-scanner.sh <<parameters.target>> <<parameters.environment>>
      ...

  • Note the vast majority of the backend scan reports ive seen during testing match the latest version of the report that is stored in the staging backend, but I did notice a couple of scans yesterday that caught 3K+ low risk instances vs the 130+ low risk instances that we've been getting. I've saved a copy here.

@ADPennington
Copy link
Collaborator Author

ADPennington commented Feb 15, 2022

2/15 Update:

  • we're down to a 61% success rate, so recommend bringing this issue into Sprint 41.
  • @abottoms-coder reviewed the report I mentioned above and noticed that this is because non-TDP URLs are being included for some reason. I did some poking around to better understand why and stumbled into this issue which speaks to the same anomalous scan results from mozilla. It suggests that we need to update the exclusion criteria. Note that the last comment in the thread notes that these alerts may need be removed via a hook.
  • Relatedly, the last 2 backend scans timed out at 15 minutes on my fork, and I believe that this is because of the extra mozilla URLs since those scans have taken longer even when successful. So while we may need to increase the timeout anyway (because its taking >10m even locally), updating the exclusion criteria seems like it could help ensure irrelevant URLs aren't being scanned.

cc: @lfrohlich @valcollignon

@ADPennington
Copy link
Collaborator Author

ADPennington commented Feb 28, 2022

2/28 update:

Currently testing on feat/1534-updating-to-latest-zaproxy branch:

  • ./tdrs-backend/docker-compose.yml updated to latest zap version -- want to see if this will fix this issue with non-TDP URLs from being scanned
  • ./.circleci/config.yml updated to increase owasp scan timeout to 60min, have cron job run on remote branch twice a day -- this should be enough to ensure the backend scan doesnt timeout

Will monitor results for next couple of days.

@ADPennington
Copy link
Collaborator Author

ADPennington commented Mar 2, 2022

3/2 Update:

cc: @abottoms-coder @lfrohlich

@ADPennington ADPennington changed the title As ACF tech lead, I need the nightly-owasp-scan CircleCI workflow to run successfully As ACF tech lead, I need the nightly-owasp-scan CircleCI workflow to run successfully and exclude non-TDP URLs in scan report Mar 2, 2022
@ADPennington
Copy link
Collaborator Author

ADPennington commented Mar 3, 2022

3/3 Update:

@reitermb
Copy link
Collaborator

Demoed by @abottoms-coder on 3/15/2022

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

Successfully merging a pull request may close this issue.

5 participants