Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Beta exposes access key when preview is turned off #104

Open
scb-mchaines opened this issue Nov 25, 2019 · 1 comment
Open

Beta exposes access key when preview is turned off #104

scb-mchaines opened this issue Nov 25, 2019 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@scb-mchaines
Copy link

On the latest beta release, it looks like there is some risk of publicly exposing access keys. Steps:

  1. npm install with the affected version "gatsby-source-prismic-graphql": "^3.4.0-beta.2"
  2. build with gatsby-source-prismic-graphl config indicating previews: false. Mine looks something like:
    {
      resolve: 'gatsby-source-prismic-graphql',
        options: {
          repositoryName: 'my-repository',
          accessToken: 'secret-access-token',
          path: '/preview',
          previews: false,
          pages: [{ 
            type: 'Page',
            match: '/:uid',
            path: '/',
            component: require.resolve('./src/components/page.js'),
        }]
      }
    }
  1. Serve the public directory, and check window.prismicGatsbyOptions.accessToken in the js console of the page. In my case, this exposes the access key.

Originally posted by @scb-mchaines in #45 (comment)

@birkir birkir added enhancement New feature or request help wanted Extra attention is needed labels Dec 4, 2019
@andyto
Copy link
Contributor

andyto commented Feb 3, 2020

What the purpose of window.prismic and window.prismicGatsbyOptions in a production build without a preview?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants