-
Notifications
You must be signed in to change notification settings - Fork 10
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
Googlesheets expose the client directly #976
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for looking at this @PiusKariuki! I don't think the implementation looks quite right though
packages/googlesheets/src/Adaptor.js
Outdated
@@ -233,6 +233,30 @@ export function getValues(spreadsheetId, range, callback = s => s) { | |||
}; | |||
} | |||
|
|||
|
|||
/** | |||
* Exposes the googlesheets client for more flexible job writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't realised our docs for fn()
were so bad 🙈
When we're done I'll do a pass on these docs (then raise an issue to fix it in common)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright sounds good
So I've tweaked the docs and, on reflection, made a small adjustment to the implementation (pass But I've hit a security problem - something I was worried about. If you console.log the client then the access token becomes visible: This is a security issue. A malicious actor who can use but not see the access token could gain access to it. Maybe a bit of a long shot but I'm uncomfortable with this. I'll have to sleep on it! |
Oh yeah that's no good. Best we think on it see if we can find a workaround. |
@PiusKariuki can you investigate this a bit for me? Please don't give it more than 3 hours. I was hoping this would be an easy thing really. You'll need be able to run a simple googlesheets job locally with the CLI, for which you'll need an oauth Anyway you'll need to get a simple job working that can read from a google sheet of your creation. Then you need to try and wrap the sheets client in a way that can't be accessed from job code. What I hope we can do is block off access externally, in job code, but still allow the client to read the credential to do its own thing. You might be able to do this by wrapping the sheets client with a Proxy and denying access to |
@josephjclark these are some great ideas to start off of👏. I'll explore them and hopefully we get our solution. |
@josephjclark I tried wrapping the client with a Proxy but that prevents it(the client) from accessing the auth details. Here's another problem we'll have to think about too. The access_token is being passed as a Bearer token for the http requests. if the user logs the response of the http request they can see the Bearer token making all our masking useless |
Summary
Expose
googlesheets
client for more flexible job writingFixes #575
Details
Override the common
fn
function that takes thestate
and thesheetsClient
as arguments in the callbackAI Usage
Please disclose how you've used AI in this work (it's cool, we just want to
know!):
You can read more details in our
Responsible AI Policy
Review Checklist
Before merging, the reviewer should check the following items:
production? Is it safe to release?
dev only changes don't need a changeset.