Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: encode store name + check for fetch #73

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

Merged
eduardoboucas merged 3 commits into main from feat/more-improvements
Oct 19, 2023

Conversation

Copy link
Member

@eduardoboucas eduardoboucas commented Oct 19, 2023

URL-encodes the store name and throws an error message when a fetch implementation hasn't been found.

Closes https://github.com/netlify/pillar-runtime/issues/757.
Closes https://github.com/netlify/pillar-runtime/issues/756.

@eduardoboucas eduardoboucas requested a review from a team as a code owner October 19, 2023 14:31
Copy link

netlify bot commented Oct 19, 2023
edited
Loading

Deploy Preview for blobs-js ready!

Name Link
🔨 Latest commit 231386e
🔍 Latest deploy log https://app.netlify.com/sites/blobs-js/deploys/653147b94fadf10008f376e5
😎 Deploy Preview https://deploy-preview-73--blobs-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Oct 19, 2023
Skn0tt
Skn0tt previously approved these changes Oct 19, 2023
private name: string

constructor(options: StoreOptions) {
this.client = options.client
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to scope options.name as well? I'm wondering what happens when name is set dynamically based on user input, and some attacker gets this to be deploy:foo. Then they can access a different store. If we also prefixed options.name, that wouldn't be possible

Copy link
Member Author

@eduardoboucas eduardoboucas Oct 19, 2023

Choose a reason for hiding this comment

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

What would be the attack vector there? If you set the store name to deploy:<something>, you end up scoping your store to one of your deploys, which is basically the same as supplying a deploy ID in the constructor. It's not like you'll gain access to someone else's deploy?

I would be more in favour of adding a validation rule that prevents you from getting a store that starts with deploy:, because that's a reserved scope. Not that anything happens if you use it, but because it isn't the right flow.

Copy link
Contributor

Choose a reason for hiding this comment

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

What would be the attack vector there?

Imagine a site that stores some deploy-specific assets in deploy:id (don't know why, it's contrived), and then customer-specific assets in a store called :customer_id. Now a customer signs up with the slug deploy:foo, and 💥 their store clashes with the deploy-specific assets.

I would be more in favour of adding a validation rule that prevents you from getting a store that starts with `deploy:``

Yes, that sounds like a good fix!

Copy link
Member Author

@eduardoboucas eduardoboucas Oct 19, 2023

Choose a reason for hiding this comment

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

Imagine a site that stores some deploy-specific assets in deploy:id (don't know why, it's contrived), and then customer-specific assets in a store called :customer_id. Now a customer signs up with the slug deploy:foo, and 💥 their store clashes with the deploy-specific assets.

With this PR, a store can't be called :customer_id, because we're URL-encoding it to %3Acustomer_id.

Copy link
Contributor

Choose a reason for hiding this comment

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

:customer_id was meant to be a placeholder for the customer ID

Copy link
Member Author

@eduardoboucas eduardoboucas Oct 19, 2023

Choose a reason for hiding this comment

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

I don't think I've understood your example, but either way checking for the deploy: prefix is something we should do.

Done in 231386e.

Copy link
Member Author

@eduardoboucas eduardoboucas Oct 19, 2023

Choose a reason for hiding this comment

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

I've also URL-encoded the deploy ID for good measure. It shouldn't ever be needed, because deploy IDs are alphanumerical, but it just prevents someone doing weird things from triggering a request to a malformed URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@Skn0tt Skn0tt Skn0tt approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /