[CORL-1126] Run regex in a sandbox so it can time out (#2988)

* Run regex in a sandbox so it can time out

If it times out, we flag it and system withhold
it for future analysis.

CORL-1126

* Pass regex and test string into wordList sandbox

Allows us to use the pre-cached regex instead of
regenerating it via an in-line script copy.

CORL-1126

* feat: improve script reuse

* fix: renamed some functions

* fix: improve script performance

* feat: added testString to log output if it times out

* fix: fixed issue with form alert not showing

* fix: use a timeout from config

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
This commit is contained in:
Nick Funk
2020-06-12 18:09:37 +00:00
committed by GitHub
co-authored by Wyatt Johnson Wyatt Johnson
parent ebe7731222
commit feaf4858df
5 changed files with 140 additions and 32 deletions
@@ -163,7 +163,14 @@ export class PostCommentFormContainer extends Component<Props, State> {
state,
form
) => {
if (this.state.submitStatus && state.dirty) {
if (
this.state.submitStatus &&
state.dirty &&
// This is required because the body is somehow being "dirtied" once the
// form has been reinitialized.
// FIXME: (wyattjoh) discover why when a comment is submitted, it eventually sets this as the body afterwards
state.values.body !== "<div><br></div>"
) {
this.setState({ submitStatus: null });
}
if (state.values.body) {