entitlements-github-plugin 1.2.3 → 1.2.4
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/lib/entitlements/service/github.rb +32 -4
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 071c51c88ea969a0054354c03b389caa59e505d54a2fb75bcbdc9e85a6422101
|
|
4
|
+
data.tar.gz: 207da4d9282f67aab20d0cdc2d70b7c167744b193f78010c6404f8de53923801
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06d52ba0138200f3fde882c0b346850cd9d01c216aba74b565a87b960c8aa72aea1ac081de1e7414e2f2e38bdc025856449a276a5fcc3fd76a1f0013630273a9
|
|
7
|
+
data.tar.gz: 7aa06883ee15010437d009b96ac5831e5ca9cb1585e96b6f11ec626d3e43761343b0d21bb1907260a3faf3e76f0e2f18e716dc2db231e2182b59efa8f028b57a
|
|
@@ -369,9 +369,7 @@ module Entitlements
|
|
|
369
369
|
# Returns { code: <Integer>, data: <response data structure> }
|
|
370
370
|
Contract String => { code: Integer, data: C::Or[nil, Hash] }
|
|
371
371
|
def graphql_http_post_real(query)
|
|
372
|
-
uri =
|
|
373
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
|
374
|
-
http.use_ssl = uri.scheme == "https"
|
|
372
|
+
uri = graphql_uri
|
|
375
373
|
|
|
376
374
|
request = Net::HTTP::Post.new(uri)
|
|
377
375
|
request.add_field("Authorization", "bearer #{token}")
|
|
@@ -379,7 +377,7 @@ module Entitlements
|
|
|
379
377
|
request.body = JSON.generate("query" => query)
|
|
380
378
|
|
|
381
379
|
begin
|
|
382
|
-
response =
|
|
380
|
+
response = graphql_http.request(request)
|
|
383
381
|
|
|
384
382
|
if response.code != "200"
|
|
385
383
|
# The retry wrapper retries on 5xx, so log those at WARN to avoid misleading
|
|
@@ -411,11 +409,41 @@ module Entitlements
|
|
|
411
409
|
# Catch-all for any unexpected exception (network blip OR local code bug).
|
|
412
410
|
# We retry below via the synthesized 500, but log at ERROR because this
|
|
413
411
|
# branch can mask programming errors that operators must see.
|
|
412
|
+
reset_graphql_http
|
|
414
413
|
Entitlements.logger.error "Caught #{e.class} POSTing to #{uri}: #{e.message}"
|
|
415
414
|
{ code: 500, data: nil }
|
|
416
415
|
end
|
|
417
416
|
end
|
|
418
417
|
|
|
418
|
+
# Return the URI used for GraphQL requests.
|
|
419
|
+
Contract C::None => URI::Generic
|
|
420
|
+
def graphql_uri
|
|
421
|
+
@graphql_uri ||= URI.parse(File.join(octokit.api_endpoint, "graphql"))
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
# Return a started HTTP connection that can be reused across GraphQL requests.
|
|
425
|
+
Contract C::None => Net::HTTP
|
|
426
|
+
def graphql_http
|
|
427
|
+
@graphql_http ||= begin
|
|
428
|
+
uri = graphql_uri
|
|
429
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
430
|
+
http.use_ssl = uri.scheme == "https"
|
|
431
|
+
http.start
|
|
432
|
+
http
|
|
433
|
+
end
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
# Discard a failed GraphQL connection so the retry wrapper creates a new one.
|
|
437
|
+
Contract C::None => nil
|
|
438
|
+
def reset_graphql_http
|
|
439
|
+
http, @graphql_http = @graphql_http, nil
|
|
440
|
+
http.finish if http&.started?
|
|
441
|
+
nil
|
|
442
|
+
rescue IOError, SystemCallError => e
|
|
443
|
+
Entitlements.logger.warn "Failed to close GraphQL connection: #{e.message}"
|
|
444
|
+
nil
|
|
445
|
+
end
|
|
446
|
+
|
|
419
447
|
# Create a unique signature for this GitHub instance to identify it in a global cache.
|
|
420
448
|
#
|
|
421
449
|
# Takes no arguments.
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: entitlements-github-plugin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitHub, Inc. Security Ops
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: contracts
|