Skip to content

Commit 6ea6989

Browse files
Merge branch 'freeCodeCamp:main' into main
2 parents be73683 + 171ba13 commit 6ea6989

File tree

684 files changed

+37195
-3442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

684 files changed

+37195
-3442
lines changed

.github/workflows/crowdin-upload.client-ui.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: i18n - Upload Client UI
22
on:
33
workflow_dispatch:
44
schedule:
5-
# runs every weekday at 11:15 AM UTC
6-
- cron: '15 11 * * 1-5'
5+
# runs every weekday at 7:15 AM UTC
6+
- cron: '15 7 * * 1-5'
77

88
env:
99
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/crowdin-upload.curriculum.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: i18n - Upload Curriculum
22
on:
33
workflow_dispatch:
44
schedule:
5-
# runs every weekday at 11:30 AM UTC
6-
- cron: '30 11 * * 1-5'
5+
# runs every weekday at 7:30 AM UTC
6+
- cron: '30 7 * * 1-5'
77

88
env:
99
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/deploy.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ on:
1111
- info
1212
- warn
1313
default: info
14-
push:
15-
branches:
16-
- prod-*
1714

1815
jobs:
1916
static:

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![freeCodeCamp Social Banner](https://cdn.freecodecamp.org/platform/universal/fcc_banner_new.png)](https://www.freecodecamp.org/)
22

3-
[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)
4-
[![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/)
3+
[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://makeapullrequest.com)
4+
[![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://www.firsttimersonly.com/)
55
[![Open Source Helpers](https://www.codetriage.com/freecodecamp/freecodecamp/badges/users.svg)](https://www.codetriage.com/freecodecamp/freecodecamp)
66
[![Setup Automated](https://img.shields.io/badge/setup-automated-blue?logo=gitpod)](https://gitpod.io/from-referrer/)
77
[![Discord](https://img.shields.io/discord/692816967895220344?logo=discord&label=Discord&color=5865F2)](https://discord.gg/PRyKn3Vbay)
@@ -257,10 +257,6 @@ Recent Contributions:
257257

258258
![Alt](https://repobeats.axiom.co/api/embed/89be0a1a1c8f641c54f9234a7423e7755352c746.svg 'Repobeats analytics image')
259259

260-
### Platform, Build, and Deployment Status
261-
262-
The general platform status for all our applications is available at [`status.freecodecamp.org`](https://status.freecodecamp.org). The build and deployment status for the code is available in [our DevOps Guide](https://contribute.freecodecamp.org/#/devops).
263-
264260
### License
265261

266262
Copyright © 2025 freeCodeCamp.org

api/src/plugins/bouncer.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => {
1919
'send401IfNoUser',
2020
async function (req: FastifyRequest, reply: FastifyReply) {
2121
if (!req.user) {
22+
const logger = fastify.log.child({ req });
23+
24+
logger.debug(
25+
'User tried to access a protected route without being authenticated.'
26+
);
27+
2228
await reply.status(401).send({
2329
type: req.accessDeniedMessage?.type,
2430
message: req.accessDeniedMessage?.content
@@ -30,7 +36,11 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => {
3036
fastify.decorate(
3137
'redirectIfNoUser',
3238
async function (req: FastifyRequest, reply: FastifyReply) {
39+
const logger = fastify.log.child({ req });
3340
if (!req.user) {
41+
logger.debug(
42+
'User tried to access a protected route without being authenticated.'
43+
);
3444
const { origin } = getRedirectParams(req);
3545
await reply.redirectWithMessage(origin, {
3646
type: 'info',
@@ -45,7 +55,12 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => {
4555
'redirectIfSignedIn',
4656
async function (req: FastifyRequest, reply: FastifyReply) {
4757
if (req.user) {
58+
const logger = fastify.log.child({ req });
59+
4860
const { returnTo } = getRedirectParams(req);
61+
62+
logger.debug(`User is being redirected to: ${returnTo}`);
63+
4964
await reply.redirect(returnTo);
5065
}
5166
}

api/src/plugins/cookie-update.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export const cookieUpdate: FastifyPluginCallback<Options> = (
2222
done
2323
) => {
2424
fastify.addHook('onSend', (request, reply, _payload, next) => {
25+
const logger = fastify.log.child({ request });
26+
2527
for (const cookie of options.cookies) {
2628
const oldCookie = request.cookies[cookie];
2729
if (!oldCookie) continue;
@@ -30,6 +32,9 @@ export const cookieUpdate: FastifyPluginCallback<Options> = (
3032
const raw = unsigned.valid ? unsigned.value : oldCookie;
3133
void reply.setCookie(cookie, raw, options.attributes);
3234
}
35+
36+
logger.debug('Updated cookies for user.');
37+
3338
next();
3439
});
3540

api/src/plugins/cookies.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const unsign = (rawValue: string): UnsignResult => {
5050
* @param done Callback to signal that the logic has completed.
5151
*/
5252
const cookies: FastifyPluginCallback = (fastify, _options, done) => {
53+
const logger = fastify.log.child({});
5354
void fastify.register(fastifyCookie, {
5455
secret: {
5556
sign,
@@ -71,6 +72,8 @@ const cookies: FastifyPluginCallback = (fastify, _options, done) => {
7172
void this.clearCookie('jwt_access_token');
7273
void this.clearCookie(CSRF_SECRET_COOKIE);
7374
void this.clearCookie(CSRF_COOKIE);
75+
76+
logger.debug('Clearing cookies for user.');
7477
});
7578

7679
done();

api/src/plugins/csrf.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const csrf: FastifyPluginCallback = (fastify, _options, done) => {
2626
});
2727

2828
// All routes except signout should add a CSRF token to the response
29-
fastify.addHook('onRequest', (_req, reply, done) => {
30-
const logger = fastify.log.child({ _req });
31-
const isSignout = _req.url === '/signout' || _req.url === '/signout/';
29+
fastify.addHook('onRequest', (req, reply, done) => {
30+
const logger = fastify.log.child({ req });
31+
const isSignout = req.url === '/signout' || req.url === '/signout/';
3232

3333
if (!isSignout) {
3434
logger.debug('Adding CSRF token to response');

api/src/plugins/not-found.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ import { getRedirectParams } from '../utils/redirection';
1414
const fourOhFour: FastifyPluginCallback = (fastify, _options, done) => {
1515
// If the request accepts JSON and does not specifically prefer text/html,
1616
// this will return a 404 JSON response. Everything else will be redirected.
17-
fastify.setNotFoundHandler((request, reply) => {
18-
const accepted = request.accepts().type(['json', 'html']);
17+
fastify.setNotFoundHandler((req, reply) => {
18+
const logger = fastify.log.child({ req });
19+
const accepted = req.accepts().type(['json', 'html']);
20+
21+
logger.debug('User requested path that does not exist');
1922

2023
if (accepted == 'json') {
2124
void reply.code(404).send({ error: 'path not found' });
2225
} else {
23-
const { origin } = getRedirectParams(request);
26+
const { origin } = getRedirectParams(req);
2427
void reply.status(302);
2528
void reply.redirectWithMessage(`${origin}/404`, {
2629
type: 'danger',
27-
content: `We couldn't find path ${request.url}`
30+
content: `We couldn't find path ${req.url}`
2831
});
2932
}
3033
});

api/src/plugins/security.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { FREECODECAMP_NODE_ENV } from '../utils/env';
55

66
const securityHeaders: FastifyPluginCallback = (fastify, _options, done) => {
77
// OWASP recommended headers
8-
fastify.addHook('onRequest', async (_request, reply) => {
8+
fastify.addHook('onRequest', async (req, reply) => {
9+
const logger = fastify.log.child({ req });
10+
11+
logger.debug('Adding security headers to response');
12+
913
void reply
1014
.header('Cache-Control', 'no-store')
1115
.header('Content-Security-Policy', "frame-ancestors 'none'")

0 commit comments

Comments
 (0)