Skip to content

Commit

Permalink
fix: Make sure the documentation for this option clearly states the s…
Browse files Browse the repository at this point in the history
…ecurity implications of turning it on #1524
  • Loading branch information
develar committed May 5, 2017
1 parent 9dbc789 commit b0ce309
Show file tree
Hide file tree
Showing 6 changed files with 6,942 additions and 5,635 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ajv": "^5.0.1",
"ajv-keywords": "^2.0.0",
"archiver": "^1.3.0",
"aws-sdk": "^2.48.0",
"aws-sdk": "^2.49.0",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
Expand All @@ -52,7 +52,7 @@
"node-forge": "^0.7.1",
"normalize-package-data": "^2.3.8",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
"plist": "^2.1.0",
"sanitize-filename": "^1.6.1",
"semver": "^5.3.0",
"stat-mode": "^0.2.2",
Expand All @@ -66,7 +66,7 @@
"devDependencies": {
"@types/electron": "^1.4.37",
"@types/ini": "^1.3.29",
"@types/jest": "^19.2.2",
"@types/jest": "^19.2.3",
"@types/js-yaml": "^3.5.30",
"@types/node-forge": "^0.6.8",
"@types/source-map-support": "^0.2.28",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"node-forge": "^0.7.1",
"normalize-package-data": "^2.3.8",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
"plist": "^2.1.0",
"sanitize-filename": "^1.6.1",
"semver": "^5.3.0",
"update-notifier": "^2.1.0",
Expand Down
19 changes: 15 additions & 4 deletions packages/electron-builder/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { DmgTarget } from "./targets/dmg"
import { PkgTarget, prepareProductBuildArgs } from "./targets/pkg"
import { createCommonTarget, NoOpTarget } from "./targets/targetFactory"

const buildForPrWarning = "There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" +
"\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you."

export default class MacPackager extends PlatformPackager<MacOptions> {
readonly codeSigningInfo: Promise<CodeSigningInfo>

Expand Down Expand Up @@ -115,10 +118,18 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
warn("macOS application code signing is supported only on macOS, skipping.")
return
}
if (process.env.CSC_FOR_PULL_REQUEST !== "true" && isPullRequest()) {
// https://github.com/electron-userland/electron-builder/issues/1524
log("Current build is a part of pull request, code signing will be skipped. Set env CSC_FOR_PULL_REQUEST to true to force code signing.")
return

if (isPullRequest()) {
if (process.env.CSC_FOR_PULL_REQUEST === "true") {
warn(buildForPrWarning)
}
else {
// https://github.com/electron-userland/electron-builder/issues/1524
log("Current build is a part of pull request, code signing will be skipped." +
"\nSet env CSC_FOR_PULL_REQUEST to true to force code signing." +
`\n${buildForPrWarning}`)
return
}
}

const keychainName = (await this.codeSigningInfo).keychainName
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.1.0",
"aws-sdk": "^2.48.0",
"aws-sdk": "^2.49.0",
"mime": "^1.3.4",
"electron-publish": "~0.0.0-semantic-release",
"electron-builder-util": "~0.0.0-semantic-release"
Expand Down
Loading

0 comments on commit b0ce309

Please sign in to comment.