tcell_agent 0.2.19 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE_libinjection +32 -0
  3. data/Rakefile +14 -1
  4. data/ext/libinjection/extconf.rb +3 -0
  5. data/ext/libinjection/libinjection.h +65 -0
  6. data/ext/libinjection/libinjection_html5.c +847 -0
  7. data/ext/libinjection/libinjection_html5.h +54 -0
  8. data/ext/libinjection/libinjection_sqli.c +2317 -0
  9. data/ext/libinjection/libinjection_sqli.h +295 -0
  10. data/ext/libinjection/libinjection_sqli_data.h +9004 -0
  11. data/ext/libinjection/libinjection_wrap.c +3525 -0
  12. data/ext/libinjection/libinjection_xss.c +531 -0
  13. data/ext/libinjection/libinjection_xss.h +21 -0
  14. data/lib/tcell_agent/configuration.rb +0 -48
  15. data/lib/tcell_agent/logger.rb +1 -0
  16. data/lib/tcell_agent/policies/appsensor/database_sensor.rb +8 -20
  17. data/lib/tcell_agent/policies/appsensor/injection_sensor.rb +30 -46
  18. data/lib/tcell_agent/policies/appsensor/login_sensor.rb +1 -4
  19. data/lib/tcell_agent/policies/appsensor/misc_sensor.rb +8 -22
  20. data/lib/tcell_agent/policies/appsensor/payloads_policy.rb +143 -0
  21. data/lib/tcell_agent/policies/appsensor/response_codes_sensor.rb +3 -1
  22. data/lib/tcell_agent/policies/appsensor/sensor.rb +21 -2
  23. data/lib/tcell_agent/policies/appsensor/size_sensor.rb +3 -1
  24. data/lib/tcell_agent/policies/appsensor/sqli_sensor.rb +9 -0
  25. data/lib/tcell_agent/policies/appsensor/user_agent_sensor.rb +1 -5
  26. data/lib/tcell_agent/policies/appsensor/xss_sensor.rb +9 -1
  27. data/lib/tcell_agent/policies/appsensor_policy.rb +40 -19
  28. data/lib/tcell_agent/policies/http_redirect_policy.rb +12 -2
  29. data/lib/tcell_agent/rails/csrf_exception.rb +1 -1
  30. data/lib/tcell_agent/rails/dlp.rb +98 -76
  31. data/lib/tcell_agent/rails/middleware/global_middleware.rb +1 -2
  32. data/lib/tcell_agent/rails/middleware/headers_middleware.rb +2 -2
  33. data/lib/tcell_agent/rails/on_start.rb +53 -20
  34. data/lib/tcell_agent/sensor_events/appsensor_event.rb +12 -19
  35. data/lib/tcell_agent/sensor_events/appsensor_meta_event.rb +7 -2
  36. data/lib/tcell_agent/sensor_events/sensor.rb +10 -11
  37. data/lib/tcell_agent/sensor_events/server_agent.rb +17 -12
  38. data/lib/tcell_agent/sensor_events/util/sanitizer_utilities.rb +148 -139
  39. data/lib/tcell_agent/utils/params.rb +24 -21
  40. data/lib/tcell_agent/version.rb +1 -1
  41. data/spec/lib/tcell_agent/configuration_spec.rb +0 -179
  42. data/spec/lib/tcell_agent/policies/appsensor/database_sensor_spec.rb +6 -4
  43. data/spec/lib/tcell_agent/policies/appsensor/misc_sensor_spec.rb +31 -22
  44. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_apply_spec.rb +466 -0
  45. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_from_json_spec.rb +890 -0
  46. data/spec/lib/tcell_agent/policies/appsensor/payloads_policy_log_spec.rb +484 -0
  47. data/spec/lib/tcell_agent/policies/appsensor/request_size_sensor_spec.rb +4 -3
  48. data/spec/lib/tcell_agent/policies/appsensor/response_codes_sensor_spec.rb +4 -4
  49. data/spec/lib/tcell_agent/policies/appsensor/response_size_sensor_spec.rb +1 -1
  50. data/spec/lib/tcell_agent/policies/appsensor/sqli_sensor_spec.rb +85 -0
  51. data/spec/lib/tcell_agent/policies/appsensor/user_agent_sensor_spec.rb +36 -16
  52. data/spec/lib/tcell_agent/policies/appsensor/xss_sensor_spec.rb +188 -312
  53. data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +61 -0
  54. data/spec/lib/tcell_agent/rails/middleware/appsensor_middleware_spec.rb +18 -11
  55. data/spec/lib/tcell_agent/rails/middleware/redirect_middleware_spec.rb +14 -15
  56. data/spec/lib/tcell_agent/sensor_events/appsensor_meta_event_spec.rb +1 -1
  57. data/spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb +6 -5
  58. data/spec/lib/tcell_agent/utils/params_spec.rb +28 -108
  59. data/tcell_agent.gemspec +21 -1
  60. metadata +37 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b4ab2290db14be2d14b65edc01f36145e73da02
