Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store only the value of a file in gcloud-node configstore file #693

Closed
stephenplusplus opened this issue Jun 26, 2015 · 0 comments
Closed
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@stephenplusplus
Copy link
Contributor

I'm not sure if this was a change in Node >v0.10 or something that was always sneaking under the radar, but the story goes...

We use a config .yml file that enables resumable uploads to work without the user having to understand what's going on under the hood. (Documented here).

It looks like we're having a potentially huge leak here: https://github.com/GoogleCloudPlatform/gcloud-node/blob/61ffa82c78cce44ed28b94d8a857c7c051cae9d0/lib/storage/file.js#L1394

var firstChunk = chunk.slice(0, 16);
// ...
configStore.set(that.name, {
  uri: reqOpts.uri,
  firstChunk: firstChunk
});

chunk is a Buffer. When you slice a buffer, it apparently keeps a property called parent, that is the entire original value of the buffer. As a result, we were writing the entire thing into a user's gcloud-node config file, when all we wanted was a measly 16kb.

Here's the fix:

var firstChunk = chunk.slice(0, 16).valueOf();

PR coming before today's release.

@stephenplusplus stephenplusplus added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: storage Issues related to the Cloud Storage API. labels Jun 26, 2015
@stephenplusplus stephenplusplus changed the title Store only the value of a file in temporary cache Store only the value of a file in gcloud-node configstore file Jun 26, 2015
sofisl pushed a commit that referenced this issue Nov 11, 2022
…ListDocuments and ListKnowledgeBases fix!: added REQUIRED annotation for Agent.parent and EntityType.Entity.value fix!: added resource reference for Agent.parent and StreamingDetectIntentRequest.session (#693)

PiperOrigin-RevId: 336721089

Source-Author: Google APIs <[email protected]>
Source-Date: Mon Oct 12 12:38:48 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: d616167ada0a7195613efca5b44fe0aa188836d9
Source-Link: googleapis/googleapis@d616167
sofisl pushed a commit that referenced this issue Nov 17, 2022
…andwritten libraries (#693)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 429395631

Source-Link: googleapis/googleapis@84594b3

Source-Link: googleapis/googleapis-gen@ed74f97
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9
sofisl pushed a commit that referenced this issue Jan 10, 2023
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 437260831

Source-Link: googleapis/googleapis@3c34a40

Source-Link: googleapis/googleapis-gen@a403521
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTQwMzUyMTNlNjg2Yjk2YWZjM2VkNjZkMGQwNDMyOGU0ZmZiZDRkMSJ9
sofisl pushed a commit that referenced this issue Jan 10, 2023
🤖 I have created a release *beep* *boop*
---


## [3.4.0](googleapis/nodejs-dlp@v3.3.0...v3.4.0) (2022-03-25)


### Features

* new Bytes and File types: POWERPOINT and EXCEL ([#693](googleapis/nodejs-dlp#693)) ([ed3dc42](googleapis/nodejs-dlp@ed3dc42))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

1 participant