firebase_id_token 3.0.0 → 4.1.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/test.yml +9 -8
- data/CHANGELOG.md +59 -1
- data/Gemfile +10 -0
- data/README.md +57 -28
- data/firebase_id_token.gemspec +6 -6
- data/lib/firebase_id_token/certificates/active_support.rb +92 -0
- data/lib/firebase_id_token/certificates/redis.rb +46 -0
- data/lib/firebase_id_token/certificates.rb +69 -60
- data/lib/firebase_id_token/configuration.rb +10 -2
- data/lib/firebase_id_token/exceptions/unsupported_cache_operation_error.rb +11 -0
- data/lib/firebase_id_token/signature.rb +30 -13
- data/lib/firebase_id_token/testing/certificates.rb +1 -1
- data/lib/firebase_id_token/version.rb +1 -1
- data/lib/firebase_id_token.rb +6 -6
- data/spec/firebase_id_token/certificates/active_support_spec.rb +43 -0
- data/spec/firebase_id_token/certificates/redis_spec.rb +39 -0
- data/spec/firebase_id_token/certificates_session_cookie_spec.rb +49 -0
- data/spec/firebase_id_token/signature_session_cookie_spec.rb +65 -0
- data/spec/firebase_id_token/signature_spec.rb +15 -1
- data/spec/firebase_id_token/signature_test_spec.rb +4 -0
- data/spec/firebase_id_token_spec.rb +1 -1
- data/spec/fixtures/files/jwt.json +4 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/support/certificates_shared_examples.rb +196 -0
- metadata +40 -25
- data/CODE_OF_CONDUCT.md +0 -74
- data/spec/firebase_id_token/certificates_spec.rb +0 -164
|
@@ -8,7 +8,8 @@ module FirebaseIdToken
|
|
|
8
8
|
let(:mock_certificates) do
|
|
9
9
|
allow(Certificates)
|
|
10
10
|
.to(receive(:find))
|
|
11
|
-
.with(an_instance_of(String), raise_error: raise_certificates_error
|
|
11
|
+
.with(an_instance_of(String), raise_error: raise_certificates_error,
|
|
12
|
+
source: :id_token)
|
|
12
13
|
.and_return(OpenSSL::X509::Certificate.new(jwt['certificate']))
|
|
13
14
|
end
|
|
14
15
|
|
|
@@ -31,6 +32,19 @@ module FirebaseIdToken
|
|
|
31
32
|
it 'returns nil with a invalid key format' do
|
|
32
33
|
expect(described_class.verify('aaa')).to be(nil)
|
|
33
34
|
end
|
|
35
|
+
|
|
36
|
+
it 'returns nil when the token has no sub claim' do
|
|
37
|
+
payload = {
|
|
38
|
+
'iss' => 'https://securetoken.google.com/firebase-id-token',
|
|
39
|
+
'aud' => 'firebase-id-token',
|
|
40
|
+
'exp' => Time.now.to_i + 3600,
|
|
41
|
+
'iat' => Time.now.to_i - 60
|
|
42
|
+
}
|
|
43
|
+
token = JWT.encode(payload,
|
|
44
|
+
OpenSSL::PKey::RSA.new(jwt['private_key']), 'RS256', kid: 'test')
|
|
45
|
+
|
|
46
|
+
expect(described_class.verify(token)).to be(nil)
|
|
47
|
+
end
|
|
34
48
|
end
|
|
35
49
|
|
|
36
50
|
describe '#verify!' do
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"private_key": "-----BEGIN RSA PRIVATE KEY-----\
|
|
3
|
-
"certificate": "-----BEGIN CERTIFICATE-----\
|
|
4
|
-
"jwt_token": "
|
|
5
|
-
"bad_jwt_token": "
|
|
2
|
+
"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEApNSNhB8hUjiSdbZQ66U5ZubeH5UatngujRp1wZSMRfVLFKMo\nQ4ykoVwQ9pNOoT5f4g5Vw2bzSfO5WU7KeS33u+DWaOXIB03823+zCIbtgMSfHdRm\nilg3vdXAFd1iZX4jrEe7EeiRV6n+s07369GRdkTZGOnTPkxau/3ooHn4BKd5IFAb\nttQFGY89P/URHtKxqJysaQR5SkOaL0JZo27h3UnJXtbEFgn3t6Z9lgnZee1lZ4D9\nR5dihH4IWnCP3WdpfSU7Ty5xJOvlcYuk3VJDvk+a4GHC3s0cvDi4RpKsoHL0MPES\na7yDlACqCyNwivPKYTkppgluxX+Od2bL0EFeQQIDAQABAoIBAC5jU2B3kl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qQ7iZPyWp7M8GDWhDSlnQfJsJBxVhiyMOR_di-_MOKiSDYYoR1tZBULj7nDaBZKbvywcG-pPybXvqCjXCQafga6GheFJdsAog1hyG3ObdqVsXUphVP5t_8KltLA"
|
|
6
6
|
}
|
data/spec/spec_helper.rb
CHANGED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# The ActiveSupport store lazily downloads certificates whenever it is
|
|
4
|
+
# instantiated over an empty cache, while the legacy Redis store only
|
|
5
|
+
# downloads them upon an explicit request. Examples whose outcome depends on
|
|
6
|
+
# the empty-cache behavior branch on the `lazy` option.
|
|
7
|
+
shared_examples_for 'a certificate store' do |opts = {}|
|
|
8
|
+
lazy = opts.fetch(:lazy, false)
|
|
9
|
+
|
|
10
|
+
before :each do
|
|
11
|
+
mock_request
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#request' do
|
|
15
|
+
it 'requests certificates when the cache is empty' do
|
|
16
|
+
expect(HTTParty).to receive(:get).
|
|
17
|
+
with(FirebaseIdToken::Certificates::URL)
|
|
18
|
+
described_class.request
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'does not requests certificates when the cache is written' do
|
|
22
|
+
expect(HTTParty).to receive(:get).
|
|
23
|
+
with(FirebaseIdToken::Certificates::URL).once
|
|
24
|
+
2.times { described_class.request }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe '#request!' do
|
|
29
|
+
if lazy
|
|
30
|
+
it 'always requests certificates' do
|
|
31
|
+
# The store lazily loads the empty cache once before the first
|
|
32
|
+
# explicit request, hence the extra call.
|
|
33
|
+
expect(HTTParty).to receive(:get).
|
|
34
|
+
with(FirebaseIdToken::Certificates::URL).exactly(3).times
|
|
35
|
+
2.times { described_class.request! }
|
|
36
|
+
end
|
|
37
|
+
else
|
|
38
|
+
it 'always requests certificates' do
|
|
39
|
+
expect(HTTParty).to receive(:get).
|
|
40
|
+
with(FirebaseIdToken::Certificates::URL).twice
|
|
41
|
+
2.times { described_class.request! }
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'sets the certificate expiration time as the cache TTL' do
|
|
46
|
+
described_class.request!
|
|
47
|
+
expect(described_class.ttl).to be > 3600
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'raises a error when certificates expires in less than 1 hour' do
|
|
51
|
+
allow(response).to receive(:headers) {{'cache-control' => low_cache}}
|
|
52
|
+
expect{ described_class.request! }.
|
|
53
|
+
to raise_error(FirebaseIdToken::Exceptions::CertificatesTtlError)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'raises a error when HTTP response code is other than 200' do
|
|
57
|
+
allow(response).to receive(:code) { 401 }
|
|
58
|
+
expect{ described_class.request! }.
|
|
59
|
+
to raise_error(FirebaseIdToken::Exceptions::CertificatesRequestError)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe '#request_anyway' do
|
|
64
|
+
if lazy
|
|
65
|
+
it 'also requests certificates' do
|
|
66
|
+
expect(HTTParty).to receive(:get).
|
|
67
|
+
with(FirebaseIdToken::Certificates::URL).twice
|
|
68
|
+
described_class.request_anyway
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
it 'also requests certificates' do
|
|
72
|
+
expect(HTTParty).to receive(:get).
|
|
73
|
+
with(FirebaseIdToken::Certificates::URL)
|
|
74
|
+
described_class.request_anyway
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe '.present?' do
|
|
80
|
+
if lazy
|
|
81
|
+
it 'returns true when the cache is empty, lazily fetching' do
|
|
82
|
+
expect(described_class.present?).to be(true)
|
|
83
|
+
end
|
|
84
|
+
else
|
|
85
|
+
it 'returns false when the cache is empty' do
|
|
86
|
+
expect(described_class.present?).to be(false)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'returns true when the cache is written' do
|
|
91
|
+
described_class.request
|
|
92
|
+
expect(described_class.present?).to be(true)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
describe '.all' do
|
|
97
|
+
context 'before requesting certificates' do
|
|
98
|
+
if lazy
|
|
99
|
+
it 'lazily fetches and returns the certificates' do
|
|
100
|
+
expect(described_class.all.first.values[0]).
|
|
101
|
+
to be_a(OpenSSL::X509::Certificate)
|
|
102
|
+
end
|
|
103
|
+
else
|
|
104
|
+
it 'returns a empty Array' do
|
|
105
|
+
expect(described_class.all).to eq([])
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
context 'after requesting certificates' do
|
|
111
|
+
it 'returns a array of hashes: String keys' do
|
|
112
|
+
described_class.request
|
|
113
|
+
expect(described_class.all.first.keys[0]).to be_a(String)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it 'returns a array of hashes: OpenSSL::X509::Certificate values' do
|
|
117
|
+
described_class.request
|
|
118
|
+
expect(described_class.all.first.values[0]).
|
|
119
|
+
to be_a(OpenSSL::X509::Certificate)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
describe '.find' do
|
|
125
|
+
context 'without certificates in the cache' do
|
|
126
|
+
if lazy
|
|
127
|
+
it 'lazily fetches certificates and finds the kid' do
|
|
128
|
+
expect(described_class.find(kid)).to be_a(OpenSSL::X509::Certificate)
|
|
129
|
+
end
|
|
130
|
+
else
|
|
131
|
+
it 'raises a exception' do
|
|
132
|
+
expect{ described_class.find(kid)}.
|
|
133
|
+
to raise_error(FirebaseIdToken::Exceptions::NoCertificatesError)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
context 'with certificates in the cache' do
|
|
139
|
+
it 'returns a OpenSSL::X509::Certificate when it finds the kid' do
|
|
140
|
+
described_class.request
|
|
141
|
+
expect(described_class.find(kid)).to be_a(OpenSSL::X509::Certificate)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it 'returns nil when it can not find the kid' do
|
|
145
|
+
described_class.request
|
|
146
|
+
expect(described_class.find('')).to be(nil)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
describe '.find!' do
|
|
152
|
+
context 'without certificates in the cache' do
|
|
153
|
+
if lazy
|
|
154
|
+
it 'lazily fetches certificates and finds the kid' do
|
|
155
|
+
expect(described_class.find!(kid)).to be_a(OpenSSL::X509::Certificate)
|
|
156
|
+
end
|
|
157
|
+
else
|
|
158
|
+
it 'raises a exception' do
|
|
159
|
+
expect{ described_class.find!(kid)}.
|
|
160
|
+
to raise_error(FirebaseIdToken::Exceptions::NoCertificatesError)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
context 'with certificates in the cache' do
|
|
166
|
+
it 'returns a OpenSSL::X509::Certificate when it finds the kid' do
|
|
167
|
+
described_class.request
|
|
168
|
+
expect(described_class.find!(kid)).to be_a(OpenSSL::X509::Certificate)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it 'raises a CertificateNotFound error when it can not find the kid' do
|
|
172
|
+
described_class.request
|
|
173
|
+
expect { described_class.find!('') }
|
|
174
|
+
.to raise_error(FirebaseIdToken::Exceptions::CertificateNotFound, /Unable to find/)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
describe '.ttl' do
|
|
181
|
+
it 'returns a positive number when has certificates in the cache' do
|
|
182
|
+
described_class.request
|
|
183
|
+
expect(described_class.ttl).to be > 0
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
if lazy
|
|
187
|
+
it 'returns a positive number when the cache is empty, lazily fetching' do
|
|
188
|
+
expect(described_class.ttl).to be > 0
|
|
189
|
+
end
|
|
190
|
+
else
|
|
191
|
+
it 'returns zero when has no certificates in the cache' do
|
|
192
|
+
expect(described_class.ttl).to eq(0)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: firebase_id_token
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fernando Schuindt
|
|
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: bundler
|
|
@@ -130,7 +129,7 @@ dependencies:
|
|
|
130
129
|
- - ">="
|
|
131
130
|
- !ruby/object:Gem::Version
|
|
132
131
|
version: 5.0.6
|
|
133
|
-
type: :
|
|
132
|
+
type: :development
|
|
134
133
|
prerelease: false
|
|
135
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
136
135
|
requirements:
|
|
@@ -147,7 +146,7 @@ dependencies:
|
|
|
147
146
|
- - "~>"
|
|
148
147
|
- !ruby/object:Gem::Version
|
|
149
148
|
version: '1.10'
|
|
150
|
-
type: :
|
|
149
|
+
type: :development
|
|
151
150
|
prerelease: false
|
|
152
151
|
version_requirements: !ruby/object:Gem::Requirement
|
|
153
152
|
requirements:
|
|
@@ -158,50 +157,62 @@ dependencies:
|
|
|
158
157
|
name: httparty
|
|
159
158
|
requirement: !ruby/object:Gem::Requirement
|
|
160
159
|
requirements:
|
|
161
|
-
- - "
|
|
160
|
+
- - ">="
|
|
162
161
|
- !ruby/object:Gem::Version
|
|
163
|
-
version: 0.
|
|
162
|
+
version: 0.24.0
|
|
163
|
+
- - "<"
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '1.0'
|
|
164
166
|
type: :runtime
|
|
165
167
|
prerelease: false
|
|
166
168
|
version_requirements: !ruby/object:Gem::Requirement
|
|
167
169
|
requirements:
|
|
168
|
-
- - "
|
|
170
|
+
- - ">="
|
|
169
171
|
- !ruby/object:Gem::Version
|
|
170
|
-
version: 0.
|
|
172
|
+
version: 0.24.0
|
|
173
|
+
- - "<"
|
|
174
|
+
- !ruby/object:Gem::Version
|
|
175
|
+
version: '1.0'
|
|
171
176
|
- !ruby/object:Gem::Dependency
|
|
172
177
|
name: jwt
|
|
173
178
|
requirement: !ruby/object:Gem::Requirement
|
|
174
179
|
requirements:
|
|
175
|
-
- - "
|
|
180
|
+
- - ">="
|
|
181
|
+
- !ruby/object:Gem::Version
|
|
182
|
+
version: '2.10'
|
|
183
|
+
- - "<"
|
|
176
184
|
- !ruby/object:Gem::Version
|
|
177
|
-
version: '
|
|
185
|
+
version: '4'
|
|
178
186
|
type: :runtime
|
|
179
187
|
prerelease: false
|
|
180
188
|
version_requirements: !ruby/object:Gem::Requirement
|
|
181
189
|
requirements:
|
|
182
|
-
- - "
|
|
190
|
+
- - ">="
|
|
191
|
+
- !ruby/object:Gem::Version
|
|
192
|
+
version: '2.10'
|
|
193
|
+
- - "<"
|
|
183
194
|
- !ruby/object:Gem::Version
|
|
184
|
-
version: '
|
|
195
|
+
version: '4'
|
|
185
196
|
- !ruby/object:Gem::Dependency
|
|
186
197
|
name: activesupport
|
|
187
198
|
requirement: !ruby/object:Gem::Requirement
|
|
188
199
|
requirements:
|
|
189
|
-
- - "~>"
|
|
190
|
-
- !ruby/object:Gem::Version
|
|
191
|
-
version: '7.0'
|
|
192
200
|
- - ">="
|
|
193
201
|
- !ruby/object:Gem::Version
|
|
194
202
|
version: 7.0.4.3
|
|
203
|
+
- - "<"
|
|
204
|
+
- !ruby/object:Gem::Version
|
|
205
|
+
version: '9'
|
|
195
206
|
type: :runtime
|
|
196
207
|
prerelease: false
|
|
197
208
|
version_requirements: !ruby/object:Gem::Requirement
|
|
198
209
|
requirements:
|
|
199
|
-
- - "~>"
|
|
200
|
-
- !ruby/object:Gem::Version
|
|
201
|
-
version: '7.0'
|
|
202
210
|
- - ">="
|
|
203
211
|
- !ruby/object:Gem::Version
|
|
204
212
|
version: 7.0.4.3
|
|
213
|
+
- - "<"
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: '9'
|
|
205
216
|
- !ruby/object:Gem::Dependency
|
|
206
217
|
name: json
|
|
207
218
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -222,7 +233,7 @@ dependencies:
|
|
|
222
233
|
- - ">="
|
|
223
234
|
- !ruby/object:Gem::Version
|
|
224
235
|
version: 2.6.3
|
|
225
|
-
description: A Ruby gem to verify the signature of Firebase ID Tokens. It uses
|
|
236
|
+
description: A Ruby gem to verify the signature of Firebase ID Tokens. It uses ActiveSupport::Cache
|
|
226
237
|
to store Google's x509 certificates and manage their expiration time, so you don't
|
|
227
238
|
need to request Google's API in every execution and can access it as fast as reading
|
|
228
239
|
from memory.
|
|
@@ -239,7 +250,6 @@ files:
|
|
|
239
250
|
- ".travis.yml"
|
|
240
251
|
- ".yardopts"
|
|
241
252
|
- CHANGELOG.md
|
|
242
|
-
- CODE_OF_CONDUCT.md
|
|
243
253
|
- Gemfile
|
|
244
254
|
- LICENSE.txt
|
|
245
255
|
- README.md
|
|
@@ -250,16 +260,22 @@ files:
|
|
|
250
260
|
- firebase_id_token.gemspec
|
|
251
261
|
- lib/firebase_id_token.rb
|
|
252
262
|
- lib/firebase_id_token/certificates.rb
|
|
263
|
+
- lib/firebase_id_token/certificates/active_support.rb
|
|
264
|
+
- lib/firebase_id_token/certificates/redis.rb
|
|
253
265
|
- lib/firebase_id_token/configuration.rb
|
|
254
266
|
- lib/firebase_id_token/exceptions/certificate_not_found.rb
|
|
255
267
|
- lib/firebase_id_token/exceptions/certificates_request_error.rb
|
|
256
268
|
- lib/firebase_id_token/exceptions/certificates_ttl_error.rb
|
|
257
269
|
- lib/firebase_id_token/exceptions/no_certificates_error.rb
|
|
270
|
+
- lib/firebase_id_token/exceptions/unsupported_cache_operation_error.rb
|
|
258
271
|
- lib/firebase_id_token/signature.rb
|
|
259
272
|
- lib/firebase_id_token/testing/certificates.rb
|
|
260
273
|
- lib/firebase_id_token/version.rb
|
|
261
|
-
- spec/firebase_id_token/
|
|
274
|
+
- spec/firebase_id_token/certificates/active_support_spec.rb
|
|
275
|
+
- spec/firebase_id_token/certificates/redis_spec.rb
|
|
276
|
+
- spec/firebase_id_token/certificates_session_cookie_spec.rb
|
|
262
277
|
- spec/firebase_id_token/configuration_spec.rb
|
|
278
|
+
- spec/firebase_id_token/signature_session_cookie_spec.rb
|
|
263
279
|
- spec/firebase_id_token/signature_spec.rb
|
|
264
280
|
- spec/firebase_id_token/signature_test_spec.rb
|
|
265
281
|
- spec/firebase_id_token_spec.rb
|
|
@@ -268,11 +284,11 @@ files:
|
|
|
268
284
|
- spec/fixtures/files/jwt.json
|
|
269
285
|
- spec/fixtures/files/payload.json
|
|
270
286
|
- spec/spec_helper.rb
|
|
287
|
+
- spec/support/certificates_shared_examples.rb
|
|
271
288
|
homepage: https://github.com/fschuindt/firebase_id_token
|
|
272
289
|
licenses:
|
|
273
290
|
- MIT
|
|
274
291
|
metadata: {}
|
|
275
|
-
post_install_message:
|
|
276
292
|
rdoc_options: []
|
|
277
293
|
require_paths:
|
|
278
294
|
- lib
|
|
@@ -287,8 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
287
303
|
- !ruby/object:Gem::Version
|
|
288
304
|
version: '0'
|
|
289
305
|
requirements: []
|
|
290
|
-
rubygems_version:
|
|
291
|
-
signing_key:
|
|
306
|
+
rubygems_version: 4.0.3
|
|
292
307
|
specification_version: 4
|
|
293
308
|
summary: A Firebase ID Token verifier.
|
|
294
309
|
test_files: []
|
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
-
orientation.
|
|
11
|
-
|
|
12
|
-
## Our Standards
|
|
13
|
-
|
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
|
15
|
-
include:
|
|
16
|
-
|
|
17
|
-
* Using welcoming and inclusive language
|
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
|
19
|
-
* Gracefully accepting constructive criticism
|
|
20
|
-
* Focusing on what is best for the community
|
|
21
|
-
* Showing empathy towards other community members
|
|
22
|
-
|
|
23
|
-
Examples of unacceptable behavior by participants include:
|
|
24
|
-
|
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
-
advances
|
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
-
* Public or private harassment
|
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
|
30
|
-
address, without explicit permission
|
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
-
professional setting
|
|
33
|
-
|
|
34
|
-
## Our Responsibilities
|
|
35
|
-
|
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
-
response to any instances of unacceptable behavior.
|
|
39
|
-
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
-
threatening, offensive, or harmful.
|
|
45
|
-
|
|
46
|
-
## Scope
|
|
47
|
-
|
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
-
when an individual is representing the project or its community. Examples of
|
|
50
|
-
representing a project or community include using an official project e-mail
|
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
|
53
|
-
further defined and clarified by project maintainers.
|
|
54
|
-
|
|
55
|
-
## Enforcement
|
|
56
|
-
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at f.schuindtcs@gmail.com. All
|
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
|
63
|
-
|
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
-
members of the project's leadership.
|
|
67
|
-
|
|
68
|
-
## Attribution
|
|
69
|
-
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
-
|
|
73
|
-
[homepage]: http://contributor-covenant.org
|
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|