Skip to content

Commit 55d8657

Browse files
authored
Merge pull request #292 from jorgearma/fix/security-txt-fake-negatives
fix: check all security.txt paths before returning isPresent false
2 parents 5578b72 + 795d41f commit 55d8657

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

api/security-txt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const securityTxtHandler = async (urlParam) => {
5353
for (let path of SECURITY_TXT_PATHS) {
5454
try {
5555
const result = await fetchSecurityTxt(url, path);
56-
if (result && result.includes('<html')) return { isPresent: false };
56+
if (result && result.includes('<html')) continue;
5757
if (result) {
5858
return {
5959
isPresent: true,
@@ -74,7 +74,7 @@ const securityTxtHandler = async (urlParam) => {
7474
async function fetchSecurityTxt(baseURL, path) {
7575
return new Promise((resolve, reject) => {
7676
const url = new URL(path, baseURL);
77-
https.get(url.toString(), (res) => {
77+
https.get(url.toString(), { headers: { 'User-Agent': 'curl/8.0.0' } }, (res) => {
7878
if (res.statusCode === 200) {
7979
let data = '';
8080
res.on('data', (chunk) => {

0 commit comments

Comments
 (0)