apimatic-semgrep-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +205 -0
  4. data/bin/console +15 -0
  5. data/lib/semgrep_web_app/api_helper.rb +10 -0
  6. data/lib/semgrep_web_app/apis/base_api.rb +67 -0
  7. data/lib/semgrep_web_app/apis/deployments_service_api.rb +29 -0
  8. data/lib/semgrep_web_app/apis/findings_service_api.rb +107 -0
  9. data/lib/semgrep_web_app/apis/misc_service_api.rb +47 -0
  10. data/lib/semgrep_web_app/apis/policies_service_api.rb +97 -0
  11. data/lib/semgrep_web_app/apis/projects_service_api.rb +238 -0
  12. data/lib/semgrep_web_app/apis/scans_service_api.rb +65 -0
  13. data/lib/semgrep_web_app/apis/secrets_service_api.rb +55 -0
  14. data/lib/semgrep_web_app/apis/supply_chain_service_api.rb +154 -0
  15. data/lib/semgrep_web_app/apis/ticketing_service_api.rb +144 -0
  16. data/lib/semgrep_web_app/apis/triage_service_api.rb +43 -0
  17. data/lib/semgrep_web_app/client.rb +136 -0
  18. data/lib/semgrep_web_app/configuration.rb +178 -0
  19. data/lib/semgrep_web_app/exceptions/api_exception.rb +21 -0
  20. data/lib/semgrep_web_app/http/api_response.rb +19 -0
  21. data/lib/semgrep_web_app/http/auth/semgrep_admin_jwt.rb +53 -0
  22. data/lib/semgrep_web_app/http/auth/semgrep_jwt.rb +53 -0
  23. data/lib/semgrep_web_app/http/auth/semgrep_web_token.rb +53 -0
  24. data/lib/semgrep_web_app/http/http_call_back.rb +10 -0
  25. data/lib/semgrep_web_app/http/http_method_enum.rb +10 -0
  26. data/lib/semgrep_web_app/http/http_request.rb +10 -0
  27. data/lib/semgrep_web_app/http/http_response.rb +10 -0
  28. data/lib/semgrep_web_app/http/proxy_settings.rb +22 -0
  29. data/lib/semgrep_web_app/logging/configuration/api_logging_configuration.rb +186 -0
  30. data/lib/semgrep_web_app/logging/sdk_logger.rb +17 -0
  31. data/lib/semgrep_web_app/models/add_project_tags_request.rb +96 -0
  32. data/lib/semgrep_web_app/models/add_project_tags_response.rb +73 -0
  33. data/lib/semgrep_web_app/models/ai_powered_scan_finding.rb +426 -0
  34. data/lib/semgrep_web_app/models/ai_sast_findings.rb +85 -0
  35. data/lib/semgrep_web_app/models/api_v1_deployments_findings_response.rb +87 -0
  36. data/lib/semgrep_web_app/models/assistant.rb +127 -0
  37. data/lib/semgrep_web_app/models/autofix.rb +98 -0
  38. data/lib/semgrep_web_app/models/autotriage.rb +98 -0
  39. data/lib/semgrep_web_app/models/autotriage_verdict.rb +36 -0
  40. data/lib/semgrep_web_app/models/autotriage_verdict2.rb +38 -0
  41. data/lib/semgrep_web_app/models/base_model.rb +110 -0
  42. data/lib/semgrep_web_app/models/bulk_triage_request.rb +393 -0
  43. data/lib/semgrep_web_app/models/bulk_triage_response.rb +83 -0
  44. data/lib/semgrep_web_app/models/click_to_fix_failure.rb +95 -0
  45. data/lib/semgrep_web_app/models/click_to_fix_pr.rb +95 -0
  46. data/lib/semgrep_web_app/models/click_to_fix_pr_state.rb +38 -0
  47. data/lib/semgrep_web_app/models/component.rb +95 -0
  48. data/lib/semgrep_web_app/models/confidence.rb +42 -0
  49. data/lib/semgrep_web_app/models/confidence1.rb +40 -0
  50. data/lib/semgrep_web_app/models/confidence2.rb +40 -0
  51. data/lib/semgrep_web_app/models/confidence3.rb +40 -0
  52. data/lib/semgrep_web_app/models/confidence7.rb +41 -0
  53. data/lib/semgrep_web_app/models/confidence8.rb +42 -0
  54. data/lib/semgrep_web_app/models/create_sbom_export_request.rb +176 -0
  55. data/lib/semgrep_web_app/models/create_sbom_export_response.rb +74 -0
  56. data/lib/semgrep_web_app/models/create_ticket_request.rb +393 -0
  57. data/lib/semgrep_web_app/models/cyclonedx_version.rb +48 -0
  58. data/lib/semgrep_web_app/models/delete_project_response.rb +74 -0
  59. data/lib/semgrep_web_app/models/delete_project_tags_response.rb +73 -0
  60. data/lib/semgrep_web_app/models/deployment.rb +102 -0
  61. data/lib/semgrep_web_app/models/ecosystem.rb +91 -0
  62. data/lib/semgrep_web_app/models/ecosystem1.rb +92 -0
  63. data/lib/semgrep_web_app/models/ecosystem2.rb +76 -0
  64. data/lib/semgrep_web_app/models/endpoint_reference.rb +72 -0
  65. data/lib/semgrep_web_app/models/epss_probability.rb +45 -0
  66. data/lib/semgrep_web_app/models/epss_score.rb +95 -0
  67. data/lib/semgrep_web_app/models/exposures.rb +50 -0
  68. data/lib/semgrep_web_app/models/exposures2.rb +51 -0
  69. data/lib/semgrep_web_app/models/external_ticket.rb +116 -0
  70. data/lib/semgrep_web_app/models/finding_location.rb +126 -0
  71. data/lib/semgrep_web_app/models/finding_repository.rb +95 -0
  72. data/lib/semgrep_web_app/models/finding_rule.rb +158 -0
  73. data/lib/semgrep_web_app/models/fix_recommendation.rb +95 -0
  74. data/lib/semgrep_web_app/models/float_range.rb +85 -0
  75. data/lib/semgrep_web_app/models/format.rb +27 -0
  76. data/lib/semgrep_web_app/models/found_dependency.rb +128 -0
  77. data/lib/semgrep_web_app/models/get_project_response.rb +73 -0
  78. data/lib/semgrep_web_app/models/get_sbom_export_response.rb +100 -0
  79. data/lib/semgrep_web_app/models/guidance.rb +98 -0
  80. data/lib/semgrep_web_app/models/issue_type.rb +40 -0
  81. data/lib/semgrep_web_app/models/issue_type1.rb +40 -0
  82. data/lib/semgrep_web_app/models/issue_type2.rb +42 -0
  83. data/lib/semgrep_web_app/models/license_policy_settings.rb +42 -0
  84. data/lib/semgrep_web_app/models/link_ticket_request.rb +93 -0
  85. data/lib/semgrep_web_app/models/list_dependencies_request.rb +108 -0
  86. data/lib/semgrep_web_app/models/list_dependencies_response.rb +102 -0
  87. data/lib/semgrep_web_app/models/list_findings_response.rb +100 -0
  88. data/lib/semgrep_web_app/models/list_lockfiles_for_dependencies_request.rb +118 -0
  89. data/lib/semgrep_web_app/models/list_lockfiles_for_dependencies_response.rb +103 -0
  90. data/lib/semgrep_web_app/models/list_project.rb +145 -0
  91. data/lib/semgrep_web_app/models/list_projects_response.rb +82 -0
  92. data/lib/semgrep_web_app/models/list_repositories_for_dependencies_request.rb +107 -0
  93. data/lib/semgrep_web_app/models/list_repositories_for_dependencies_response.rb +103 -0
  94. data/lib/semgrep_web_app/models/managed_scan_config.rb +85 -0
  95. data/lib/semgrep_web_app/models/metadata_component_type.rb +101 -0
  96. data/lib/semgrep_web_app/models/mode.rb +48 -0
  97. data/lib/semgrep_web_app/models/new_triage_reason.rb +48 -0
  98. data/lib/semgrep_web_app/models/new_triage_state.rb +48 -0
  99. data/lib/semgrep_web_app/models/policy.rb +118 -0
  100. data/lib/semgrep_web_app/models/policy_mode.rb +48 -0
  101. data/lib/semgrep_web_app/models/policy_mode1.rb +40 -0
  102. data/lib/semgrep_web_app/models/policy_mode3.rb +51 -0
  103. data/lib/semgrep_web_app/models/policy_reference.rb +105 -0
  104. data/lib/semgrep_web_app/models/product_type.rb +38 -0
  105. data/lib/semgrep_web_app/models/products.rb +46 -0
  106. data/lib/semgrep_web_app/models/project.rb +157 -0
  107. data/lib/semgrep_web_app/models/protos_ai_v1_autotriage.rb +154 -0
  108. data/lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb +98 -0
  109. data/lib/semgrep_web_app/models/protos_common_v1_review_comment.rb +90 -0
  110. data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response.rb +123 -0
  111. data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response_ticket_creation_failed.rb +85 -0
  112. data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response_ticket_creation_skipped.rb +85 -0
  113. data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response_ticket_creation_success.rb +106 -0
  114. data/lib/semgrep_web_app/models/protos_openapi_v1_delete_ticket_response.rb +76 -0
  115. data/lib/semgrep_web_app/models/protos_openapi_v1_diff_scan.rb +75 -0
  116. data/lib/semgrep_web_app/models/protos_openapi_v1_full_scan.rb +75 -0
  117. data/lib/semgrep_web_app/models/protos_openapi_v1_get_bootstrap_sms_vpc_response.rb +130 -0
  118. data/lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb +168 -0
  119. data/lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb +256 -0
  120. data/lib/semgrep_web_app/models/protos_openapi_v1_link_ticket_response.rb +119 -0
  121. data/lib/semgrep_web_app/models/protos_openapi_v1_list_deployments_response.rb +85 -0
  122. data/lib/semgrep_web_app/models/protos_openapi_v1_list_policies_response.rb +84 -0
  123. data/lib/semgrep_web_app/models/protos_openapi_v1_list_policy_rules_response.rb +104 -0
  124. data/lib/semgrep_web_app/models/protos_openapi_v1_list_secrets_path_response.rb +104 -0
  125. data/lib/semgrep_web_app/models/protos_openapi_v1_search_scans_response.rb +94 -0
  126. data/lib/semgrep_web_app/models/protos_openapi_v1_unlink_ticket_response.rb +77 -0
  127. data/lib/semgrep_web_app/models/protos_openapi_v1_update_policy_response.rb +88 -0
  128. data/lib/semgrep_web_app/models/protos_sca_v1_code_location.rb +144 -0
  129. data/lib/semgrep_web_app/models/protos_sca_v1_dependency.rb +87 -0
  130. data/lib/semgrep_web_app/models/protos_sca_v1_dependency_filter.rb +199 -0
  131. data/lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb +174 -0
  132. data/lib/semgrep_web_app/models/protos_sca_v1_lockfile_dependency_summary.rb +87 -0
  133. data/lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb +124 -0
  134. data/lib/semgrep_web_app/models/protos_sca_v1_repository_dependency_summary.rb +111 -0
  135. data/lib/semgrep_web_app/models/protos_sca_v1_sbom_format_version.rb +109 -0
  136. data/lib/semgrep_web_app/models/protos_sca_v1_sbom_metadata_contact.rb +95 -0
  137. data/lib/semgrep_web_app/models/protos_sca_v1_sbom_metadata_supplier.rb +95 -0
  138. data/lib/semgrep_web_app/models/protos_scan_v1_scan_findings_counts.rb +105 -0
  139. data/lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb +228 -0
  140. data/lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb +116 -0
  141. data/lib/semgrep_web_app/models/protos_secrets_v1_secrets_finding.rb +320 -0
  142. data/lib/semgrep_web_app/models/protos_secrets_v1_secrets_finding_repository.rb +121 -0
  143. data/lib/semgrep_web_app/models/protos_ticketing_v1_external_ticket.rb +106 -0
  144. data/lib/semgrep_web_app/models/rating.rb +38 -0
  145. data/lib/semgrep_web_app/models/reachability.rb +48 -0
  146. data/lib/semgrep_web_app/models/repository_visibility.rb +40 -0
  147. data/lib/semgrep_web_app/models/review_comment.rb +100 -0
  148. data/lib/semgrep_web_app/models/risk.rb +40 -0
  149. data/lib/semgrep_web_app/models/rule.rb +292 -0
  150. data/lib/semgrep_web_app/models/rule_explanation.rb +98 -0
  151. data/lib/semgrep_web_app/models/sast_finding.rb +426 -0
  152. data/lib/semgrep_web_app/models/sast_findings.rb +84 -0
  153. data/lib/semgrep_web_app/models/sbom_output_format.rb +37 -0
  154. data/lib/semgrep_web_app/models/sca_finding.rb +458 -0
  155. data/lib/semgrep_web_app/models/sca_findings.rb +85 -0
  156. data/lib/semgrep_web_app/models/scm_type.rb +70 -0
  157. data/lib/semgrep_web_app/models/search_scans_request.rb +202 -0
  158. data/lib/semgrep_web_app/models/severities.rb +44 -0
  159. data/lib/semgrep_web_app/models/severities2.rb +45 -0
  160. data/lib/semgrep_web_app/models/severity.rb +46 -0
  161. data/lib/semgrep_web_app/models/severity1.rb +45 -0
  162. data/lib/semgrep_web_app/models/severity4.rb +46 -0
  163. data/lib/semgrep_web_app/models/severity5.rb +48 -0
  164. data/lib/semgrep_web_app/models/source.rb +42 -0
  165. data/lib/semgrep_web_app/models/state.rb +42 -0
  166. data/lib/semgrep_web_app/models/status.rb +55 -0
  167. data/lib/semgrep_web_app/models/status1.rb +52 -0
  168. data/lib/semgrep_web_app/models/status3.rb +44 -0
  169. data/lib/semgrep_web_app/models/status6.rb +55 -0
  170. data/lib/semgrep_web_app/models/status7.rb +59 -0
  171. data/lib/semgrep_web_app/models/status8.rb +61 -0
  172. data/lib/semgrep_web_app/models/status9.rb +55 -0
  173. data/lib/semgrep_web_app/models/statuses.rb +63 -0
  174. data/lib/semgrep_web_app/models/toggle_project_managed_scan_request.rb +108 -0
  175. data/lib/semgrep_web_app/models/toggle_project_managed_scan_response.rb +73 -0
  176. data/lib/semgrep_web_app/models/transitivities.rb +40 -0
  177. data/lib/semgrep_web_app/models/transitivities2.rb +42 -0
  178. data/lib/semgrep_web_app/models/transitivity.rb +41 -0
  179. data/lib/semgrep_web_app/models/transitivity1.rb +42 -0
  180. data/lib/semgrep_web_app/models/transitivity2.rb +40 -0
  181. data/lib/semgrep_web_app/models/triage_reason.rb +48 -0
  182. data/lib/semgrep_web_app/models/triage_reasons.rb +48 -0
  183. data/lib/semgrep_web_app/models/triage_reasons2.rb +50 -0
  184. data/lib/semgrep_web_app/models/triage_state.rb +54 -0
  185. data/lib/semgrep_web_app/models/unlink_ticket_request.rb +83 -0
  186. data/lib/semgrep_web_app/models/update_policy_request.rb +113 -0
  187. data/lib/semgrep_web_app/models/update_project_request.rb +121 -0
  188. data/lib/semgrep_web_app/models/update_project_response.rb +73 -0
  189. data/lib/semgrep_web_app/models/usage.rb +99 -0
  190. data/lib/semgrep_web_app/models/validation_state.rb +45 -0
  191. data/lib/semgrep_web_app/models/validation_state2.rb +47 -0
  192. data/lib/semgrep_web_app/models/validation_state3.rb +48 -0
  193. data/lib/semgrep_web_app/models/verdict.rb +41 -0
  194. data/lib/semgrep_web_app/models/verdict1.rb +38 -0
  195. data/lib/semgrep_web_app/models/visibility.rb +42 -0
  196. data/lib/semgrep_web_app/utilities/date_time_helper.rb +11 -0
  197. data/lib/semgrep_web_app/utilities/file_wrapper.rb +28 -0
  198. data/lib/semgrep_web_app/utilities/union_type_lookup.rb +34 -0
  199. data/lib/semgrep_web_app.rb +245 -0
  200. metadata +283 -0
