Skip to content

Commit 9f70210

Browse files
committed
added secrity test #65
1 parent ad45e44 commit 9f70210

File tree

1 file changed

+278
-0
lines changed

1 file changed

+278
-0
lines changed

test/unit/security_test.js

+278
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
// Security considerations outlined in section 10 of the OAuth 2.0 standard RFC(s)
2+
// https://datatracker.ietf.org/doc/html/rfc6749.html#section-10
3+
4+
const should = require('chai').should();
5+
6+
describe('Security', function () {
7+
8+
// https://datatracker.ietf.org/doc/html/rfc6749.html#section-10.1
9+
describe('10.1 - Client Authentication', function () {
10+
11+
12+
// Web application clients MUST ensure confidentiality of client passwords and
13+
// other client credentials. The authorization server MUST NOT issue client
14+
// passwords or other client credentials to native application or user-agent-based
15+
// application clients for the purpose of client authentication. The
16+
// authorization server MAY issue a client password or other credentials
17+
// for a specific installation of a native application client on a
18+
// specific device.
19+
it('should not issue client passwords or other client credentials for the purpose of client authentication.', function () {
20+
21+
});
22+
23+
24+
// When client authentication is not possible, the authorization server
25+
// SHOULD employ other means to validate the client's identity -- for
26+
// example, by requiring the registration of the client redirection URI
27+
// or enlisting the resource owner to confirm identity...
28+
it('should validate the client\'s identity by requiring the registration of the client redirection URI', function () {
29+
30+
});
31+
32+
33+
// A valid redirection URI is not sufficient to verify the client's identity
34+
// when asking for resource owner authorization but can be used to prevent
35+
// delivering credentials to a counterfeit client after obtaining resource
36+
// owner authorization.
37+
it('should validate the client\'s identity by enlisting the resource owner to confirm identity', function () {
38+
39+
});
40+
41+
// The authorization server must consider the security implications of
42+
// interacting with unauthenticated clients and take measures to limit
43+
// the potential exposure of other credentials (e.g., refresh tokens)
44+
// issued to such clients.
45+
it('should not expose refresh token to unauthenticated clients', function () {
46+
47+
});
48+
49+
});
50+
51+
// https://datatracker.ietf.org/doc/html/rfc6749.html#section-10.2
52+
describe('10.2 - Client Impersonation', function () {
53+
54+
// The authorization server MUST authenticate the client whenever
55+
// possible.
56+
it('should authenticate the client whenever possible. (untestable?)', function () {
57+
58+
});
59+
60+
// If the authorization server cannot authenticate the client
61+
// due to the client's nature, the authorization server MUST require the
62+
// registration of any redirection URI used for receiving authorization
63+
// responses and SHOULD utilize other means to protect resource owners
64+
// from such potentially malicious clients. For example, the
65+
// authorization server can engage the resource owner to assist in
66+
// identifying the client and its origin.
67+
it('should require the registration of any redirection URI used for receiving authorization responses.', function () {
68+
69+
});
70+
71+
// The authorization server SHOULD enforce explicit resource owner
72+
// authentication and provide the resource owner with information about
73+
// the client and the requested authorization scope and lifetime. It is
74+
// up to the resource owner to review the information in the context of
75+
// the current client and to authorize or deny the request.
76+
it('should provide the resource owner with information about the client and the requested authorization scope and lifetime.', function () {
77+
78+
});
79+
80+
// The authorization server SHOULD NOT process repeated authorization
81+
// requests automatically (without active resource owner interaction)
82+
// without authenticating the client or relying on other measures to
83+
// ensure that the repeated request comes from the original client and
84+
// not an impersonator.
85+
it('should NOT process repeated authorization requests automatically without authenticating the client to ensure that the repeated request comes from the original client and not an impersonator.', function () {
86+
87+
});
88+
89+
});
90+
91+
// https://datatracker.ietf.org/doc/html/rfc6749.html#section-10.3
92+
describe('10.3 - Access Tokens', function () {
93+
94+
95+
// Access token credentials (as well as any confidential access token
96+
// attributes) MUST be kept confidential in transit and storage, and
97+
// only shared among the authorization server, the resource servers the
98+
// access token is valid for, and the client to whom the access token is
99+
// issued...
100+
it('should keep access token credentials (and it\'s attributes) confidential in transit and at rest', function () {
101+
102+
});
103+
104+
105+
// ...Access token credentials MUST only be transmitted using TLS
106+
// as described in Section 1.6 with server authentication as defined by
107+
// [RFC2818].
108+
it('should transmit access token credentials using TLS (untestable?)', function () {
109+
110+
});
111+
112+
// When using the implicit grant type, the access token is transmitted
113+
// in the URI fragment, which can expose it to unauthorized parties.
114+
115+
// The authorization server MUST ensure that access tokens cannot be
116+
// generated, modified, or guessed to produce valid access tokens by
117+
// unauthorized parties.
118+
it('should ensure that access tokens cannot be generated, modified, or guessed to produce valid access tokens by unauthorized parties when using implicit grant type', function () {
119+
120+
});
121+
122+
// The client SHOULD request access tokens with the minimal scope
123+
// necessary. The authorization server SHOULD take the client identity
124+
// into account when choosing how to honor the requested scope and MAY
125+
// issue an access token with less rights than requested.
126+
it('should issue access token with less rights than requested by client identity and scope', function () {
127+
128+
});
129+
130+
});
131+
132+
// https://datatracker.ietf.org/doc/html/rfc6749.html#section-10.4
133+
describe('10.4 - Refresh Tokens', function () {
134+
135+
// Authorization servers MAY issue refresh tokens to web application
136+
// clients and native application clients.
137+
it('should issue a refresh token', function () {
138+
139+
});
140+
141+
// Refresh tokens MUST be kept confidential in transit and storage
142+
it('should have encrypted the refresh token', function () {
143+
144+
});
145+
146+
// The authorization server MUST maintain the binding between a refresh
147+
// token and the client to whom it was issued.
148+
it('should maintain the binding between the refresh token and client', function () {
149+
150+
});
151+
152+
// Refresh tokens MUST only be transmitted using TLS as described in
153+
// Section 1.6 with server authentication as defined by [RFC2818].
154+
it('should transmit refresh tokens using TLS (untestable?)', function () {
155+
156+
});
157+
158+
// The authorization server MUST verify the binding between the refresh
159+
// token and client identity whenever the client identity can be
160+
// authenticated. When client authentication is not possible, the
161+
// authorization server SHOULD deploy other means to detect refresh
162+
// token abuse.
163+
164+
// For example, the authorization server could employ refresh token
165+
// rotation in which a new refresh token is issued with every access
166+
// token refresh response. The previous refresh token is invalidated
167+
// but retained by the authorization server. If a refresh token is
168+
// compromised and subsequently used by both the attacker and the
169+
// legitimate client, one of them will present an invalidated refresh
170+
// token, which will inform the authorization server of the breach.
171+
it('should rotate the refresh token with each access token refresh response (necessary?)', function () {
172+
173+
});
174+
175+
// The authorization server MUST ensure that refresh tokens cannot be
176+
// generated, modified, or guessed to produce valid refresh tokens by
177+
// unauthorized parties.
178+
it('should ensure that refresh tokens cannot be generated, modified, or guessed to produce valid refresh tokens by unauthorized parties', function () {
179+
180+
});
181+
182+
183+
});
184+
185+
// https://datatracker.ietf.org/doc/html/rfc6749.html#section-10.5
186+
describe('10.5 - Authorization Codes', function () {
187+
188+
// The transmission of authorization codes SHOULD be made over a secure
189+
// channel, and the client SHOULD require the use of TLS with its
190+
// redirection URI if the URI identifies a network resource. Since
191+
// authorization codes are transmitted via user-agent redirections, they
192+
// could potentially be disclosed through user-agent history and HTTP
193+
// referrer headers.
194+
it('should transmit authorization code over a secure channel.', function () {
195+
196+
});
197+
198+
// Authorization codes operate as plaintext bearer credentials, used to
199+
// verify that the resource owner who granted authorization at the
200+
// authorization server is the same resource owner returning to the
201+
// client to complete the process. Therefore, if the client relies on
202+
// the authorization code for its own resource owner authentication, the
203+
// client redirection endpoint MUST require the use of TLS.
204+
it('should require the use of TLS with its redirection URI.', function () {
205+
206+
});
207+
208+
// Authorization codes MUST be short lived and single-use...
209+
it('should have short lived authorization code', function () {
210+
211+
});
212+
213+
it('should have singe-use authorization code', function () {
214+
215+
});
216+
217+
// If the authorization server observes multiple attempts to exchange an
218+
// authorization code for an access token, the authorization server
219+
// SHOULD attempt to revoke all access tokens already granted based on
220+
// the compromised authorization code.
221+
it('should revoke all access tokens granted when multiple authorization code for an access token exchanges have been attempted (I assume this means failed failed)', function () {
222+
223+
});
224+
225+
// If the client can be authenticated, the authorization servers MUST
226+
// authenticate the client and ensure that the authorization code was
227+
// issued to the same client.
228+
it('should authenticate the client and issue an authorization code to that same client', function () {
229+
230+
});
231+
232+
});
233+
234+
describe('10.6 - Authorization Code Redirection URI Manipulation', function () {
235+
236+
});
237+
238+
describe('10.7 - Resource Owner Password Credentials', function () {
239+
240+
});
241+
242+
describe('10.8 - Request Confidentiality', function () {
243+
244+
});
245+
246+
describe('10.9 - Ensuring Endpoint Authenticity', function () {
247+
248+
});
249+
250+
describe('10.10 - Credentials-Guessing Attacks', function () {
251+
252+
});
253+
254+
describe('10.11 - Phishing Attacks', function () {
255+
256+
});
257+
258+
describe('10.12 - Cross-Site Request Forgery', function () {
259+
260+
});
261+
262+
describe('10.13 - Clickjacking', function () {
263+
264+
});
265+
266+
describe('10.14 - Code Injection and Input Validation', function () {
267+
268+
});
269+
270+
describe('10.15 - Open Redirectors', function () {
271+
272+
});
273+
274+
describe('10.16 - Misuse of Access Token to Impersonate Resource Owner in Implicit Flow', function () {
275+
276+
});
277+
278+
});

0 commit comments

Comments
 (0)