Skip to content

Abort response when path doesn't start with slash#5205

Merged
jaydoane merged 1 commit intomainfrom
shutdown-invalid-path
Aug 26, 2024
Merged

Abort response when path doesn't start with slash#5205
jaydoane merged 1 commit intomainfrom
shutdown-invalid-path

Conversation

@jaydoane
Copy link
Contributor

@jaydoane jaydoane commented Aug 25, 2024

Overview

Currently a path that doesn't begin with a / causes a no match error and crash. This can fill up logs with unwanted junk, and be generally annoying.

2024-08-23 17:54:26.603 08/23 17:54:26.603 somehost db13  -              CRASH REPORT Process  (<0.19262.7388>) with 0 neighbors crashed with reason: no match of right hand value {"..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\windows\\win.ini",[],[]} at chttpd:handle_request_int/1(line:239) <= mochiweb_http:headers/6(line:140) <= proc_lib:init_p_do_apply/3(line:240); initial_call: {mochiweb_acceptor,init,['Argument__1','Argument__2',...]}, ancestors: [chttpd,chttpd_sup,<0.1261.0>], message_queue_len: 0, links: [<0.1450.0>,#Port<0.891112>], dictionary: [{couch_rewrite_count,0}], trap_exit: false, status: running, heap_size: 610, stack_size: 28, reductions: 3198

This adds a check for path validity, and exits with a shutdown if the path is invalid.

Testing recommendations

make eunit apps=chttpd suites=chttpd_invalid_path_test

Related Issues or Pull Requests

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • Documentation changes were made in the src/docs folder
  • Documentation changes were backported (separated PR) to affected branches

@jaydoane jaydoane force-pushed the shutdown-invalid-path branch from b4f396b to 19c3b04 Compare August 26, 2024 03:41
@jaydoane jaydoane marked this pull request as ready for review August 26, 2024 04:43
@jaydoane jaydoane force-pushed the shutdown-invalid-path branch from 078c42d to 0a323a8 Compare August 26, 2024 16:38
Currently a path that doesn't begin with a `/` causes a no match error
and crash. This can fill up logs with unwanted junk, and be generally
annoying.

```
2024-08-23 17:54:26.603 08/23 17:54:26.603 somehost db13  -              CRASH REPORT Process  (<0.19262.7388>) with 0 neighbors crashed with reason: no match of right hand value {"..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\windows\\win.ini",[],[]} at chttpd:handle_request_int/1(line:239) <= mochiweb_http:headers/6(line:140) <= proc_lib:init_p_do_apply/3(line:240); initial_call: {mochiweb_acceptor,init,['Argument__1','Argument__2',...]}, ancestors: [chttpd,chttpd_sup,<0.1261.0>], message_queue_len: 0, links: [<0.1450.0>,#Port<0.891112>], dictionary: [{couch_rewrite_count,0}], trap_exit: false, status: running, heap_size: 610, stack_size: 28, reductions: 3198

```

This adds a check for path validity, and exits with a shutdown if the
path is invalid.
@jaydoane jaydoane force-pushed the shutdown-invalid-path branch from 0a323a8 to 093cb19 Compare August 26, 2024 17:28
@jaydoane jaydoane merged commit c29a8d6 into main Aug 26, 2024
@jaydoane jaydoane deleted the shutdown-invalid-path branch August 26, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants