z-schema 12.0.4 → 12.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/z-schema CHANGED
@@ -131,7 +131,12 @@ function validateWithAutomaticDownloads(filePath, data, schema, callback) {
131
131
  console.error('Requests to private/internal addresses are not allowed: ' + url);
132
132
  process.exit(1);
133
133
  }
134
- request(parsedUrl, function (response) {
134
+ request(parsedUrl, { maxRedirects: 0 }, function (response) {
135
+ // Reject redirects to prevent SSRF via open redirect (CWE-918)
136
+ if (response.statusCode >= 300 && response.statusCode < 400) {
137
+ console.error('Redirects are not followed for security reasons: ' + url);
138
+ process.exit(1);
139
+ }
135
140
  var body = '';
136
141
  response.on('data', function (chunk) {
137
142
  body += chunk;