Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
21bfdd43
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
21bfdd43
编写于
3月 29, 2018
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove file paths from telemetry data
上级
cae49fe8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
14 deletion
+19
-14
src/vs/platform/telemetry/common/telemetryService.ts
src/vs/platform/telemetry/common/telemetryService.ts
+19
-14
未找到文件。
src/vs/platform/telemetry/common/telemetryService.ts
浏览文件 @
21bfdd43
...
@@ -37,7 +37,8 @@ export class TelemetryService implements ITelemetryService {
...
@@ -37,7 +37,8 @@ export class TelemetryService implements ITelemetryService {
private
_userOptIn
:
boolean
;
private
_userOptIn
:
boolean
;
private
_disposables
:
IDisposable
[]
=
[];
private
_disposables
:
IDisposable
[]
=
[];
private
_cleanupPatterns
:
[
RegExp
,
string
][]
=
[];
private
_cleanupPatterns
:
RegExp
[]
=
[];
private
readonly
fileRegex
=
process
.
platform
===
'
win32
'
?
/
[
a-z,A-Z
]
:
(\\?[\\\/]\w
+
)
+/g
:
/
(\/\w
+
)
+/g
;
constructor
(
constructor
(
config
:
ITelemetryServiceConfig
,
config
:
ITelemetryServiceConfig
,
...
@@ -48,18 +49,11 @@ export class TelemetryService implements ITelemetryService {
...
@@ -48,18 +49,11 @@ export class TelemetryService implements ITelemetryService {
this
.
_piiPaths
=
config
.
piiPaths
||
[];
this
.
_piiPaths
=
config
.
piiPaths
||
[];
this
.
_userOptIn
=
typeof
config
.
userOptIn
===
'
undefined
'
?
true
:
config
.
userOptIn
;
this
.
_userOptIn
=
typeof
config
.
userOptIn
===
'
undefined
'
?
true
:
config
.
userOptIn
;
// static cleanup patterns for:
// static cleanup pattern for: `file:///DANGEROUS/PATH/resources/app/Useful/Information`
// #1 `file:///DANGEROUS/PATH/resources/app/Useful/Information`
this
.
_cleanupPatterns
=
[
/file:
\/\/\/
.*
?\/
resources
\/
app
\/
/gi
];
// #2 // Any other file path that doesn't match the approved form above should be cleaned.
// #3 "Error: ENOENT; no such file or directory" is often followed with PII, clean it
this
.
_cleanupPatterns
.
push
(
[
/file:
\/\/\/
.*
?\/
resources
\/
app
\/
/gi
,
''
],
[
/file:
\/\/\/
.*/gi
,
''
],
[
/ENOENT: no such file or directory.*
?\'([^\']
+
)\'
/gi
,
'
ENOENT: no such file or directory
'
]
);
for
(
let
piiPath
of
this
.
_piiPaths
)
{
for
(
let
piiPath
of
this
.
_piiPaths
)
{
this
.
_cleanupPatterns
.
push
(
[
new
RegExp
(
escapeRegExpCharacters
(
piiPath
),
'
gi
'
),
''
]
);
this
.
_cleanupPatterns
.
push
(
new
RegExp
(
escapeRegExpCharacters
(
piiPath
),
'
gi
'
)
);
}
}
if
(
this
.
_configurationService
)
{
if
(
this
.
_configurationService
)
{
...
@@ -127,10 +121,21 @@ export class TelemetryService implements ITelemetryService {
...
@@ -127,10 +121,21 @@ export class TelemetryService implements ITelemetryService {
private
_cleanupInfo
(
stack
:
string
):
string
{
private
_cleanupInfo
(
stack
:
string
):
string
{
const
m
=
stack
.
match
(
this
.
fileRegex
);
if
(
!
m
)
{
return
stack
;
}
// remove file paths that do not match the cleanup patterns
m
.
forEach
(
x
=>
{
if
(
this
.
_cleanupPatterns
.
every
(
pattern
=>
!
pattern
.
test
(
x
)))
{
stack
=
stack
.
replace
(
x
,
''
);
}
});
// sanitize with configured cleanup patterns
// sanitize with configured cleanup patterns
for
(
let
tuple
of
this
.
_cleanupPatterns
)
{
for
(
let
regexp
of
this
.
_cleanupPatterns
)
{
let
[
regexp
,
replaceValue
]
=
tuple
;
stack
=
stack
.
replace
(
regexp
,
''
);
stack
=
stack
.
replace
(
regexp
,
replaceValue
);
}
}
return
stack
;
return
stack
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录