4
- data.tar.gz: 35f0e04cbc8b20703cc3f5a41b77875d859e9e0c
3
+ metadata.gz: 94acb227285ba44cdff883596610b0a1acfa7a44
4
+ data.tar.gz: 3434e3c09598e19d4913c23fa7241fd28ae71316
5
5
  SHA512:
6
- metadata.gz: 41fa1edda89b1cefe0ec2d6501a465077a21960fdb4fcd776fd0dc99d71507fc59159503ce98640421cd5882640173a75665f66b10ba88f754a8d3630126729f
7
- data.tar.gz: 194f427b4cb851e4434f27584e612c06aa0f16188ced64481fbf196ffc58c0d6e80e7c744cdc658f520fc6fb61320d8204150c19f94c0ff84f5321fee6dc64ea
6
+ metadata.gz: 511965665332196c8d0c5715057251fcad8eeee5118d0e8a6626d14ef031d4c2861d2875e50aac1380c010cd9d110cff95632b19abe7362440ff91fff8b67c88
7
+ data.tar.gz: 7a551c6c4b09f6a1fc4c59c07b9275aadb3ad44c9de109b19b5d8ee5bd322fa6029d7f1f81f127d5c29fe81f91a05c758c84a31666051d776fa85fd069b2e97c
@@ -0,0 +1,32 @@
1
+ Copyright (c) 2012-2016, Nick Galbreath
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ https://github.com/client9/libinjection
32
+ http://opensource.org/licenses/BSD-3-Clause
data/Rakefile CHANGED
@@ -1,11 +1,24 @@
1
+ require 'rake/clean'
2
+ require 'rake/extensiontask'
1
3
  require 'rspec/core/rake_task'
2
4
 
5
+ CLEAN.include('ext/**/*{.o,.log,.so,.bundle}')
6
+ CLEAN.include('ext/**/Makefile')
7
+ CLOBBER.include('lib/*{.so,.bundle}')
8
+
9
+ Rake::ExtensionTask.new("libinjection") do |ext|
10
+ ext.lib_dir = File.join("lib", "libinjection")
11
+ end
12
+
13
+ task :default => [:compile, :spec]
14
+
3
15
  RSpec::Core::RakeTask.new(:spec)
4
16
 
5
17
  desc "Run tests"
6
- task :default => :spec
7
18
  task :test => :spec
8
19
 
20
+ Rake::Task[:test].prerequisites << :compile
21
+
9
22
  task "init-integration-tests" do
10
23
  system("docker-compose run railsintegration224 bundle install")
11
24
  system("docker-compose run railsintegration224 bundle exec rake db:create db:setup")
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile("libinjection/libinjection")
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Copyright 2012-2016 Nick Galbreath
3
+ * nickg@client9.com
4
+ * BSD License -- see COPYING.txt for details
5
+ *
6
+ * https://libinjection.client9.com/
7
+ *
8
+ */
9
+
10
+ #ifndef LIBINJECTION_H
11
+ #define LIBINJECTION_H
12
+
13
+ #ifdef __cplusplus
14
+ # define LIBINJECTION_BEGIN_DECLS extern "C" {
15
+ # define LIBINJECTION_END_DECLS }
16
+ #else
17
+ # define LIBINJECTION_BEGIN_DECLS
18
+ # define LIBINJECTION_END_DECLS
19
+ #endif
20
+
21
+ LIBINJECTION_BEGIN_DECLS
22
+
23
+ /*
24
+ * Pull in size_t
25
+ */
26
+ #include <string.h>
27
+
28
+ /*
29
+ * Version info.
30
+ *
31
+ * This is moved into a function to allow SWIG and other auto-generated
32
+ * binding to not be modified during minor release changes. We change
33
+ * change the version number in the c source file, and not regenerated
34
+ * the binding
35
+ *
36
+ * See python's normalized version
37
+ * http://www.python.org/dev/peps/pep-0386/#normalizedversion
38
+ */
39
+ const char* libinjection_version(void);
40
+
41
+ /**
42
+ * Simple API for SQLi detection - returns a SQLi fingerprint or NULL
43
+ * is benign input
44
+ *
45
+ * \param[in] s input string, may contain nulls, does not need to be null-terminated
46
+ * \param[in] slen input string length
47
+ * \param[out] fingerprint buffer of 8+ characters. c-string,
48
+ * \return 1 if SQLi, 0 if benign. fingerprint will be set or set to empty string.
49
+ */
50
+ int libinjection_sqli(const char* s, size_t slen, char fingerprint[]);
51
+
52
+ /** ALPHA version of xss detector.
53
+ *
54
+ * NOT DONE.
55
+ *
56
+ * \param[in] s input string, may contain nulls, does not need to be null-terminated
57
+ * \param[in] slen input string length
58
+ * \return 1 if XSS found, 0 if benign
59
+ *
60
+ */
61
+ int libinjection_xss(const char* s, size_t slen);
62
+
63
+ LIBINJECTION_END_DECLS
64
+
65
+ #endif /* LIBINJECTION_H */