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

Fix OWASP test #94

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/run-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ runs:
DATABASE_URL: ${{ inputs.database_url }}
SECRET_KEY_BASE: not-actually-secret
run: bundle exec rails server &
working-directory: app

- name: "Wait for startup"
shell: bash
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/owasp-daily-scan.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: OWASP ZAP daily scan

on:
schedule:
# cron format: 'minute hour dayofmonth month dayofweek'
# this will run at noon UTC every day (7am EST / 8am EDT)
- cron: '0 12 * * *'
pull_request:
branches: [ main ]
# schedule:
# # cron format: 'minute hour dayofmonth month dayofweek'
# # this will run at noon UTC every day (7am EST / 8am EDT)
# - cron: '0 12 * * *'

jobs:
owasp-scan:
Expand All @@ -31,15 +33,17 @@ jobs:

- id: setup
uses: ./.github/actions/setup-project
with:
rails_env: test

- uses: ./.github/actions/run-server
with:
database_url: ${{ steps.setup.outputs.database_url }}

- name: Run OWASP Full Scan
uses: zaproxy/action-full-scan@v0.10.0
uses: JosephGasiorekUSDS/action-full-scan@jgasiorek-args
with:
target: 'http://localhost:3000/'
fail_action: true
rules_file_name: 'zap.conf'
cmd_options: '-I'
rules_file_name: 'app/zap.conf'
cmd_options: -I -z \"-config network.globalExclusions.exclusions\\(0\\).exclusion.name=Search -config network.globalExclusions.exclusions\\(0\\).exclusion.enabled=true -config network.globalExclusions.exclusions\\(0\\).exclusion.value=/.*\\/(?:.{2}\\/)?cbv\\/employer_search\\?authenticity\\_token.*/gm\"
3 changes: 3 additions & 0 deletions app/app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
class PagesController < ApplicationController
def home
unless params["format"].nil?
head 401, content_type: "text/html"
end
end
end
2 changes: 2 additions & 0 deletions app/app/views/cbv/employer_searches/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<p><%= t(".directed_to_login_portal") %></p>

<%= form_with url: cbv_flow_employer_search_path, method: :get, class: "usa-search usa-search--big margin-top-4", html: { role: "search" }, data: { turbo_frame: "employers", turbo_action: "advance" } do |f| %>
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
<%= f.label :query, "Search for your employer", class: "usa-sr-only" %>
<%= f.text_field :query, value: @query, class: "usa-input", type: "search", data: { "cbv-employer-search-target": "searchTerms" } %>
<button
Expand All @@ -24,6 +25,7 @@
<%= render partial: "employer", locals: { employer: @employers } %>

<%= form_with url: next_path, method: :get, class: "display-none", data: { 'cbv-employer-search-target': "form" } do |f| %>
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
<input type="hidden" name="user[account_id]" data-cbv-employer-search-target="userAccountId" >
<% end %>

Expand Down
3 changes: 3 additions & 0 deletions zap_options.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
network.globalExclusions.exclusions(0).exclusion.name=Search
network.globalExclusions.exclusions(0).exclusion.enabled=true
network.globalExclusions.exclusions(0).exclusion.value=/.*\/(?:.{2}\/)?cbv\/employer_search\?authenticity\_token.*/gm
Loading