Skip to content

Commit ca0fef0

Browse files
authored
Merge pull request #7310 from continuedev/dallin/prevent-file-reads-fixes
fix: cleanup file security pr
2 parents bdb393a + 3853124 commit ca0fef0

File tree

8 files changed

+10
-49
lines changed

8 files changed

+10
-49
lines changed

core/context/providers/FileContextProvider.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ class FileContextProvider extends BaseContextProvider {
3737
await extras.ide.getWorkspaceDirs(),
3838
);
3939

40-
if (isSecurityConcern(relativePathOrBasename)) {
41-
return [
42-
{
43-
description: last2Parts,
44-
content:
45-
"Content redacted, this file cannot be viewed for security reasons",
46-
name: baseName,
47-
uri: {
48-
type: "file",
49-
value: fileUri,
50-
},
51-
},
52-
];
53-
}
54-
5540
return [
5641
{
5742
name: baseName,

core/context/providers/ProblemsContextProvider.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ class ProblemsContextProvider extends BaseContextProvider {
2929
problem.filepath,
3030
workspaceDirs,
3131
);
32-
if (isSecurityConcern(relativePathOrBasename)) {
33-
return {
34-
description: "Problems in current file",
35-
content:
36-
"Content was redacted because the file is detected as a potential security concern",
37-
name: `Warnings in ${baseName}`,
38-
};
39-
}
4032
const content = await ide.readFile(problem.filepath);
4133
const lines = content.split("\n");
4234
const rangeContent = lines

core/indexing/ignore.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ export const DEFAULT_SECURITY_IGNORE_DIRS = [
6767
// Environment and configuration directories
6868
".env/",
6969
"env/",
70-
".venv/",
71-
"venv/",
72-
73-
// IDE directories that may contain cached credentials
74-
// For now excluding, reasons for this unclear
75-
// ".vscode/",
76-
// ".idea/",
77-
// ".vs/",
7870

7971
// Cloud provider credential directories
8072
".aws/",
@@ -168,6 +160,8 @@ export const ADDITIONAL_INDEXING_IGNORE_FILETYPES = [
168160
"*.swp",
169161
"*.jsonl",
170162
// "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt
163+
// Application specific
164+
".continue/",
171165
];
172166

173167
export const ADDITIONAL_INDEXING_IGNORE_DIRS = [
@@ -189,6 +183,13 @@ export const ADDITIONAL_INDEXING_IGNORE_DIRS = [
189183
".cache/",
190184
"gems/",
191185
"vendor/",
186+
187+
".venv/",
188+
"venv/",
189+
190+
".vscode/",
191+
".idea/",
192+
".vs/",
192193
];
193194

194195
// Combined patterns: security + additional

core/indexing/ignore.vitest.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,7 @@ describe("isSecurityConcern", () => {
8181
it("should detect environment directories as security concerns", () => {
8282
expect(isSecurityConcern(".env/")).toBe(true);
8383
expect(isSecurityConcern("env/")).toBe(true);
84-
expect(isSecurityConcern(".venv/")).toBe(true);
85-
expect(isSecurityConcern("venv/")).toBe(true);
8684
expect(isSecurityConcern(".env/config")).toBe(true);
87-
expect(isSecurityConcern("project/.venv/lib")).toBe(true);
88-
});
89-
90-
it("should detect IDE directories as security concerns", () => {
91-
// expect(isSecurityConcern(".vscode/")).toBe(true);
92-
// expect(isSecurityConcern(".idea/")).toBe(true);
93-
// expect(isSecurityConcern(".vs/")).toBe(true);
94-
expect(isSecurityConcern(".vscode/settings.json")).toBe(true);
95-
// expect(isSecurityConcern(".idea/workspace.xml")).toBe(true);
9685
});
9786

9887
it("should detect cloud provider directories as security concerns", () => {

extensions/cli/package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"swr": "^2.3.4",
8484
"turndown": "^7.2.0",
8585
"typescript": "^5.8.3",
86-
"uri-js": "^4.4.1",
8786
"uuid": "^9.0.1",
8887
"winston": "^3.17.0",
8988
"yaml": "^2.8.0"

extensions/cli/src/tools/searchAndReplace/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as fs from "fs";
22

3-
import { throwIfFileIsSecurityConcern } from "core/indexing/ignore.js";
4-
53
import { telemetryService } from "../../telemetry/telemetryService.js";
64
import {
75
calculateLinesOfCodeDiff,
@@ -97,7 +95,7 @@ Each string in the diffs array can contain multiple SEARCH/REPLACE blocks, and a
9795
preprocess: async (args) => {
9896
// Get and validate args
9997
const { filepath, diffs } = parseSearchAndReplaceArgs(args);
100-
throwIfFileIsSecurityConcern(filepath);
98+
10199
// Get current file contents
102100
if (!fs.existsSync(filepath)) {
103101
throw new Error(`file ${filepath} does not exist`);

extensions/cli/src/ui/UserInput.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type AssistantConfig } from "@continuedev/sdk";
2-
import { throwIfFileIsSecurityConcern } from "core/indexing/ignore.js";
32
import { Box, Text, useApp, useInput } from "ink";
43
import React, { useCallback, useState } from "react";
54

@@ -255,7 +254,6 @@ const UserInput: React.FC<UserInputProps> = ({
255254
// Read the file content and notify parent component
256255
if (onFileAttached) {
257256
try {
258-
throwIfFileIsSecurityConcern(filePath);
259257
const fs = await import("fs/promises");
260258
const content = await fs.readFile(filePath, "utf-8");
261259
onFileAttached(filePath, content);

0 commit comments

Comments
 (0)