8000 Security exporter by perryism · Pull Request #3 · usertesting/biscuit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Security exporter #3

Merged
merged 7 commits into from
Mar 30, 2018
Merged

Security exporter #3

merged 7 commits into from
Mar 30, 2018

Conversation

perryism
Copy link
Contributor
@perryism perryism commented Mar 30, 2018

We are using the secrets decrypter across many projects. Moving it here would make sense.

Implementation

I use Open3 so I can stub

@perryism perryism requested review from suan and nevinera March 30, 2018 19:01
Copy link
Contributor
@nevinera nevinera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/biscuit.rb Outdated
raise(result.slice(0, 200)) unless $?.success?
result
stdout, stderr, status = Open3.capture3("#{__dir__}/../bin/_biscuit #{command}")
raise(stderr.slice(0, 200)) unless status == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A difference (which may be an improvement) - previously we raised with a slice of the stderr output, but you have changed it to a slice of the stdout output. That seems likely to be more correct, but I wanted to make sure you were aware, and had checked out the actual behavior around this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open3.capture3 is a way better tool for this by the way, even without the stubbing benefits :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind making this into a named exception? (maybe Biscuit::Error)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nevinera previously the result holds both stdout and stderr I believe. maybe it should be Biscuit::Error.new("#{stdout} #{stderr}".slice(0, 200)) thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind, it is stdout only

@perryism
Copy link
Contributor Author

@nevinera good call on version bump. since a new small feature is introduced, I will bump it to 0.1.0, sound good?

@perryism
Copy link
Contributor Author

I can't decide whether I should raise error with stderr , or stdout. so I defer that to the user that i put both in the execution error object.

8000


module Biscuit
class ExecutionError < StandardError
def initialize(stdout, stderr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd feel a lot better about this if you changed the stdout parameter to be optional - I've run into a lot of places in the past where it was really irritating that someone had changed the initialization signature of a subclass.

@perryism perryism force-pushed the security_exporter branch from cc59684 to cf5f00f Compare March 30, 2018 21:36
@perryism perryism merged commit f064ed4 into master Mar 30, 2018
@perryism perryism deleted the security_exporter branch March 30, 2018 22:07
@bobziuchkovski
Copy link

I'm late to the party on this one, but I love it! 😁

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0