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

iojs: Detect no start line error as sign error #346

Merged
merged 1 commit into from
Jan 20, 2015
Merged

iojs: Detect no start line error as sign error #346

merged 1 commit into from
Jan 20, 2015

Conversation

ryanseys
Copy link
Contributor

I ran all the tests with iojs instead of node and only 1 failed due to a different error occurring when attempting to sign a key. I just added the check here so now all tests pass with iojs.

Aside: Not that we want to support iojs (yet) but figured I'd have a little fun with it and see how well supported it is. Actually, the fact that iojs isn't 100% compatible and that this PR is necessary at all may be a bug on their end, not ours. Thoughts?

@ryanseys ryanseys changed the title Detect no start line error as sign error iojs: Detect no start line error as sign error Jan 14, 2015
@ryanseys
Copy link
Contributor Author

Actually thinking about this a bit more, any sort of error that occurs with the sign will need to be detected. In Node, lib/crypto.js would return a SignFinal error which appears to still happen in iojs see here but it must be being short-circuited by this PEM error before hand, probably around here.

¯\_(ツ)_/¯

@stephenplusplus
Copy link
Contributor

Sounds like an issue upstream.

@sindresorhus
Copy link

I would try to get it fixed upstream first. It seems they're very quick at fixing bugs and shipping new patch releases ;)

@addyosmani
Copy link

Upstream issue. +1 on what Sindre said.

@ryanseys
Copy link
Contributor Author

Thanks all! An issue has been filed.

@ryanseys
Copy link
Contributor Author

As the issue points out, this is a change present in 0.11 so it's not an upstream issue as far as they (io.js) are concerned but an artifact of using 0.11 for io.js. I've updated this PR to detect the difference in error messages for all PEM errors however still unsure whether this is ideal or desired.

@stephenplusplus
Copy link
Contributor

I'm fine with merging... in its current form, I couldn't see this hurting anything.

2 questions though:

  1. Could you add a comment above the new error check linking to this issue with a brief explanation of why we included this?
  2. Do you know if there are any other variations of the string "PEM Routines" that could be found in a PEM-related error message? If so, we may as well cover all of them.

@ryanseys
Copy link
Contributor Author

Yeah I can add a comment. I don't think so at least for what we are trying to do.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 20, 2015
@ryanseys
Copy link
Contributor Author

The error is in the form: "error:some_code:PEM routines:PEM_read_bio:<error_name>" so we can just look for "error:" or what I currently have: "PEM routines:". What do you think is best? I'm thinking maybe "error:" might be better.

@ryanseys
Copy link
Contributor Author

I updated the PR to reflect checking for "error:" instead so it's pretty generic.

@stephenplusplus
Copy link
Contributor

Does the error that is thrown with error:some_code:etc always originate from a PEM file? Just wondering if other areas of the codebase could throw error:some_code:something_not_pem_related.

@ryanseys
Copy link
Contributor Author

Yeah by the looks of it here there's the possibility of basically anything going wrong. I'm surprised I don't see an "arriving late to your daughter's soccer practice" error in there.

@stephenplusplus
Copy link
Contributor

I'm only concerned with using error: since this is our catch-all API error handling. If an error message from any endpoint were to return "error:" in the error.message string, we would print out the private key error. We should probably go back to the "PEM routines" method.

@ryanseys
Copy link
Contributor Author

No problem. For the sake of signing a key, I believe it's always a PEM we
are using so this should in theory be the only error people encounter. I
can spend some more time testing with different keys to trust myself more.

On Tuesday, January 20, 2015, Stephen Sawchuk [email protected]
wrote:

I'm only concerned with using error: since this is our catch-all API
error handling. If an error message from any endpoint were to return
"error:" in the error.message string, we would print out the private key
error. We should probably go back to the "PEM routines" method.


Reply to this email directly or view it on GitHub
#346 (comment)
.

@ryanseys
Copy link
Contributor Author

So I just mucked around with the key, replacing random characters and got a bunch of different errors:

[Error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode]
[Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag]
[Error: error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long]
[Error: invalid_grant]

The most notable being invalid_grant which was returned from the server i.e. the library didn't fail but Google certainly didn't like what it got.

@ryanseys
Copy link
Contributor Author

Based on this, I think we are best to have a catch-all and search for "error:" and in the off-chance that our library doesn't fail but we get "invalid_grant" back, we might want to handle that separately?

