選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

security-hotspots.ts 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 { FlowLocation, IssueChangelog, IssueChangelogDiff, Paging, TextRange } from './types';
  22. import { UserBase } from './users';
  23. export enum RiskExposure {
  24. LOW = 'LOW',
  25. MEDIUM = 'MEDIUM',
  26. HIGH = 'HIGH'
  27. }
  28. export enum HotspotStatus {
  29. TO_REVIEW = 'TO_REVIEW',
  30. REVIEWED = 'REVIEWED'
  31. }
  32. export enum HotspotResolution {
  33. FIXED = 'FIXED',
  34. SAFE = 'SAFE',
  35. ACKNOWLEDGED = 'ACKNOWLEDGED'
  36. }
  37. export enum HotspotStatusFilter {
  38. FIXED = 'FIXED',
  39. SAFE = 'SAFE',
  40. TO_REVIEW = 'TO_REVIEW',
  41. ACKNOWLEDGED = 'ACKNOWLEDGED'
  42. }
  43. export enum HotspotStatusOption {
  44. FIXED = 'FIXED',
  45. SAFE = 'SAFE',
  46. TO_REVIEW = 'TO_REVIEW',
  47. ACKNOWLEDGED = 'ACKNOWLEDGED'
  48. }
  49. export interface HotspotFilters {
  50. assignedToMe: boolean;
  51. inNewCodePeriod: boolean;
  52. status: HotspotStatusFilter;
  53. }
  54. export interface RawHotspot {
  55. assignee?: string;
  56. author?: string;
  57. component: string;
  58. creationDate: string;
  59. key: string;
  60. line?: number;
  61. message: string;
  62. project: string;
  63. resolution?: HotspotResolution;
  64. rule: string;
  65. securityCategory: string;
  66. status: HotspotStatus;
  67. updateDate: string;
  68. vulnerabilityProbability: RiskExposure;
  69. flows?: Array<{
  70. locations?: Array<Omit<FlowLocation, 'componentName'>>;
  71. }>;
  72. }
  73. export interface Hotspot {
  74. assignee?: string;
  75. assigneeUser?: UserBase;
  76. author: string;
  77. authorUser: UserBase;
  78. canChangeStatus: boolean;
  79. changelog: IssueChangelog[];
  80. comment: HotspotComment[];
  81. component: HotspotComponent;
  82. creationDate: string;
  83. flows: { locations: FlowLocation[] }[];
  84. key: string;
  85. line?: number;
  86. message: string;
  87. project: HotspotComponent;
  88. resolution?: HotspotResolution;
  89. rule: HotspotRule;
  90. status: HotspotStatus;
  91. textRange?: TextRange;
  92. updateDate: string;
  93. users: UserBase[];
  94. }
  95. export interface HotspotComponent {
  96. key: string;
  97. qualifier: ComponentQualifier;
  98. name: string;
  99. longName: string;
  100. path: string;
  101. branch?: string;
  102. pullRequest?: string;
  103. }
  104. export interface HotspotUpdateFields {
  105. status: HotspotStatus;
  106. resolution?: HotspotResolution;
  107. }
  108. export interface HotspotUpdate extends HotspotUpdateFields {
  109. key: string;
  110. }
  111. export interface HotspotRule {
  112. key: string;
  113. name: string;
  114. securityCategory: string;
  115. vulnerabilityProbability: RiskExposure;
  116. }
  117. export interface HotspotComment {
  118. key: string;
  119. htmlText: string;
  120. markdown: string;
  121. updatable: boolean;
  122. createdAt: string;
  123. login: string;
  124. user: UserBase;
  125. }
  126. export interface ReviewHistoryElement {
  127. type: ReviewHistoryType;
  128. date: string;
  129. user: Pick<UserBase, 'active' | 'avatar' | 'name'>;
  130. diffs?: IssueChangelogDiff[];
  131. html?: string;
  132. key?: string;
  133. updatable?: boolean;
  134. markdown?: string;
  135. }
  136. export enum ReviewHistoryType {
  137. Creation,
  138. Diff,
  139. Comment
  140. }
  141. export interface HotspotSearchResponse {
  142. components?: { key: string; qualifier: string; name: string }[];
  143. hotspots: RawHotspot[];
  144. paging: Paging;
  145. }
  146. export interface HotspotSetStatusRequest {
  147. status: HotspotStatus;
  148. resolution?: HotspotResolution;
  149. comment?: string;
  150. }
  151. export interface HotspotAssignRequest {
  152. assignee?: string;
  153. comment?: string;
  154. }