Skip to content

[docs]: Clarify env variables are NOT "SECRET" #5676

Closed

Description

@JBallin

The usage of REACT_APP_SECRET_CODE in Adding Custom Environment Variables is misleading given that there are no secrets in the front end.

Should I open a PR that changes all to REACT_APP_NOT_SECRET_CODE?

Also, should there be a warning box toward the top about being careful not to expose secrets?

Activity

  1. changed the title [-]Clarify in docs that environment variables are NOT "SECRET"[/-] [+][docs]: Clarify env variables are NOT "SECRET"[/+] on Nov 1, 2018
  2. miraage commented on Nov 2, 2018

    @miraage

    During the build, process.env.REACT_APP_SECRET_CODE will be replaced with the current value of the REACT_APP_SECRET_CODE environment variable

    Documentation says it explicitly, that this value will end up in the result bundle.

  3. JBallin commented on Nov 2, 2018

    @JBallin
    ContributorAuthor

    @miraage I don't believe this makes it clear that secrets will be exposed. It requires some deduction and reading. Here's an example warning message:

    Don't store any secrets (such as API keys) in your React app as they'll be included in the build (meaning they can be read by anyone looking at your script/html files in dev tools). Instead, you should send requests to a separate backend (which stores your secrets) and send back the response to your React app.

    I think this is an important distinction that should be immediately obvious when looking at the docs, especially for beginners. Unfortunately some misinformation is being spread online, so I think it's safe to assume that people are not finding this clear.

    What's the downside of adding NOT?

  4. stale commented on Dec 2, 2018

    @stale

    This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

  5. ianschmitz commented on Dec 2, 2018

    @ianschmitz
    Contributor

    Would you like to submit a PR to update the docs @JBallin?

  6. JBallin commented on Dec 2, 2018

    @JBallin
    ContributorAuthor

    @ianschmitz would love to! Was just waiting for agreement/feedback on the following:

    1. Changing all to REACT_APP_NOT_SECRET_CODE
    2. Adding a warning at the top about secrets
    3. The following warning message:

    Don't store any secrets (such as API keys) in your React app as they'll be included in the build (meaning they can be read by anyone looking at your script/html files in dev tools). Instead, you should send requests to a separate backend (which stores your secrets) and send back the response to your React app.

  7. ianschmitz commented on Dec 2, 2018

    @ianschmitz
    Contributor

    Sounds reasonable. Let's get a PR going and we can get some feedback from the others in there. Thanks!

  8. stale commented on Jan 1, 2019

    @stale

    This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

  9. JBallin commented on Jan 2, 2019

    @JBallin
    ContributorAuthor

    There's an open PR in progress: #6062

  10. stale commented on Feb 7, 2019

    @stale

    This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

  11. JBallin commented on Feb 9, 2019

    @JBallin
    ContributorAuthor

    There's an open PR in progress: #6062

    Waiting for a response from maintainers.

  12. added a commit that references this issue on Feb 10, 2019
    313e472
  13. locked and limited conversation to collaborators on Feb 15, 2019
  14. added a commit that references this issue on Feb 24, 2019
    f01f04b
  15. added a commit that references this issue on Mar 2, 2019
    04eedd2
  16. added a commit that references this issue on May 14, 2019
    4275a0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions