codeant-cli 0.4.4 → 0.4.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeant-cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Code review CLI tool",
5
5
  "type": "module",
6
6
  "bin": {
@@ -82,6 +82,7 @@ export async function runReviewHeadless(options = {}) {
82
82
  lastNCommits = 1,
83
83
  baseBranch = null,
84
84
  baseCommit = null,
85
+ selectedCommits = [],
85
86
  onProgress = () => {},
86
87
  onFilesReady = () => {},
87
88
  } = options;
@@ -108,7 +109,7 @@ export async function runReviewHeadless(options = {}) {
108
109
  const helper = new ReviewApiHelper(workspacePath);
109
110
  await helper.init();
110
111
  const gitRoot = helper.getGitRoot() || workspacePath;
111
- const requestBody = await helper.buildReviewApiRequest(scanType, include, exclude, { lastNCommits, baseBranch, baseCommit });
112
+ const requestBody = await helper.buildReviewApiRequest(scanType, include, exclude, { lastNCommits, baseBranch, baseCommit, selectedCommits });
112
113
 
113
114
  const meta = requestBody?._meta || null;
114
115
  delete requestBody._meta;
@@ -1173,6 +1173,11 @@ id = "generic-api-key"
1173
1173
  description = "Detected a Generic API Key, potentially exposing access to various services and sensitive operations."
1174
1174
  regex = '''(?i)[\w.-]{0,50}?(?:access|auth|(?-i:[Aa]pi|API)|credential|creds|key|passw(?:or)?d|secret|token)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([\w.=-]{10,150}|[a-z0-9][a-z0-9+/]{11,}={0,3})(?:\\?['"\x60]|[\s;]|\\[nr]|$)'''
1175
1175
  entropy = 3.5
1176
+ # secretGroup = 1: the regex captures the actual secret value in group 1.
1177
+ # Without this, the full match (including variable names, commas, spaces) is
1178
+ # treated as the "secret", causing allowlist checks like ^[a-zA-Z_.-]+$ to fail
1179
+ # on import/destructuring lines (e.g. "from config import STRIPE_API_KEY, SECRET").
1180
+ secretGroup = 1
1176
1181
  keywords = [
1177
1182
  "access",
1178
1183
  "api",
@@ -60,6 +60,19 @@ class CommonApiHelper {
60
60
  return this._transformDiffsToApiFormat(diffs);
61
61
  }
62
62
 
63
+ /**
64
+ * Get specific selected commits formatted for the API
65
+ * @param {string[]} commits - Array of commit hashes to include
66
+ */
67
+ async getSelectCommitsFilesForApi(commits = []) {
68
+ const diffs = await this.gitHelper.getDiffBasedOnReviewConfig({
69
+ type: 'select-commits',
70
+ commits,
71
+ });
72
+
73
+ return this._transformDiffsToApiFormat(diffs);
74
+ }
75
+
63
76
  /**
64
77
  * Transform diff info array to API format
65
78
  * Must be implemented by subclasses
@@ -126,6 +139,8 @@ class CommonApiHelper {
126
139
  return await this.getLastCommitFilesForApi();
127
140
  case 'last-n-commits':
128
141
  return await this.getLastNCommitsFilesForApi(options.lastNCommits || 1);
142
+ case 'select-commits':
143
+ return await this.getSelectCommitsFilesForApi(options.selectedCommits || []);
129
144
  case 'base-branch':
130
145
  return await this.getBaseBranchDiffForApi(options.baseBranch);
131
146
  case 'base-commit':