Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit c140fe5

Browse files
authored
fix(deps): upgrade pprof to v3.2.1 [security] (#885)
Fixes #879, take two of #883 with correct commit message. This caused an issue where the proto definitions in `protos/` are incompatible with those returned from pprof. The fix I assumed was to regenerate the protos with `npm run protos`, however this fails because the third_party directory was removed in #486. To make things work, I instead just imported the same proto definitions from pprof library. I will delete the now unused `protos/` directory for the next major version release as someone could theoretically have been importing them from build, just to be safe.
1 parent 56e5eb7 commit c140fe5

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
"system-test": "c8 --no-clean mocha build/system-test/test-*.js --timeout=60000",
1111
"samples-test": "echo 'no sample tests'",
1212
"clean": "gts clean",
13-
"compile": "tsc -p . && cp -R protos build",
13+
"compile": "tsc -p .",
1414
"fix": "gts fix",
1515
"lint": "gts check",
1616
"docs": "jsdoc -c .jsdoc.js",
1717
"prelint": "cd samples; npm link ../; npm install",
1818
"prepare": "npm run compile",
1919
"pretest": "npm run compile",
20-
"proto": "mkdir -p protos && pbjs -t static-module -w commonjs -o protos/profiler.js third_party/googleapis/google/devtools/cloudprofiler/v2/profiler.proto && pbts -o protos/profiler.d.ts protos/profiler.js",
2120
"license-check": "jsgl --local .",
2221
"docs-test": "linkinator docs",
2322
"predocs-test": "npm run docs",
@@ -37,9 +36,9 @@
3736
"extend": "^3.0.2",
3837
"gcp-metadata": "^4.0.0",
3938
"parse-duration": "^1.0.0",
40-
"pprof": "3.2.0",
39+
"pprof": "3.2.1",
4140
"pretty-ms": "^7.0.0",
42-
"protobufjs": "~7.2.0",
41+
"protobufjs": "~7.2.4",
4342
"semver": "^7.0.0",
4443
"teeny-request": "^8.0.0"
4544
},
@@ -69,12 +68,10 @@
6968
},
7069
"files": [
7170
"build/src",
72-
"build/third_party/cloud-debug-nodejs",
73-
"build/protos"
71+
"build/third_party/cloud-debug-nodejs"
7472
],
7573
"nyc": {
7674
"exclude": [
77-
"protos",
7875
"build/test",
7976
"build/system-test"
8077
]

src/profiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import {
2020
DecorateRequestOptions,
2121
} from '@google-cloud/common';
2222
import {heap as heapProfiler, SourceMapper, time as timeProfiler} from 'pprof';
23+
import {perftools} from 'pprof/proto/profile';
2324
import * as msToStr from 'pretty-ms';
2425
import {promisify} from 'util';
2526
import * as zlib from 'zlib';
2627
import * as r from 'teeny-request';
2728

28-
import {perftools} from '../protos/profile';
2929
import {ProfilerConfig} from './config';
3030
import {createLogger} from './logger';
3131

system-test/test-start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import * as nock from 'nock';
1919
import {promisify} from 'util';
2020
import * as zlib from 'zlib';
2121

22-
import {perftools} from '../protos/profile';
22+
import {perftools} from 'pprof/proto/profile';
2323
import {RequestProfile} from '../src/profiler';
2424

2525
const API = 'https://cloudprofiler.googleapis.com/v2';

test/profiles-for-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as path from 'path';
1717
import {SourceMapGenerator} from 'source-map';
1818
import * as tmp from 'tmp';
1919

20-
import {perftools} from '../protos/profile';
20+
import {perftools} from 'pprof/proto/profile';
2121
import {TimeProfile} from '../src/v8-types';
2222

2323
const timeLeaf1 = {

test/test-profiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import * as sinon from 'sinon';
2626
import {promisify} from 'util';
2727
import * as zlib from 'zlib';
2828

29-
import {perftools} from '../protos/profile';
29+
import {perftools} from 'pprof/proto/profile';
3030
import {ProfilerConfig} from '../src/config';
3131
import {
3232
parseBackoffDuration,

0 commit comments

Comments
 (0)