You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

security-hotspots.ts 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2022 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import { ComponentQualifier } from './component';
  21. import { IssueChangelog, IssueChangelogDiff, Paging, TextRange, UserBase } from './types';
  22. export enum RiskExposure {
  23. LOW = 'LOW',
  24. MEDIUM = 'MEDIUM',
  25. HIGH = 'HIGH'
  26. }
  27. export enum HotspotStatus {
  28. TO_REVIEW = 'TO_REVIEW',
  29. REVIEWED = 'REVIEWED'
  30. }
  31. export enum HotspotResolution {
  32. FIXED = 'FIXED',
  33. SAFE = 'SAFE'
  34. }
  35. export enum HotspotStatusFilter {
  36. FIXED = 'FIXED',
  37. SAFE = 'SAFE',
  38. TO_REVIEW = 'TO_REVIEW'
  39. }
  40. export enum HotspotStatusOption {
  41. FIXED = 'FIXED',
  42. SAFE = 'SAFE',
  43. TO_REVIEW = 'TO_REVIEW'
  44. }
  45. export interface HotspotFilters {
  46. assignedToMe: boolean;
  47. sinceLeakPeriod: boolean;
  48. status: HotspotStatusFilter;
  49. }
  50. export interface RawHotspot {
  51. assignee?: string;
  52. author?: string;
  53. component: string;
  54. creationDate: string;
  55. key: string;
  56. line?: number;
  57. message: string;
  58. project: string;
  59. resolution?: HotspotResolution;
  60. rule: string;
  61. securityCategory: string;
  62. status: HotspotStatus;
  63. subProject?: string;
  64. updateDate: string;
  65. vulnerabilityProbability: RiskExposure;
  66. }
  67. export interface Hotspot {
  68. assignee?: string;
  69. assigneeUser?: UserBase;
  70. author: string;
  71. authorUser: UserBase;
  72. canChangeStatus: boolean;
  73. changelog: IssueChangelog[];
  74. comment: HotspotComment[];
  75. component: HotspotComponent;
  76. creationDate: string;
  77. key: string;
  78. line?: number;
  79. message: string;
  80. project: HotspotComponent;
  81. resolution?: HotspotResolution;
  82. rule: HotspotRule;
  83. status: HotspotStatus;
  84. textRange?: TextRange;
  85. updateDate: string;
  86. users: UserBase[];
  87. }
  88. export interface HotspotComponent {
  89. key: string;
  90. qualifier: ComponentQualifier;
  91. name: string;
  92. longName: string;
  93. path: string;
  94. branch?: string;
  95. pullRequest?: string;
  96. }
  97. export interface HotspotUpdateFields {
  98. status: HotspotStatus;
  99. resolution?: HotspotResolution;
  100. }
  101. export interface HotspotUpdate extends HotspotUpdateFields {
  102. key: string;
  103. }
  104. export interface HotspotRule {
  105. fixRecommendations?: string;
  106. key: string;
  107. name: string;
  108. riskDescription?: string;
  109. securityCategory: string;
  110. vulnerabilityDescription?: string;
  111. vulnerabilityProbability: RiskExposure;
  112. }
  113. export interface HotspotComment {
  114. key: string;
  115. htmlText: string;
  116. markdown: string;
  117. updatable: boolean;
  118. createdAt: string;
  119. login: string;
  120. user: UserBase;
  121. }
  122. export interface ReviewHistoryElement {
  123. type: ReviewHistoryType;
  124. date: string;
  125. user: Pick<UserBase, 'active' | 'avatar' | 'name'>;
  126. diffs?: IssueChangelogDiff[];
  127. html?: string;
  128. key?: string;
  129. updatable?: boolean;
  130. markdown?: string;
  131. }
  132. export enum ReviewHistoryType {
  133. Creation,
  134. Diff,
  135. Comment
  136. }
  137. export interface HotspotSearchResponse {
  138. components?: { key: string; qualifier: string; name: string }[];
  139. hotspots: RawHotspot[];
  140. paging: Paging;
  141. }
  142. export interface HotspotSetStatusRequest {
  143. status: HotspotStatus;
  144. resolution?: HotspotResolution;
  145. comment?: string;
  146. }
  147. export interface HotspotAssignRequest {
  148. assignee?: string;
  149. comment?: string;
  150. }