1

I'm always nervous to make pushes of code to a Github repo with authentication tokens and variables. I have had an issue in the past with exposed keys and since I am new to Xcode, I'm curious as to what files I should be adding to .gitignore. The main areas where I am most nervous about displaying in my public repo is my Parse and Facebook keys. The Facebook keys are set up within my .plist and my Parse keys appear in my AppDelegate.swift file. What should my approach be, and going forward, how should I set up environment variables to prevent issues in the future.

cphill
  • 5,596
  • 16
  • 89
  • 182

1 Answers1

0

If the recommended Swift.gitignore does not ignore those files, then you would need to manage them with a content filter driver (using .gitattributes declaration).

The idea is to manage those plist or swift files in version, but with template placeholders in place of the actual (sensitive) values.

  • the smudge part could replace the template content with the actual value (on checkout)
  • the clean part could restore the template (on commit)

smudge

(image from "Customizing Git - Git Attributes", from "Pro Git book")

The main idea is: if a data is confidential, it should not be in the repo (at all): the smudge script would replace the placeholder values with actual values fetched outside of the repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250