Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2c80dec

Browse files
authoredJun 8, 2025Β·Β·
Merge pull request #231 from righettod/master
Use LLM to generate web/app server configuration
2 parents ee73679 + 9c034b4 commit 2c80dec

File tree

2 files changed

+17
-38
lines changed

2 files changed

+17
-38
lines changed
 

β€Žci/monitoring_oshp_site_references.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def verify_mention(site_url):
3737
break
3838
# If mention is not detected then try to check if it's an SPA
3939
if oshp_is_mentioned == "NO":
40-
expr = r'(app|index|main)(\.|-)[a-zA-Z0-9]+\.js'
40+
expr = r'(app|index|main)(\.|-)[a-zA-Z0-9_]+\.js'
4141
bundles = re.findall(expr, content)
4242
if len(bundles) > 0 or "React" in content:
4343
oshp_is_mentioned = "SPA"

β€Žtab_codesnippets.md

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tags: headers
1515
* [Test locally a Content-Security-Policy for weaknesses](#test-locally-a-content-security-policy-for-weaknesses)
1616
* [Generate configuration code using the OSHP headers reference files](#generate-configuration-code-using-the-oshp-headers-reference-files)
1717
* [Quickly check security HTTP headers](#quickly-check-security-http-headers)
18-
* [Syntax for adding HTTP response headers on different web servers](#syntax-for-adding-http-response-headers-on-different-web-servers)
18+
* [Syntax for adding HTTP response headers on different web or application servers](#syntax-for-adding-http-response-headers-on-different-web-or-application-servers)
1919

2020
## Convert a Permissions-Policy back to Feature-Policy
2121

@@ -144,44 +144,23 @@ $ venom run --var="target_site=https://mozilla.org" --var="logout_url=/logout" t
144144
[info] The X-XSS-Protection header has been deprecated by modern browsers and its use can introduce additional security issues on the client side.
145145
```
146146
147-
## Syntax for adding HTTP response headers on different web servers
147+
## Syntax for adding HTTP response headers on different web or application servers
148148
149-
### Apache
149+
Use the following steps to leverage an "LLM as a Service" (LLMaaS) to generate corresponding configuration code snippet for the wanted web or application server:
150150
151-
πŸ’» Directive:
151+
1. Download this [file](https://owasp.org/www-project-secure-headers/ci/headers_add.json).
152+
2. Join the json file above to the chat.
153+
3. Use this user prompt in the chat to ask the generation:
152154
153-
`Header always set [HEADER_NAME] [PROPOSED_VALUE]`
154-
155-
🌎 References:
156-
157-
* <https://httpd.apache.org/docs/current/mod/mod_headers.html>
158-
159-
### Nginx
160-
161-
πŸ’» Directive:
162-
163-
`add_header [HEADER_NAME] [PROPOSED_VALUE] always;`
164-
165-
🌎 References:
166-
167-
* <https://nginx.org/en/docs/http/ngx_http_headers_module.html>
168-
169-
### Lighttpd
170-
171-
πŸ’» Directive:
172-
173-
`setenv.add-response-header = ("[HEADER_NAME]" => "[PROPOSED_VALUE]")`
174-
175-
🌎 References:
176-
177-
* <https://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_setenv>
178-
179-
### IIS
180-
181-
πŸ’» Directive:
182-
183-
`<add name="[HEADER_NAME]" value="[PROPOSED_VALUE]" />`
155+
```text
156+
Generate a configuration code snippet to set HTTP response security headers for the '[TARGET_APPLICATION_OR_WEB_SERVER_NAME]'. Use only the information from the json file attached. Only provide the configuration code snippet. The configuration must overwrite any existing value for an HTTP response security header present into the json file attached.
157+
```
184158
185-
🌎 References:
159+
πŸ”¬ The user prompt proposed was tested against [Google GEMINI](https://gemini.google.com/) model **2.5 Flash** and the generated configuration code was submitted to [OpenAI ChatGPT](https://chatgpt.com/) model **ChatGPT** to indicates if it was valid for the intended web or application server. The following value for the `[TARGET_APPLICATION_OR_WEB_SERVER_NAME]` placeholder were used:
186160
187-
* <https://docs.microsoft.com/en-us/iis/configuration/system.webserver/httpprotocol/customheaders>
161+
* `apache web server`.
162+
* `nginx web server`.
163+
* `lighttpd web server`.
164+
* `litespeed web server`
165+
* `caddy web server`
166+
* `iis web server`

0 commit comments

Comments
 (0)
Please sign in to comment.