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 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 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 { HotspotRatingEnum } from 'design-system';
  21. import { ComponentQualifier } from './component';
  22. import { MessageFormatting } from './issues';
  23. import { FlowLocation, IssueChangelog, IssueChangelogDiff, Paging, TextRange } from './types';
  24. import { UserBase } from './users';
  25. export enum HotspotStatus {
  26. TO_REVIEW = 'TO_REVIEW',
  27. REVIEWED = 'REVIEWED',
  28. }
  29. export enum HotspotResolution {
  30. FIXED = 'FIXED',
  31. SAFE = 'SAFE',
  32. ACKNOWLEDGED = 'ACKNOWLEDGED',
  33. }
  34. export enum HotspotStatusFilter {
  35. FIXED = 'FIXED',
  36. SAFE = 'SAFE',
  37. TO_REVIEW = 'TO_REVIEW',
  38. ACKNOWLEDGED = 'ACKNOWLEDGED',
  39. }
  40. export enum HotspotStatusOption {
  41. FIXED = 'FIXED',
  42. SAFE = 'SAFE',
  43. TO_REVIEW = 'TO_REVIEW',
  44. ACKNOWLEDGED = 'ACKNOWLEDGED',
  45. }
  46. export interface HotspotFilters {
  47. assignedToMe: boolean;
  48. inNewCodePeriod: boolean;
  49. status: HotspotStatusFilter;
  50. }
  51. export interface RawHotspot {
  52. assignee?: string;
  53. author?: string;
  54. component: string;
  55. creationDate: string;
  56. key: string;
  57. line?: number;
  58. message: string;
  59. messageFormattings?: MessageFormatting[];
  60. project: string;
  61. resolution?: HotspotResolution;
  62. rule: string;
  63. securityCategory: string;
  64. status: HotspotStatus;
  65. updateDate: string;
  66. vulnerabilityProbability: HotspotRatingEnum;
  67. flows?: Array<{
  68. locations?: Array<Omit<FlowLocation, 'componentName'>>;
  69. }>;
  70. }
  71. export interface Hotspot {
  72. assignee?: string;
  73. assigneeUser?: UserBase;
  74. author: string;
  75. authorUser: UserBase;
  76. canChangeStatus: boolean;
  77. changelog: IssueChangelog[];
  78. codeVariants?: string[];
  79. comment: HotspotComment[];
  80. component: HotspotComponent;
  81. creationDate: string;
  82. flows: { locations: FlowLocation[] }[];
  83. key: string;
  84. line?: number;
  85. message: string;
  86. messageFormattings?: MessageFormatting[];
  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: HotspotRatingEnum;
  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. }