@@ -0,0 +1,38 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SemgrepWebApp
7
+ # | value | description | |-------|---------------| | RATING_GOOD | Autotriage
8
+ # rated positively by a user. | | RATING_BAD | Autotriage rated negatively by
9
+ # a user. |
10
+ class Rating
11
+ RATING = [
12
+ # TODO: Write general description for RATING_GOOD
13
+ RATING_GOOD = 'RATING_GOOD'.freeze,
14
+
15
+ # TODO: Write general description for RATING_BAD
16
+ RATING_BAD = 'RATING_BAD'.freeze
17
+ ].freeze
18
+
19
+ def self.validate(value)
20
+ return false if value.nil?
21
+
22
+ RATING.include?(value)
23
+ end
24
+
25
+ def self.from_value(value, default_value = RATING_GOOD)
26
+ return default_value if value.nil?
27
+
28
+ str = value.to_s.strip
29
+
30
+ case str.downcase
31
+ when 'rating_good' then RATING_GOOD
32
+ when 'rating_bad' then RATING_BAD
33
+ else
34
+ default_value
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,48 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SemgrepWebApp
7
+ # Indicates whether the vulnerable code is reachable
8
+ class Reachability
9
+ REACHABILITY = [
10
+ # TODO: Write general description for ENUM_NO_REACHABILITY_ANALYSIS
11
+ ENUM_NO_REACHABILITY_ANALYSIS = 'no reachability analysis'.freeze,
12
+
13
+ # TODO: Write general description for REACHABLE
14
+ REACHABLE = 'reachable'.freeze,
15
+
16
+ # TODO: Write general description for ENUM_ALWAYS_REACHABLE
17
+ ENUM_ALWAYS_REACHABLE = 'always reachable'.freeze,
18
+
19
+ # TODO: Write general description for ENUM_CONDITIONALLY_REACHABLE
20
+ ENUM_CONDITIONALLY_REACHABLE = 'conditionally reachable'.freeze,
21
+
22
+ # TODO: Write general description for UNREACHABLE
23
+ UNREACHABLE = 'unreachable'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ REACHABILITY.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = ENUM_NO_REACHABILITY_ANALYSIS)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'enum_no_reachability_analysis' then ENUM_NO_REACHABILITY_ANALYSIS
39
+ when 'reachable' then REACHABLE
40
+ when 'enum_always_reachable' then ENUM_ALWAYS_REACHABLE
41
+ when 'enum_conditionally_reachable' then ENUM_CONDITIONALLY_REACHABLE
42
+ when 'unreachable' then UNREACHABLE
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,40 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SemgrepWebApp
7
+ # Filter by repository visibility. Only applies for secrets findings.
8
+ class RepositoryVisibility
9
+ REPOSITORY_VISIBILITY = [
10
+ # TODO: Write general description for PUBLIC
11
+ PUBLIC = 'public'.freeze,
12
+
13
+ # TODO: Write general description for PRIVATE
14
+ PRIVATE = 'private'.freeze,
15
+
16
+ # TODO: Write general description for UNKNOWN
17
+ UNKNOWN = 'unknown'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ REPOSITORY_VISIBILITY.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = PUBLIC)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'public' then PUBLIC
33
+ when 'private' then PRIVATE
34
+ when 'unknown' then UNKNOWN
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,100 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SemgrepWebApp
7
+ # External review comment information associated with a finding
8
+ class ReviewComment < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # External ID of the review comment or discussion thread
13
+ # @return [String]
14
+ attr_accessor :external_discussion_id
15
+
16
+ # External ID of the specific note in the review comment discussion thread.
17
+ # Only applicable for GitLab.com, GitLab Self-Managed and Azure DevOps
18
+ # @return [String]
19
+ attr_accessor :external_note_id
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['external_discussion_id'] = 'external_discussion_id'
25
+ @_hash['external_note_id'] = 'external_note_id'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ external_discussion_id
33
+ external_note_id
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(external_discussion_id: SKIP, external_note_id: SKIP,
43
+ additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @external_discussion_id = external_discussion_id unless external_discussion_id == SKIP
48
+ @external_note_id = external_note_id unless external_note_id == SKIP
49
+ @additional_properties = additional_properties
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ external_discussion_id =
58
+ hash.key?('external_discussion_id') ? hash['external_discussion_id'] : SKIP
59
+ external_note_id =
60
+ hash.key?('external_note_id') ? hash['external_note_id'] : SKIP
61
+
62
+ # Create a new hash for additional properties, removing known properties.
63
+ new_hash = hash.reject { |k, _| names.value?(k) }
64
+
65
+ additional_properties = APIHelper.get_additional_properties(
66
+ new_hash, proc { |value| value }
67
+ )
68
+
69
+ # Create object from extracted values.
70
+ ReviewComment.new(external_discussion_id: external_discussion_id,
71
+ external_note_id: external_note_id,
72
+ additional_properties: additional_properties)
73
+ end
74
+
75
+ # Validates an instance of the object from a given value.
76
+ # @param [ReviewComment | Hash] The value against the validation is performed.
77
+ def self.validate(value)
78
+ return true if value.instance_of? self
79
+
80
+ return false unless value.instance_of? Hash
81
+
82
+ true
83
+ end
84
+
85
+ # Provides a human-readable string representation of the object.
86
+ def to_s
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} external_discussion_id: #{@external_discussion_id}, external_note_id:"\
89
+ " #{@external_note_id}, additional_properties: #{@additional_properties}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} external_discussion_id: #{@external_discussion_id.inspect},"\
96
+ " external_note_id: #{@external_note_id.inspect}, additional_properties:"\
97
+ " #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,40 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SemgrepWebApp
7
+ # Component risk level
8
+ class Risk
9
+ RISK = [
10
+ # TODO: Write general description for HIGH
11
+ HIGH = 'high'.freeze,
12
+
13
+ # TODO: Write general description for LOW
14
+ LOW = 'low'.freeze,
15
+
16
+ # TODO: Write general description for NEUTRAL
17
+ NEUTRAL = 'neutral'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ RISK.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = HIGH)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'high' then HIGH
33
+ when 'low' then LOW
34
+ when 'neutral' then NEUTRAL
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,292 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module SemgrepWebApp
8
+ # Rule Model.
9
+ class Rule < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Category the Rule is associated with.
14
+ # @return [String]
15
+ attr_accessor :category
16
+
17
+ # Confidence based on the Rule's false-positive rate.
18
+ # | value | description |
19
+ # |-------|---------------|
20
+ # | CONFIDENCE_HIGH | |
21
+ # | CONFIDENCE_MEDIUM | |
22
+ # | CONFIDENCE_LOW | |
23
+ # @return [Confidence]
24
+ attr_accessor :confidence
25
+
26
+ # The CWE associated with the Rule.
27
+ # @return [Array[String]]
28
+ attr_accessor :cwe_categories
29
+
30
+ # When True, the secrets rule has validators.
31
+ # @return [TrueClass | FalseClass]
32
+ attr_accessor :has_validators
33
+
34
+ # ID of the Rule.
35
+ # @return [String]
36
+ attr_accessor :id
37
+
38
+ # Languages the Rule applies to.
39
+ # @return [Array[String]]
40
+ attr_accessor :languages
41
+
42
+ # Timestamp of when the Rule was last changed.
43
+ # @return [DateTime]
44
+ attr_accessor :last_change_at
45
+
46
+ # Username of who last changed the Rule.
47
+ # @return [String]
48
+ attr_accessor :last_change_by
49
+
50
+ # Owasp categories the Rule is associated with.
51
+ # @return [Array[String]]
52
+ attr_accessor :owasp_categories
53
+
54
+ # Full path of the Rule.
55
+ # @return [String]
56
+ attr_accessor :path
57
+
58
+ # Mode behavior: Monitor / Comment / Block / Disabled
59
+ # | value | description |
60
+ # |-------|---------------|
61
+ # | MODE_MONITOR | Monitor mode, silently report findings |
62
+ # | MODE_COMMENT | Comment mode, leaves PR comments but does not block |
63
+ # | MODE_BLOCK | Block mode, leaves PR comments and blocks PR |
64
+ # | MODE_DISABLED | Disabled mode, not active |
65
+ # @return [PolicyMode]
66
+ attr_accessor :policy_mode
67
+
68
+ # The Registry maintainer associated with the Rule (if applicable).
69
+ # @return [String]
70
+ attr_accessor :registry_maintainer
71
+
72
+ # Rulesets to which the Rule belongs (if applicable).
73
+ # @return [Array[String]]
74
+ attr_accessor :rulesets
75
+
76
+ # The secret type (if applicable).
77
+ # @return [String]
78
+ attr_accessor :secret_type
79
+
80
+ # Severity level ("seriousness" of the finding)
81
+ # | value | description |
82
+ # |-------|---------------|
83
+ # | SEVERITY_HIGH | |
84
+ # | SEVERITY_MEDIUM | |
85
+ # | SEVERITY_LOW | |
86
+ # | SEVERITY_CRITICAL | |
87
+ # @return [Severity]
88
+ attr_accessor :severity
89
+
90
+ # Source of the Rule
91
+ # | value | description |
92
+ # |-------|---------------|
93
+ # | SOURCE_PRO | From Pro rules |
94
+ # | SOURCE_COMMUNITY | From Semgrep Community rules |
95
+ # | SOURCE_CUSTOM | From Custom rules |
96
+ # @return [Source]
97
+ attr_accessor :source
98
+
99
+ # Technologies the Rule is associated with.
100
+ # @return [Array[String]]
101
+ attr_accessor :technologies
102
+
103
+ # The URL of the Rule.
104
+ # @return [String]
105
+ attr_accessor :url
106
+
107
+ # Vulnerability classes the Rule is associated with.
108
+ # @return [Array[String]]
109
+ attr_accessor :vulnerability_class
110
+
111
+ # A mapping from model property names to API property names.
112
+ def self.names
113
+ @_hash = {} if @_hash.nil?
114
+ @_hash['category'] = 'category'
115
+ @_hash['confidence'] = 'confidence'
116
+ @_hash['cwe_categories'] = 'cweCategories'
117
+ @_hash['has_validators'] = 'hasValidators'
118
+ @_hash['id'] = 'id'
119
+ @_hash['languages'] = 'languages'
120
+ @_hash['last_change_at'] = 'lastChangeAt'
121
+ @_hash['last_change_by'] = 'lastChangeBy'
122
+ @_hash['owasp_categories'] = 'owaspCategories'
123
+ @_hash['path'] = 'path'
124
+ @_hash['policy_mode'] = 'policyMode'
125
+ @_hash['registry_maintainer'] = 'registryMaintainer'
126
+ @_hash['rulesets'] = 'rulesets'
127
+ @_hash['secret_type'] = 'secretType'
128
+ @_hash['severity'] = 'severity'
129
+ @_hash['source'] = 'source'
130
+ @_hash['technologies'] = 'technologies'
131
+ @_hash['url'] = 'url'
132
+ @_hash['vulnerability_class'] = 'vulnerabilityClass'
133
+ @_hash
134
+ end
135
+
136
+ # An array for optional fields
137
+ def self.optionals
138
+ %w[
139
+ category
140
+ confidence
141
+ cwe_categories
142
+ has_validators
143
+ id
144
+ languages
145
+ last_change_at
146
+ last_change_by
147
+ owasp_categories
148
+ path
149
+ policy_mode
150
+ registry_maintainer
151
+ rulesets
152
+ secret_type
153
+ severity
154
+ source
155
+ technologies
156
+ url
157
+ vulnerability_class
158
+ ]
159
+ end
160
+
161
+ # An array for nullable fields
162
+ def self.nullables
163
+ []
164
+ end
165
+
166
+ def initialize(category: SKIP, confidence: SKIP, cwe_categories: SKIP,
167
+ has_validators: SKIP, id: SKIP, languages: SKIP,
168
+ last_change_at: SKIP, last_change_by: SKIP,
169
+ owasp_categories: SKIP, path: SKIP, policy_mode: SKIP,
170
+ registry_maintainer: SKIP, rulesets: SKIP, secret_type: SKIP,
171
+ severity: SKIP, source: SKIP, technologies: SKIP, url: SKIP,
172
+ vulnerability_class: SKIP, additional_properties: nil)
173
+ # Add additional model properties to the instance
174
+ additional_properties = {} if additional_properties.nil?
175
+
176
+ @category = category unless category == SKIP
177
+ @confidence = confidence unless confidence == SKIP
178
+ @cwe_categories = cwe_categories unless cwe_categories == SKIP
179
+ @has_validators = has_validators unless has_validators == SKIP
180
+ @id = id unless id == SKIP
181
+ @languages = languages unless languages == SKIP
182
+ @last_change_at = last_change_at unless last_change_at == SKIP
183
+ @last_change_by = last_change_by unless last_change_by == SKIP
184
+ @owasp_categories = owasp_categories unless owasp_categories == SKIP
185
+ @path = path unless path == SKIP
186
+ @policy_mode = policy_mode unless policy_mode == SKIP
187
+ @registry_maintainer = registry_maintainer unless registry_maintainer == SKIP
188
+ @rulesets = rulesets unless rulesets == SKIP
189
+ @secret_type = secret_type unless secret_type == SKIP
190
+ @severity = severity unless severity == SKIP
191
+ @source = source unless source == SKIP
192
+ @technologies = technologies unless technologies == SKIP
193
+ @url = url unless url == SKIP
194
+ @vulnerability_class = vulnerability_class unless vulnerability_class == SKIP
195
+ @additional_properties = additional_properties
196
+ end
197
+
198
+ # Creates an instance of the object from a hash.
199
+ def self.from_hash(hash)
200
+ return nil unless hash
201
+
202
+ # Extract variables from the hash.
203
+ category = hash.key?('category') ? hash['category'] : SKIP
204
+ confidence = hash.key?('confidence') ? hash['confidence'] : SKIP
205
+ cwe_categories = hash.key?('cweCategories') ? hash['cweCategories'] : SKIP
206
+ has_validators = hash.key?('hasValidators') ? hash['hasValidators'] : SKIP
207
+ id = hash.key?('id') ? hash['id'] : SKIP
208
+ languages = hash.key?('languages') ? hash['languages'] : SKIP
209
+ last_change_at = if hash.key?('lastChangeAt')
210
+ (DateTimeHelper.from_rfc3339(hash['lastChangeAt']) if hash['lastChangeAt'])
211
+ else
212
+ SKIP
213
+ end
214
+ last_change_by = hash.key?('lastChangeBy') ? hash['lastChangeBy'] : SKIP
215
+ owasp_categories =
216
+ hash.key?('owaspCategories') ? hash['owaspCategories'] : SKIP
217
+ path = hash.key?('path') ? hash['path'] : SKIP
218
+ policy_mode = hash.key?('policyMode') ? hash['policyMode'] : SKIP
219
+ registry_maintainer =
220
+ hash.key?('registryMaintainer') ? hash['registryMaintainer'] : SKIP
221
+ rulesets = hash.key?('rulesets') ? hash['rulesets'] : SKIP
222
+ secret_type = hash.key?('secretType') ? hash['secretType'] : SKIP
223
+ severity = hash.key?('severity') ? hash['severity'] : SKIP
224
+ source = hash.key?('source') ? hash['source'] : SKIP
225
+ technologies = hash.key?('technologies') ? hash['technologies'] : SKIP
226
+ url = hash.key?('url') ? hash['url'] : SKIP
227
+ vulnerability_class =
228
+ hash.key?('vulnerabilityClass') ? hash['vulnerabilityClass'] : SKIP
229
+
230
+ # Create a new hash for additional properties, removing known properties.
231
+ new_hash = hash.reject { |k, _| names.value?(k) }
232
+
233
+ additional_properties = APIHelper.get_additional_properties(
234
+ new_hash, proc { |value| value }
235
+ )
236
+
237
+ # Create object from extracted values.
238
+ Rule.new(category: category,
239
+ confidence: confidence,
240
+ cwe_categories: cwe_categories,
241
+ has_validators: has_validators,
242
+ id: id,
243
+ languages: languages,
244
+ last_change_at: last_change_at,
245
+ last_change_by: last_change_by,
246
+ owasp_categories: owasp_categories,
247
+ path: path,
248
+ policy_mode: policy_mode,
249
+ registry_maintainer: registry_maintainer,
250
+ rulesets: rulesets,
251
+ secret_type: secret_type,
252
+ severity: severity,
253
+ source: source,
254
+ technologies: technologies,
255
+ url: url,
256
+ vulnerability_class: vulnerability_class,
257
+ additional_properties: additional_properties)
258
+ end
259
+
260
+ def to_custom_last_change_at
261
+ DateTimeHelper.to_rfc3339(last_change_at)
262
+ end
263
+
264
+ # Provides a human-readable string representation of the object.
265
+ def to_s
266
+ class_name = self.class.name.split('::').last
267
+ "<#{class_name} category: #{@category}, confidence: #{@confidence}, cwe_categories:"\
268
+ " #{@cwe_categories}, has_validators: #{@has_validators}, id: #{@id}, languages:"\
269
+ " #{@languages}, last_change_at: #{@last_change_at}, last_change_by: #{@last_change_by},"\
270
+ " owasp_categories: #{@owasp_categories}, path: #{@path}, policy_mode: #{@policy_mode},"\
271
+ " registry_maintainer: #{@registry_maintainer}, rulesets: #{@rulesets}, secret_type:"\
272
+ " #{@secret_type}, severity: #{@severity}, source: #{@source}, technologies:"\
273
+ " #{@technologies}, url: #{@url}, vulnerability_class: #{@vulnerability_class},"\
274
+ " additional_properties: #{@additional_properties}>"
275
+ end
276
+
277
+ # Provides a debugging-friendly string with detailed object information.
278
+ def inspect
279
+ class_name = self.class.name.split('::').last
280
+ "<#{class_name} category: #{@category.inspect}, confidence: #{@confidence.inspect},"\
281
+ " cwe_categories: #{@cwe_categories.inspect}, has_validators: #{@has_validators.inspect},"\
282
+ " id: #{@id.inspect}, languages: #{@languages.inspect}, last_change_at:"\
283
+ " #{@last_change_at.inspect}, last_change_by: #{@last_change_by.inspect}, owasp_categories:"\
284
+ " #{@owasp_categories.inspect}, path: #{@path.inspect}, policy_mode:"\
285
+ " #{@policy_mode.inspect}, registry_maintainer: #{@registry_maintainer.inspect}, rulesets:"\
286
+ " #{@rulesets.inspect}, secret_type: #{@secret_type.inspect}, severity:"\
287
+ " #{@severity.inspect}, source: #{@source.inspect}, technologies: #{@technologies.inspect},"\
288
+ " url: #{@url.inspect}, vulnerability_class: #{@vulnerability_class.inspect},"\
289
+ " additional_properties: #{@additional_properties}>"
290
+ end
291
+ end
292
+ end
@@ -0,0 +1,98 @@
1
+ # semgrep_web_app
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SemgrepWebApp
7
+ # AI-generated explanation of why a rule flagged this specific code
8
+ class RuleExplanation < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Detailed explanation of why this rule flagged the code, including context
13
+ # about the security issue and why it applies to this specific code. AI
14
+ # generated content, review carefully
15
+ # @return [String]
16
+ attr_accessor :explanation
17
+
18
+ # A concise summary of the rule explanation. May not be present for all
19
+ # findings
20
+ # @return [String]
21
+ attr_accessor :summary
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['explanation'] = 'explanation'
27
+ @_hash['summary'] = 'summary'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def self.optionals
33
+ %w[
34
+ explanation
35
+ summary
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(explanation: SKIP, summary: SKIP, additional_properties: nil)
45
+ # Add additional model properties to the instance
46
+ additional_properties = {} if additional_properties.nil?
47
+
48
+ @explanation = explanation unless explanation == SKIP
49
+ @summary = summary unless summary == SKIP
50
+ @additional_properties = additional_properties
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ explanation = hash.key?('explanation') ? hash['explanation'] : SKIP
59
+ summary = hash.key?('summary') ? hash['summary'] : SKIP
60
+
61
+ # Create a new hash for additional properties, removing known properties.
62
+ new_hash = hash.reject { |k, _| names.value?(k) }
63
+
64
+ additional_properties = APIHelper.get_additional_properties(
65
+ new_hash, proc { |value| value }
66
+ )
67
+
68
+ # Create object from extracted values.
69
+ RuleExplanation.new(explanation: explanation,
70
+ summary: summary,
71
+ additional_properties: additional_properties)
72
+ end
73
+
74
+ # Validates an instance of the object from a given value.
75
+ # @param [RuleExplanation | Hash] The value against the validation is performed.
76
+ def self.validate(value)
77
+ return true if value.instance_of? self
78
+
79
+ return false unless value.instance_of? Hash
80
+
81
+ true
82
+ end
83
+
84
+ # Provides a human-readable string representation of the object.
85
+ def to_s
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} explanation: #{@explanation}, summary: #{@summary}, additional_properties:"\
88
+ " #{@additional_properties}>"
89
+ end
90
+
91
+ # Provides a debugging-friendly string with detailed object information.
92
+ def inspect
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} explanation: #{@explanation.inspect}, summary: #{@summary.inspect},"\
95
+ " additional_properties: #{@additional_properties}>"
96
+ end
97
+ end
98
+ end