@stephenplusplus
Copy link
Contributor

It's very possible I'm wrong, but this code handles errors from all of our API requests, doesn't it? As in, if I'm uploading a file or running a query on a dataset, etc. I'm not fully sure all of those upstream API endpoints wouldn't use the phrase error: in an error message.

@ryanseys
Copy link
Contributor Author

The if(err) block this PR is in is only reached when authorization fails, that is, google-service-account attempted to give us a token but couldn't. Yes this method is called on every request, but if auth doesn't fail first, then this line handles the normal API errors that come through.

stephenplusplus added a commit that referenced this pull request Jan 20, 2015
iojs: Detect no start line error as sign error
@stephenplusplus stephenplusplus merged commit fcc6123 into googleapis:master Jan 20, 2015
@stephenplusplus
Copy link
Contributor

Phew. Sounds good to me!

@ryanseys
Copy link
Contributor Author

Aside: Yeah that auth code is pretty mind-busting to understand. Closures be everywhere! 😓

@ryanseys ryanseys deleted the iojs branch January 20, 2015 21:10
@ryanseys
Copy link
Contributor Author

Hopefully that'll be the last of the iojs bugs HAHAHAHAHAHA.... hahahaha... ha ha ha .... sigh

@stephenplusplus
Copy link
Contributor

Haha :'(

sofisl pushed a commit that referenced this pull request Nov 10, 2022
sofisl pushed a commit that referenced this pull request Nov 11, 2022
sofisl pushed a commit that referenced this pull request Nov 11, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/94b5c3f0-0503-436d-9be8-c1804aaa194c/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 315023125
Source-Link: googleapis/googleapis@dd244bb
PiperOrigin-RevId: 314788929
Source-Link: googleapis/googleapis@c77929e
sofisl pushed a commit that referenced this pull request Nov 11, 2022
* docs(samples): add auto-generated Node samples build(generator): find protoc based on its bazel location

PiperOrigin-RevId: 398604509

Source-Link: googleapis/googleapis@6ef16b9

Source-Link: googleapis/googleapis-gen@8314e1e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODMxNGUxZWFkM2U5MDZkYmYyMDEyY2VkOGQ5MmYyYmM4ZGQ0NWM5NSJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Nov 11, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^13.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/sinon/13.0.2/14.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/compatibility-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/confidence-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>sinonjs/sinon</summary>

### [`v14.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#&#8203;1400)

