Solved oauth2 bugs and deactivated health-csp role temporary

This commit is contained in:
2025-05-13 14:34:16 +02:00
parent 687f9b0703
commit dc4964eda1
14 changed files with 38 additions and 82 deletions

View File

@@ -31,7 +31,7 @@ Set the following variables to customize behavior:
```yaml
health_csp_crawler_folder: "{{ path_administrator_scripts }}health-csp/"
on_calendar_health_csp_crawler: "daily"
````
```
## License

View File

@@ -1,43 +0,0 @@
const puppeteer = require('puppeteer');
const domains = process.argv.slice(2);
(async () => {
let errorCounter = 0;
const browser = await puppeteer.launch({ headless: 'new' });
for (const domain of domains) {
const page = await browser.newPage();
const blockedResources = [];
page.on('requestfailed', request => {
const reason = request.failure()?.errorText || '';
if (reason.includes('blocked')) {
blockedResources.push({ url: request.url(), reason });
}
});
try {
const url = `https://${domain}`;
await page.goto(url, { waitUntil: 'networkidle2', timeout: 20000 });
} catch (e) {
console.error(`${domain}: ERROR visiting site - ${e.message}`);
errorCounter++;
continue;
}
if (blockedResources.length > 0) {
console.warn(`${domain}: Blocked resources detected:`);
blockedResources.forEach(r =>
console.log(` BLOCKED by CSP: ${r.url} (${r.reason})`)
);
errorCounter++;
} else {
console.log(`${domain}: ✅ No CSP blocks detected.`);
}
await page.close();
}
await browser.close();
process.exit(errorCounter);
})();

View File

@@ -32,7 +32,7 @@ def run_node_checker(script_path, domains):
"""
try:
result = subprocess.run(
["/usr/bin/node", script_path] + domains,
["node", script_path] + domains,
check=True
)
return result.returncode

View File

@@ -17,9 +17,9 @@
register: puppeteer_check
failed_when: puppeteer_check.rc != 0
- name: copy health_csp.py
- name: copy health-csp.py
copy:
src: health_csp.py
src: health-csp.py
dest: "{{ health_csp_crawler_script }}"
mode: 0755

View File

@@ -1,3 +1,3 @@
health_csp_crawler_folder: "{{ path_administrator_scripts }}health-csp/"
health_csp_crawler_script: "{{ health_csp_crawler_folder }}health_csp.py"
health_csp_crawler_script: "{{ health_csp_crawler_folder }}health-csp.py"
health_csp_crawler_node: "{{ health_csp_crawler_folder }}health-csp.js"