check / check (push) Waiting to run
The Gitea setup runs the Core Rule Set in block mode. Rules that refused ordinary Gitea requests are switched off only where they misfired: - deploy/gitea/crs-exclusions.conf, loaded through the new setting SWWAF_CORE_RULE_SET_EXCLUSIONS_FILE before the Core Rule Set's rules, covers Gitea's search, file-name and branch-name fields, Referer, file paths, API attachment names and Actions artifact uploads; - smallwebwaf's defaults gain a seventh change: the registry upload path's from parameter skips 932260. A file that cannot be read, does not parse or names an id from 900000 to 900999 stops servewaf at start, in every mode. internal/waf's tests and script/gitea-setup send the recorded requests in internal/waf/testdata/gitea-requests.txt and three attacks. Model: opus-5-5
151 lines
9.1 KiB
Plaintext
151 lines
9.1 KiB
Plaintext
# The Core Rule Set's exclusions for Gitea, which servewaf loads from
|
|
# SWWAF_CORE_RULE_SET_EXCLUSIONS_FILE. servewaf loads this file before the Core
|
|
# Rule Set's rules, so it holds only exclusions made while a request is checked:
|
|
# SecAction and SecRule lines with ctl:ruleRemoveTargetById or
|
|
# ctl:ruleRemoveById. Each switches one rule off for the Gitea fields or paths
|
|
# where it refused ordinary Gitea requests. A SecAction applies on every path, a
|
|
# SecRule on the paths it matches. Gitea sends these in the query string:
|
|
# - q: the text of every search;
|
|
# - file, path, template, body and redirect_to: a file name, alone or in
|
|
# JSON or a link;
|
|
# - name, tag, rule_name and refSubUrl: a branch or tag name.
|
|
# docs/gitea.md says how to add an exclusion.
|
|
|
|
# Searches.
|
|
# 930110: a search for ../
|
|
SecAction "id:10001,phase:1,pass,nolog,ctl:ruleRemoveTargetById=930110;ARGS:q"
|
|
# 931100: a search for http://127.0.0.1:8080
|
|
SecAction "id:10002,phase:1,pass,nolog,ctl:ruleRemoveTargetById=931100;ARGS:q"
|
|
# 932140: a search for if (a == b) {
|
|
SecAction "id:10003,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932140;ARGS:q"
|
|
# 932235: a search for `make check`
|
|
SecAction "id:10004,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932235;ARGS:q"
|
|
# 932250: a search for ls -la
|
|
SecAction "id:10005,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932250;ARGS:q"
|
|
# 932380: a search for `whoami`
|
|
SecAction "id:10006,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932380;ARGS:q"
|
|
# 933100: a search for <?php echo
|
|
SecAction "id:10007,phase:1,pass,nolog,ctl:ruleRemoveTargetById=933100;ARGS:q"
|
|
# 933130: a search for $_GET[
|
|
SecAction "id:10008,phase:1,pass,nolog,ctl:ruleRemoveTargetById=933130;ARGS:q"
|
|
# 933135: a search for ${VAR}
|
|
SecAction "id:10009,phase:1,pass,nolog,ctl:ruleRemoveTargetById=933135;ARGS:q"
|
|
# 934110: a search for http://127.0.0.1:8080
|
|
SecAction "id:10010,phase:1,pass,nolog,ctl:ruleRemoveTargetById=934110;ARGS:q"
|
|
# 941100: a search for <script>
|
|
SecAction "id:10011,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941100;ARGS:q"
|
|
# 941110: a search for <script>, or a page opened from its results
|
|
SecAction "id:10012,phase:1,pass,nolog,\
|
|
ctl:ruleRemoveTargetById=941110;ARGS:q,\
|
|
ctl:ruleRemoveTargetById=941110;REQUEST_HEADERS:Referer"
|
|
# 941120: a page opened from the results of a search for onClick={
|
|
SecAction "id:10013,phase:1,pass,nolog,\
|
|
ctl:ruleRemoveTargetById=941120;REQUEST_HEADERS:Referer"
|
|
# 941160: a search for <img src=, or a page opened from its results
|
|
SecAction "id:10014,phase:1,pass,nolog,\
|
|
ctl:ruleRemoveTargetById=941160;ARGS:q,\
|
|
ctl:ruleRemoveTargetById=941160;REQUEST_HEADERS:Referer"
|
|
# 941390: a search for fetch(
|
|
SecAction "id:10015,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941390;ARGS:q"
|
|
# 942100: a search for SELECT * FROM users WHERE, or a page opened from the
|
|
# results of a search for LIKE '%foo%'
|
|
SecAction "id:10016,phase:1,pass,nolog,\
|
|
ctl:ruleRemoveTargetById=942100;ARGS:q,\
|
|
ctl:ruleRemoveTargetById=942100;REQUEST_HEADERS:Referer"
|
|
# 942190: a search for union select
|
|
SecAction "id:10017,phase:1,pass,nolog,ctl:ruleRemoveTargetById=942190;ARGS:q"
|
|
# 942230: a search for if (a == b) {
|
|
SecAction "id:10018,phase:1,pass,nolog,ctl:ruleRemoveTargetById=942230;ARGS:q"
|
|
# 944100: a search for java.lang.Runtime, or a page opened from its results
|
|
SecAction "id:10019,phase:1,pass,nolog,\
|
|
ctl:ruleRemoveTargetById=944100;ARGS:q,\
|
|
ctl:ruleRemoveTargetById=944100;REQUEST_HEADERS:Referer"
|
|
|
|
# Searches, and file, branch and tag names.
|
|
# 930120: a search for package.json, or the commit graph of .gitignore
|
|
SecAction "id:10020,phase:1,pass,nolog,ctl:ruleRemoveTargetById=930120;\
|
|
ARGS:/^(?:q|file|template|body|refsuburl|name|tag|rule_name)$/"
|
|
# 932160: a search for /bin/sh, or the API's contents of bin/docker-entrypoint
|
|
SecAction "id:10021,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932160;\
|
|
ARGS:/^(?:q|file|template|body|refsuburl|name|tag|rule_name)$/"
|
|
# 932260: a search for python3, or deleting the branch docker-build
|
|
SecAction "id:10022,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932260;\
|
|
ARGS:/^(?:q|file|template|body|refsuburl|name|tag|rule_name)$/"
|
|
|
|
# Searches, and file names in the query string.
|
|
# 932120: a search for Invoke-WebRequest, or the commits of install-script.sh
|
|
SecAction "id:10023,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932120;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 932130: a search for $(pwd), or an issue opened from the template [draft].md
|
|
SecAction "id:10024,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932130;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 934100: a search for process.env, or the commits of process.env.d.ts
|
|
SecAction "id:10025,phase:1,pass,nolog,ctl:ruleRemoveTargetById=934100;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 934130: a search for __proto__, or the commits of __proto__.json
|
|
SecAction "id:10026,phase:1,pass,nolog,ctl:ruleRemoveTargetById=934130;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 941130: the commits of index.xhtml
|
|
SecAction "id:10027,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941130;\
|
|
ARGS:/^(?:file|path|template|body|redirect_to)$/"
|
|
# 941180: a search for document.cookie, or the commits of document.write.js
|
|
SecAction "id:10028,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941180;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 942140: a search for information_schema, or the commits of
|
|
# information_schema.sql
|
|
SecAction "id:10029,phase:1,pass,nolog,ctl:ruleRemoveTargetById=942140;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 944110: a search for java.lang.Runtime, or the commits of Runtime.java
|
|
SecAction "id:10030,phase:1,pass,nolog,ctl:ruleRemoveTargetById=944110;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/"
|
|
# 944130: a search for java.lang.Runtime, the commits of java.lang.String.md,
|
|
# or any page opened from that file's page, which names it in the Referer
|
|
SecAction "id:10031,phase:1,pass,nolog,\
|
|
ctl:ruleRemoveTargetById=944130;\
|
|
ARGS:/^(?:q|file|path|template|body|redirect_to)$/,\
|
|
ctl:ruleRemoveTargetById=944130;REQUEST_HEADERS:Referer"
|
|
|
|
# File names in the path of a file's page, raw file, blame, history and edit
|
|
# page, and of the API's calls for its contents.
|
|
# 920500: the page of notes.txt~
|
|
SecRule REQUEST_FILENAME "@rx ^/(?:api/v1/repos/)?[^/]+/[^/]+/(?:src|raw|media|blame|commits|_edit|_delete|contents)/" \
|
|
"id:10032,phase:1,pass,nolog,ctl:ruleRemoveTargetById=920500;REQUEST_FILENAME"
|
|
# 934100: the page of process.env.d.ts
|
|
SecRule REQUEST_FILENAME "@rx ^/(?:api/v1/repos/)?[^/]+/[^/]+/(?:src|raw|media|blame|commits|_edit|_delete|contents)/" \
|
|
"id:10033,phase:1,pass,nolog,ctl:ruleRemoveTargetById=934100;REQUEST_FILENAME"
|
|
# 941130: the page of docs/a b.xhtml
|
|
SecRule REQUEST_FILENAME "@rx ^/(?:api/v1/repos/)?[^/]+/[^/]+/(?:src|raw|media|blame|commits|_edit|_delete|contents)/" \
|
|
"id:10034,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941130;REQUEST_FILENAME"
|
|
# 944130: the page of java.lang.String.md
|
|
SecRule REQUEST_FILENAME "@rx ^/(?:api/v1/repos/)?[^/]+/[^/]+/(?:src|raw|media|blame|commits|_edit|_delete|contents)/" \
|
|
"id:10035,phase:1,pass,nolog,ctl:ruleRemoveTargetById=944130;REQUEST_FILENAME"
|
|
|
|
# The file name, in name, of an attachment uploaded through the API to a
|
|
# release, an issue or a comment.
|
|
# 932120: the attachment install-script.sh
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10036,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932120;ARGS:name"
|
|
# 934100: the attachment process.env.d.ts
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10037,phase:1,pass,nolog,ctl:ruleRemoveTargetById=934100;ARGS:name"
|
|
# 934130: the attachment __proto__.json
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10038,phase:1,pass,nolog,ctl:ruleRemoveTargetById=934130;ARGS:name"
|
|
# 941130: the attachment index.xhtml
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10039,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941130;ARGS:name"
|
|
# 941180: the attachment document.write.js
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10040,phase:1,pass,nolog,ctl:ruleRemoveTargetById=941180;ARGS:name"
|
|
# 942140: the attachment information_schema.sql
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10041,phase:1,pass,nolog,ctl:ruleRemoveTargetById=942140;ARGS:name"
|
|
# 944130: the attachment java.lang.String.md
|
|
SecRule REQUEST_FILENAME "@rx ^/api/v1/repos/[^/]+/[^/]+/(?:releases|issues|issues/comments)/[0-9]+/assets$" \
|
|
"id:10042,phase:1,pass,nolog,ctl:ruleRemoveTargetById=944130;ARGS:name"
|
|
|
|
# The header Content-Range of an artifact upload.
|
|
# 920450: an artifact upload from actions/upload-artifact@v3
|
|
SecRule REQUEST_FILENAME "@rx ^/api/actions_pipeline/_apis/pipelines/workflows/[0-9]+/artifacts/[^/]+/upload$" \
|
|
"id:10043,phase:1,pass,nolog,ctl:ruleRemoveTargetById=920450;REQUEST_HEADERS_NAMES:Content-Range"
|