[Compare Source](https://togithub.com/sinonjs/sinon/compare/v13.0.2...v14.0.0)

-   [`c2bbd826`](https://togithub.com/sinonjs/sinon/commit/c2bbd82641444eb5b32822489ae40f185afbbf00)
    Drop node 12 (Morgan Roderick)
    > And embrace Node 18
    >
    > See https://nodejs.org/en/about/releases/

*Released by Morgan Roderick on 2022-05-07.*

</details>

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-grafeas).
sofisl pushed a commit that referenced this pull request Nov 11, 2022
sofisl pushed a commit that referenced this pull request Nov 11, 2022
sofisl added a commit that referenced this pull request Nov 16, 2022
* chore(deps): upgrade gapic-generator-java to 2.4.1

PiperOrigin-RevId: 422607515

Source-Link: googleapis/googleapis@ba2ffd6

Source-Link: googleapis/googleapis-gen@73ba4ad
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzNiYTRhZGQyMzlhNjE5ZGE1NjdmZmJkNGU1NzMwZmRkNmRlMDRkMyJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
sofisl pushed a commit that referenced this pull request Nov 18, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/663471aa-c039-4d53-b978-92e058276a4e/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@15013ef
sofisl pushed a commit that referenced this pull request Jan 10, 2023
sofisl pushed a commit that referenced this pull request Jan 17, 2023
sofisl pushed a commit that referenced this pull request Jan 24, 2023
sofisl pushed a commit that referenced this pull request Jan 25, 2023
sofisl pushed a commit that referenced this pull request Jan 26, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [linkinator](https://togithub.com/JustinBeckwith/linkinator) | [`^2.2.2` -> `^4.0.0`](https://renovatebot.com/diffs/npm/linkinator/2.16.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/compatibility-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/confidence-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>JustinBeckwith/linkinator</summary>

### [`v4.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v4.0.0)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.1.0...v4.0.0)

##### Features

-   create new release with notes ([#&#8203;508](https://togithub.com/JustinBeckwith/linkinator/issues/508)) ([2cab633](https://togithub.com/JustinBeckwith/linkinator/commit/2cab633c9659eb10794a4bac06f8b0acdc3e2c0c))

##### BREAKING CHANGES

-   The commits in [#&#8203;507](https://togithub.com/JustinBeckwith/linkinator/issues/507) and [#&#8203;506](https://togithub.com/JustinBeckwith/linkinator/issues/506) both had breaking changes.  They included dropping support for Node.js 12.x and updating the CSV export to be streaming, and to use a new way of writing the CSV file.  This is an empty to commit using the `BREAKING CHANGE` format in the commit message to ensure a release is triggered.

### [`v3.1.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.1.0)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.6...v3.1.0)

##### Features

-   allow --skip to be defined multiple times ([#&#8203;399](https://togithub.com/JustinBeckwith/linkinator/issues/399)) ([5ca5a46](https://togithub.com/JustinBeckwith/linkinator/commit/5ca5a461508e688de12e5ae6b4cfb6565f832ebf))

### [`v3.0.6`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.6)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.5...v3.0.6)

##### Bug Fixes

-   **deps:** upgrade node-glob to v8 ([#&#8203;397](https://togithub.com/JustinBeckwith/linkinator/issues/397)) ([d334dc6](https://togithub.com/JustinBeckwith/linkinator/commit/d334dc6734cd7c2b73d7ed3dea0550a6c3072ad5))

### [`v3.0.5`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.5)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.4...v3.0.5)

##### Bug Fixes

-   **deps:** upgrade to htmlparser2 v8.0.1 ([#&#8203;396](https://togithub.com/JustinBeckwith/linkinator/issues/396)) ([ba3b9a8](https://togithub.com/JustinBeckwith/linkinator/commit/ba3b9a8a9b19d39af6ed91790135e833b80c1eb6))

### [`v3.0.4`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.4)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.3...v3.0.4)

##### Bug Fixes

-   **deps:** update dependency gaxios to v5 ([#&#8203;391](https://togithub.com/JustinBeckwith/linkinator/issues/391)) ([48af50e](https://togithub.com/JustinBeckwith/linkinator/commit/48af50e787731204aeb7eff41325c62291311e45))

### [`v3.0.3`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.3)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.2...v3.0.3)

##### Bug Fixes

-   export getConfig from index ([#&#8203;371](https://togithub.com/JustinBeckwith/linkinator/issues/371)) ([0bc0355](https://togithub.com/JustinBeckwith/linkinator/commit/0bc0355c7e2ea457f247e6b52d1577b8c4ecb3a1))

### [`v3.0.2`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.2)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.1...v3.0.2)

##### Bug Fixes

-   allow server root with trailing slash ([#&#8203;370](https://togithub.com/JustinBeckwith/linkinator/issues/370)) ([8adf6b0](https://togithub.com/JustinBeckwith/linkinator/commit/8adf6b025fda250e38461f1cdad40fe08c3b3b7c))

### [`v3.0.1`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.1)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.0...v3.0.1)

##### Bug Fixes

-   decode path parts in local web server ([#&#8203;369](https://togithub.com/JustinBeckwith/linkinator/issues/369)) ([4696a0c](https://togithub.com/JustinBeckwith/linkinator/commit/4696a0c38c341b178ed815f47371fca955979feb))

### [`v3.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.0)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v2.16.2...v3.0.0)

##### Bug Fixes

-   **deps:** update dependency chalk to v5 ([#&#8203;362](https://togithub.com/JustinBeckwith/linkinator/issues/362)) ([4b17a8d](https://togithub.com/JustinBeckwith/linkinator/commit/4b17a8d87b649eaf813428f8ee6955e1d21dae4f))

-   feat!: convert to es modules, drop node 10 ([#&#8203;359](https://togithub.com/JustinBeckwith/linkinator/issues/359)) ([efee299](https://togithub.com/JustinBeckwith/linkinator/commit/efee299ab8a805accef751eecf8538915a4e7783)), closes [#&#8203;359](https://togithub.com/JustinBeckwith/linkinator/issues/359)

##### BREAKING CHANGES

-   this module now requires node.js 12 and above, and has moved to es modules by default.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-ai-platform).
sofisl pushed a commit that referenced this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants