github-authentication 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +2 -2
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +13 -11
- data/exe/git-credential-github-app +9 -4
- data/github-authentication.gemspec +2 -0
- data/lib/github_authentication/environment.rb +38 -0
- data/lib/github_authentication/git_credential_helper.rb +4 -12
- data/lib/github_authentication/version.rb +1 -1
- data/lib/github_authentication.rb +1 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc7a5e8c75f0a6c1eff271d772031e5d18850dd6bb7d2387908d5186558e1396
|
4
|
+
data.tar.gz: fdd8a299c44fa0d0a4336af31d0568ab0b6f9d71111fa0fa3a3157b04a9356c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cef00e4c97906f4e6a988ec830ed5462a3f146365b2abebdd0284fee99e243c5ca5db618642eb7fffb004d24080fce2294a2875043fbe947d01c70a751177466
|
7
|
+
data.tar.gz: 4fe79c4825cb493039a315aaeda5f982616bee4b411909d931ef7e20938a55b5b0f1b5ea99781b02e2c1f17cba6ae4af950659a73e8b2661f15fc087a0c459f5
|
data/.github/workflows/tests.yml
CHANGED
@@ -14,7 +14,6 @@ jobs:
|
|
14
14
|
- name: Set up Ruby
|
15
15
|
uses: ruby/setup-ruby@v1
|
16
16
|
with:
|
17
|
-
ruby-version: '2.7'
|
18
17
|
bundler-cache: true
|
19
18
|
|
20
19
|
- name: Lint Ruby
|
@@ -27,7 +26,7 @@ jobs:
|
|
27
26
|
strategy:
|
28
27
|
fail-fast: false
|
29
28
|
matrix:
|
30
|
-
ruby: [ '2.7', '3.0', '3.1', '3.2' ]
|
29
|
+
ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]
|
31
30
|
steps:
|
32
31
|
- uses: actions/checkout@v4
|
33
32
|
|
@@ -41,6 +40,7 @@ jobs:
|
|
41
40
|
with:
|
42
41
|
ruby-version: ${{ matrix.ruby }}
|
43
42
|
bundler-cache: true
|
43
|
+
bundler: latest
|
44
44
|
|
45
45
|
- name: Run Ruby tests
|
46
46
|
run: |
|
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.3.0
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
github-authentication (1.
|
4
|
+
github-authentication (1.2.0)
|
5
5
|
jwt (~> 2.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -31,36 +31,36 @@ GEM
|
|
31
31
|
hashdiff (1.0.1)
|
32
32
|
i18n (1.14.1)
|
33
33
|
concurrent-ruby (~> 1.0)
|
34
|
-
json (2.
|
34
|
+
json (2.7.1)
|
35
35
|
jwt (2.7.1)
|
36
36
|
language_server-protocol (3.17.0.3)
|
37
37
|
minitest (5.20.0)
|
38
38
|
mocha (2.1.0)
|
39
39
|
ruby2_keywords (>= 0.0.5)
|
40
40
|
mutex_m (0.2.0)
|
41
|
-
parallel (1.
|
42
|
-
parser (3.
|
41
|
+
parallel (1.24.0)
|
42
|
+
parser (3.3.0.5)
|
43
43
|
ast (~> 2.4.1)
|
44
44
|
racc
|
45
45
|
public_suffix (5.0.4)
|
46
46
|
racc (1.7.3)
|
47
47
|
rainbow (3.1.1)
|
48
48
|
rake (13.1.0)
|
49
|
-
regexp_parser (2.
|
49
|
+
regexp_parser (2.9.0)
|
50
50
|
rexml (3.2.6)
|
51
|
-
rubocop (1.
|
51
|
+
rubocop (1.62.1)
|
52
52
|
json (~> 2.3)
|
53
53
|
language_server-protocol (>= 3.17.0)
|
54
54
|
parallel (~> 1.10)
|
55
|
-
parser (>= 3.
|
55
|
+
parser (>= 3.3.0.2)
|
56
56
|
rainbow (>= 2.2.2, < 4.0)
|
57
57
|
regexp_parser (>= 1.8, < 3.0)
|
58
58
|
rexml (>= 3.2.5, < 4.0)
|
59
|
-
rubocop-ast (>= 1.
|
59
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
60
60
|
ruby-progressbar (~> 1.7)
|
61
61
|
unicode-display_width (>= 2.4.0, < 3.0)
|
62
|
-
rubocop-ast (1.
|
63
|
-
parser (>= 3.
|
62
|
+
rubocop-ast (1.31.2)
|
63
|
+
parser (>= 3.3.0.4)
|
64
64
|
rubocop-shopify (2.14.0)
|
65
65
|
rubocop (~> 1.51)
|
66
66
|
ruby-progressbar (1.13.0)
|
@@ -76,7 +76,9 @@ GEM
|
|
76
76
|
hashdiff (>= 0.4.0, < 2.0.0)
|
77
77
|
|
78
78
|
PLATFORMS
|
79
|
+
arm64-darwin-21
|
79
80
|
arm64-darwin-22
|
81
|
+
arm64-darwin-23
|
80
82
|
x86_64-linux
|
81
83
|
|
82
84
|
DEPENDENCIES
|
@@ -91,4 +93,4 @@ DEPENDENCIES
|
|
91
93
|
webmock (~> 3.8)
|
92
94
|
|
93
95
|
BUNDLED WITH
|
94
|
-
2.
|
96
|
+
2.3.8
|
@@ -14,11 +14,16 @@ end
|
|
14
14
|
|
15
15
|
case ARGV[0]
|
16
16
|
when "get"
|
17
|
+
description = $stdin.each_line.map { |line| line.split("=", 2).map(&:strip) }.to_h
|
18
|
+
org = description.fetch("path", "").split("/").first
|
19
|
+
environment = GithubAuthentication::Environment.new(org: org)
|
20
|
+
|
17
21
|
exit_status = GithubAuthentication::GitCredentialHelper.new(
|
18
|
-
pem:
|
19
|
-
app_id:
|
20
|
-
installation_id:
|
21
|
-
storage:
|
22
|
+
pem: environment.pem,
|
23
|
+
app_id: environment.app_id,
|
24
|
+
installation_id: environment.installation_id,
|
25
|
+
storage: environment.storage,
|
26
|
+
description: description,
|
22
27
|
).handle_get
|
23
28
|
exit(exit_status)
|
24
29
|
when "store"
|
@@ -37,6 +37,8 @@ Gem::Specification.new do |spec|
|
|
37
37
|
|
38
38
|
spec.add_dependency("jwt", "~> 2.2")
|
39
39
|
|
40
|
+
spec.required_ruby_version = ">= 2.7.0"
|
41
|
+
|
40
42
|
spec.add_development_dependency("activesupport")
|
41
43
|
spec.add_development_dependency("minitest", "~> 5.0")
|
42
44
|
spec.add_development_dependency("mocha", "~> 2")
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/object/blank.rb"
|
4
|
+
|
5
|
+
module GithubAuthentication
|
6
|
+
class Environment
|
7
|
+
def initialize(org:, env: ENV)
|
8
|
+
@org = org.presence
|
9
|
+
@env = env
|
10
|
+
end
|
11
|
+
|
12
|
+
def pem
|
13
|
+
File.read(resolve("GITHUB_APP_KEYFILE"))
|
14
|
+
end
|
15
|
+
|
16
|
+
def app_id
|
17
|
+
resolve("GITHUB_APP_ID")
|
18
|
+
end
|
19
|
+
|
20
|
+
def installation_id
|
21
|
+
resolve("GITHUB_APP_INSTALLATION_ID")
|
22
|
+
end
|
23
|
+
|
24
|
+
def storage
|
25
|
+
ActiveSupport::Cache::FileStore.new(resolve("GITHUB_APP_CREDENTIAL_STORAGE_PATH"))
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def resolve(suffix)
|
31
|
+
if @org
|
32
|
+
@env["#{@org.upcase}_#{suffix}"] || @env.fetch(suffix)
|
33
|
+
else
|
34
|
+
@env.fetch(suffix)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -2,19 +2,17 @@
|
|
2
2
|
|
3
3
|
module GithubAuthentication
|
4
4
|
class GitCredentialHelper
|
5
|
-
def initialize(pem:, installation_id:, app_id:, storage: nil
|
5
|
+
def initialize(pem:, installation_id:, app_id:, description:, storage: nil)
|
6
6
|
@pem = pem
|
7
7
|
@installation_id = installation_id
|
8
8
|
@app_id = app_id
|
9
|
+
@description = description
|
9
10
|
@storage = storage
|
10
|
-
@stdin = stdin
|
11
11
|
end
|
12
12
|
|
13
13
|
def handle_get
|
14
|
-
description
|
15
|
-
|
16
|
-
unless description["protocol"] == "https" && description["host"] == "github.com"
|
17
|
-
warn("Unsupported description: #{description}")
|
14
|
+
unless @description["protocol"] == "https" && @description["host"] == "github.com"
|
15
|
+
warn("Unsupported description: #{@description}")
|
18
16
|
return 2
|
19
17
|
end
|
20
18
|
|
@@ -32,12 +30,6 @@ module GithubAuthentication
|
|
32
30
|
10 * 60
|
33
31
|
end
|
34
32
|
|
35
|
-
def parse_stdin
|
36
|
-
# Credential description is written to STDIN in line delimited key=value form,
|
37
|
-
# see https://git-scm.com/docs/git-credential#IOFMT
|
38
|
-
@stdin.each_line.map { |line| line.split("=", 2).map(&:strip) }.to_h
|
39
|
-
end
|
40
|
-
|
41
33
|
def provider
|
42
34
|
@provider ||= Provider.new(
|
43
35
|
generator: generator,
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederik Dudzik
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: jwt
|
@@ -147,6 +146,8 @@ files:
|
|
147
146
|
- ".github/workflows/tests.yml"
|
148
147
|
- ".gitignore"
|
149
148
|
- ".rubocop.yml"
|
149
|
+
- ".ruby-version"
|
150
|
+
- CHANGELOG.md
|
150
151
|
- Gemfile
|
151
152
|
- Gemfile.lock
|
152
153
|
- LICENSE.txt
|
@@ -162,6 +163,7 @@ files:
|
|
162
163
|
- lib/github-authentication.rb
|
163
164
|
- lib/github_authentication.rb
|
164
165
|
- lib/github_authentication/cache.rb
|
166
|
+
- lib/github_authentication/environment.rb
|
165
167
|
- lib/github_authentication/generator.rb
|
166
168
|
- lib/github_authentication/generator/app.rb
|
167
169
|
- lib/github_authentication/generator/personal.rb
|
@@ -179,7 +181,6 @@ metadata:
|
|
179
181
|
homepage_uri: https://github.com/Shopify/github-authentication
|
180
182
|
source_code_uri: https://github.com/Shopify/github-authentication
|
181
183
|
allowed_push_host: https://rubygems.org
|
182
|
-
post_install_message:
|
183
184
|
rdoc_options: []
|
184
185
|
require_paths:
|
185
186
|
- lib
|
@@ -187,15 +188,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
188
|
requirements:
|
188
189
|
- - ">="
|
189
190
|
- !ruby/object:Gem::Version
|
190
|
-
version:
|
191
|
+
version: 2.7.0
|
191
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
193
|
requirements:
|
193
194
|
- - ">="
|
194
195
|
- !ruby/object:Gem::Version
|
195
196
|
version: '0'
|
196
197
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
198
|
-
signing_key:
|
198
|
+
rubygems_version: 3.7.1
|
199
199
|
specification_version: 4
|
200
200
|
summary: GitHub Authetication
|
201
201
|
test_files: []
|