-
Notifications
You must be signed in to change notification settings - Fork 85
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
H-3134: Apply ESLint autofixes #4745
Conversation
try { | ||
({ operationName } = JSON.parse(options.body)); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console -- TODO: consider using logger | ||
console.error(err); | ||
} catch (error) { | ||
console.error(error); | ||
} |
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.
Error messages with stack traces may expose sensitive information about the application.
Ignore this finding from generic_error_disclosure.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.
Where removing comments, there will be cases when we want to ensure that manually added notes/todos (e.g. consideration for using a logger) are persisted.
// eslint-disable-next-line no-console -- TODO: consider using logger | ||
console.error(err); | ||
} catch (error) { | ||
console.error(error); | ||
} |
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.
Error messages with stack traces may expose sensitive information about the application.
Ignore this finding from generic_error_disclosure.@@ -71,7 +77,6 @@ export const generateEntityLabel = ( | |||
|
|||
entityType = entityTypeAndAncestors[0]; | |||
} catch (error) { | |||
// eslint-disable-next-line no-console -- prefer not to crash here but still have some feedback that there's an issue | |||
console.error( | |||
`Error looking for entity type and ancestors in provided subgraph: ${ | |||
(error as Error).message |
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.
Error messages with stack traces may expose sensitive information about the application.
Ignore this finding from generic_error_disclosure.
|
||
return () => window.removeEventListener("message", msgHandler); | ||
window.addEventListener("message", messageHandler); |
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.
No validation of origin is done by the addEventListener API. It may be possible to exploit this flaw to perform Cross Origin attacks such as Cross-Site Scripting(XSS).
Ignore this finding from insufficient-postmessage-origin-validation.} | ||
} | ||
request.send(conf.body ?? null); | ||
request.send(config.body ?? null); | ||
}), | ||
{ | ||
abort() { |
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.
Depending on the context, user control data in Object.assign
can cause web response to include data that it should not have or can lead to a mass assignment vulnerability.
View Dataflow Graph
flowchart LR
classDef invis fill:white, stroke: none
classDef default fill:#e7f5ff, color:#1c7fd6, stroke: none
subgraph File0["<b>apps/hash-frontend/src/pages/shared/block-collection/collab/http.ts</b>"]
direction LR
%% Source
subgraph Source
direction LR
v0["<a href=https://github.com/hashintel/hash/blob/56b6061ed2cd662197c1442071258c0501aa60bf/apps/hash-frontend/src/pages/shared/block-collection/collab/http.ts#L72 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 72] config.headers</a>"]
end
%% Intermediate
%% Sink
subgraph Sink
direction LR
v1["<a href=https://github.com/hashintel/hash/blob/56b6061ed2cd662197c1442071258c0501aa60bf/apps/hash-frontend/src/pages/shared/block-collection/collab/http.ts#L37 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 37] Object.assign(<br> new Promise<string>((resolve, reject) => {<br> request.open(config.method, config.url, true);<br> request.withCredentials = true;<br> request.addEventListener("load", () => {<br> if (aborted) {<br> return;<br> }<br> if (request.status < 400) {<br> finished = true;<br> resolve(request.responseText);<br> } else {<br> let text = request.responseText;<br><br> if (<br> text &&<br> (request.getResponseHeader("content-type") ?? "").includes("html")<br> ) {<br> text = makePlain(text);<br> }<br> const error = new StatusError(<br> request.status,<br> `Request failed: ${request.statusText}${text ? `\n\n${text}` : ""}`,<br> );<br><br> finished = true;<br> reject(error);<br> }<br> });<br> request.addEventListener("error", () => {<br> if (!aborted) {<br> finished = true;<br> reject(new Error("Network error"));<br> }<br> });<br> if (config.headers) {<br> for (const header of Object.keys(config.headers)) {<br> request.setRequestHeader(header, config.headers[header]!);<br> }<br> }<br> request.send(config.body ?? null);<br> }),<br> {<br> abort() {<br> if (!aborted && !finished) {<br> request.abort();<br> onAbort?.();<br> aborted = true;<br> }<br> },<br> },<br> )</a>"]
end
end
%% Class Assignment
Source:::invis
Sink:::invis
File0:::invis
%% Connections
Source --> Sink
Benchmark results
|
Function | Value | Mean | Flame graphs |
---|---|---|---|
link_by_source_by_property | depths: DT=255, PT=255, ET=255, E=255 | Flame Graph | |
link_by_source_by_property | depths: DT=0, PT=2, ET=2, E=2 | Flame Graph | |
link_by_source_by_property | depths: DT=2, PT=2, ET=2, E=2 | Flame Graph | |
link_by_source_by_property | depths: DT=0, PT=0, ET=0, E=0 | Flame Graph | |
link_by_source_by_property | depths: DT=0, PT=0, ET=2, E=2 | Flame Graph | |
link_by_source_by_property | depths: DT=0, PT=0, ET=0, E=2 | Flame Graph | |
entity_by_property | depths: DT=255, PT=255, ET=255, E=255 | Flame Graph | |
entity_by_property | depths: DT=0, PT=2, ET=2, E=2 | Flame Graph | |
entity_by_property | depths: DT=2, PT=2, ET=2, E=2 | Flame Graph | |
entity_by_property | depths: DT=0, PT=0, ET=0, E=0 | Flame Graph | |
entity_by_property | depths: DT=0, PT=0, ET=2, E=2 | Flame Graph | |
entity_by_property | depths: DT=0, PT=0, ET=0, E=2 | Flame Graph |
scaling_read_entity_linkless
Function | Value | Mean | Flame graphs |
---|---|---|---|
entity_by_id | 100 entities | Flame Graph | |
entity_by_id | 10 entities | Flame Graph | |
entity_by_id | 1 entities | Flame Graph | |
entity_by_id | 1000 entities | Flame Graph | |
entity_by_id | 10000 entities | Flame Graph |
representative_read_entity_type
Function | Value | Mean | Flame graphs |
---|---|---|---|
get_entity_type_by_id | Account ID: d4e16033-c281-4cde-aa35-9085bf2e7579
|
Flame Graph |
scaling_read_entity_complete_one_depth
Function | Value | Mean | Flame graphs |
---|---|---|---|
entity_by_id | 25 entities | Flame Graph | |
entity_by_id | 5 entities | Flame Graph | |
entity_by_id | 50 entities | Flame Graph | |
entity_by_id | 10 entities | Flame Graph | |
entity_by_id | 1 entities | Flame Graph |
scaling_read_entity_complete_zero_depth
Function | Value | Mean | Flame graphs |
---|---|---|---|
entity_by_id | 25 entities | Flame Graph | |
entity_by_id | 5 entities | Flame Graph | |
entity_by_id | 50 entities | Flame Graph | |
entity_by_id | 10 entities | Flame Graph | |
entity_by_id | 1 entities | Flame Graph |
representative_read_entity
Function | Value | Mean | Flame graphs |
---|---|---|---|
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1
|
Flame Graph | |
entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1
|
Flame Graph |
Closing following internal discussion. |
🌟 What is the purpose of this PR?
This PR adds a new ESLint configuration, which is more encompassing and stricter than the previous one.
This is the second PR, building on top of #4232, and applies all auto fixes. The next PRs will focus on different subpackages to remove the remaining errors.
Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
turbo.json
's have been updated to reflect this