-
Notifications
You must be signed in to change notification settings - Fork 345
Detect missing header vulnerabilities #3269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Overall package sizeSelf size: 4.89 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report
@@ Coverage Diff @@
## master #3269 +/- ##
==========================================
+ Coverage 84.15% 84.24% +0.09%
==========================================
Files 211 214 +3
Lines 8336 8393 +57
Branches 33 33
==========================================
+ Hits 7015 7071 +56
- Misses 1321 1322 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
BenchmarksBenchmark execution time: 2023-07-17 07:01:35 Comparing candidate commit 24b41c0 in PR branch Found 0 performance improvements and 3 performance regressions! Performance is the same for 471 metrics, 18 unstable metrics. scenario:plugin-graphql-with-depth-and-collapse-off-18
scenario:plugin-graphql-with-depth-off-18
scenario:plugin-graphql-with-depth-on-max-18
|
f8cd75d
to
fc9da75
Compare
fc9da75
to
0cb164a
Compare
super(HSTS_HEADER_MISSING, HSTS_HEADER_NAME) | ||
} | ||
_validateRequestAndResponse (req, res) { | ||
const headerToCheck = res.getHeader(HSTS_HEADER_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uurien you did not include the validation for MaxAge you need to obtain max-age (if not then it the same case as not having header) and then compare it not to be equal to -1 or 0
int i = ivalue.indexOf(MAX_AGE);
if (i != -1) {
d.existHeader = true;
int j = ivalue.indexOf('=', i);
if (j != -1) {
int k = ivalue.indexOf(';', j);
if (k != -1) {
d.cause = ivalue.substring(j + 1, k);
}
else {
d.cause = ivalue.substring(j + 1);
}
}
else {
d.cause = "-1";
}
}
public boolean isOk() {
return existHeader && !"-1".equals(cause) && !"0".equals(cause);
}
5a8a8dd
to
223e114
Compare
packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js
Show resolved
Hide resolved
385287d
to
6010dab
Compare
6010dab
to
24b41c0
Compare
* Detect X-Content-Type-Options missing header * HSTS Header missing analyzer and refactor of xcontenttype-header-missing-aanalyzer * Move function to class method * use startswith instead of index===0 * Do not send evidence if value is undefined * Fix comment in PR and add test * Changes to support telemetry * Rename method name * Rename analyzer object key
* Detect X-Content-Type-Options missing header * HSTS Header missing analyzer and refactor of xcontenttype-header-missing-aanalyzer * Move function to class method * use startswith instead of index===0 * Do not send evidence if value is undefined * Fix comment in PR and add test * Changes to support telemetry * Rename method name * Rename analyzer object key
* Detect X-Content-Type-Options missing header * HSTS Header missing analyzer and refactor of xcontenttype-header-missing-aanalyzer * Move function to class method * use startswith instead of index===0 * Do not send evidence if value is undefined * Fix comment in PR and add test * Changes to support telemetry * Rename method name * Rename analyzer object key
* Detect X-Content-Type-Options missing header * HSTS Header missing analyzer and refactor of xcontenttype-header-missing-aanalyzer * Move function to class method * use startswith instead of index===0 * Do not send evidence if value is undefined * Fix comment in PR and add test * Changes to support telemetry * Rename method name * Rename analyzer object key
* Detect X-Content-Type-Options missing header * HSTS Header missing analyzer and refactor of xcontenttype-header-missing-aanalyzer * Move function to class method * use startswith instead of index===0 * Do not send evidence if value is undefined * Fix comment in PR and add test * Changes to support telemetry * Rename method name * Rename analyzer object key
* Detect X-Content-Type-Options missing header * HSTS Header missing analyzer and refactor of xcontenttype-header-missing-aanalyzer * Move function to class method * use startswith instead of index===0 * Do not send evidence if value is undefined * Fix comment in PR and add test * Changes to support telemetry * Rename method name * Rename analyzer object key
What does this PR do?
Reports a vulnreability when it detects that the response don't have
X-Content-Type-Options
orStrict-Transport-Security
in html content.Strict-Transport-Security
is checked only when the library knows that the response is https, checking the protocol orX-Forwarded-Proto
header.Checklist