Skip to content

Commit 6a9b210

Browse files
committed
Security and integration enhancements, dependency upgrades, bug fixes
Security Enhancements - Added URL validation for redirects through session.returnTo (CWE-601). - Fixed OAuth state parameter generation and handling to address CSRF attack vectors in the OAuth workflow. - Added additional sanitization for user input in database queries using $eq in MongoDB. API and Integration: - Unified formatting for authentication parameters in route definitions and passport.js configuration. - Refactored common code for OAuth 2 token processing in passport strategies to improve maintainability. - Reworked the GitHub and Twitch API integration examples with additional data from the APIs. - Reworked the Twilio API integration example to use Twilio’s sandbox servers and test phone numbers. - Upgraded the Pinterest API example to use v5 calls instead of the broken v1. - Reworked the Tumblr API integration example with additional data from the API. - Added a properly working OAuth 1.0a integration for Tumblr. - Removed sign-in by Snapchat due to increased difficulty for developers and a focus on hackathon participants. - Removed Foursquare OAuth authorization and updated the API demo with new examples. - Renamed Twitter to X (Some of the backend and code still reference Twitter due to upstream dependencies, and the login button is using Twitter colors pending X addition to bootstrap-social). Update/Upgrades: - Dropped support for Nodejs < 22 due to ESM module import issues prior to that version. - Migrated from the unmaintained passport-linkedin-oauth2 to a passport-openidconnect strategy. --- Added support and examples for openid-client. - Migrated from the deprecated paypal-rest-sdk to an example without the SDK, providing OAuth calls depending on the page state. - Migrated from the unmaintained bootstrap-social to a fork that can be easily patched and updated. - Migrated eslint to v9, and its new config format (breaking change). - Migrated Husky to v9, and its new config format (breaking change). Fixed Windows commit issue. - Updated dependencies. - Added temporary patch files for connect-flash and passport-openidconnect based on pending pull requests or issues on GitHub. Other: - Fixed a bug that prevented profile pictures from being displayed. - Added authentication link/unlink options to the user profile page for all OAuth/Identity providers. - Fixed typos, broken links, and minor formatting alignment issues on various pages. - Fixed spelling errors in startup information displayed in the console. - Refactored URL validation in unit tests for Gravatar generation to conform with CodeQL rules. Even though CodeQL does vulnerability checks, this is not a security issue since it is unit tests. - Updated the placeholder main.js to use the current format (not deprecated JS). - Updated the GitHub repo worker/runner configs to use proper permissions - Return exit code 1 if there is a database connection issue at startup. - Added the --trace-deprecation flag to startup to provide better information on runtime deprecation warnings. - .gitignore file to exclude the uploads path. - Updated the copyright year. - Updated documentation.
1 parent ed7f82d commit 6a9b210

Some content is hidden

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

44 files changed

+5805
-3865
lines changed

.env.example

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,14 @@ NYT_KEY=9548be6f3a64163d23e1539f067fcabd:5:68537648
2525
LASTFM_KEY=c8c0ea1c4a6b199b3429722512fbd17f
2626
LASTFM_SECRET=is cb7857b8fba83f819ea46ca13681fe71
2727

28-
SNAPCHAT_ID=181f414f-9581-4498-be9a-a223d024cf10
29-
SNAPCHAT_SECRET=DyswCZGyuZl5BBEA1yWlcjyAoONB-_qw8WNodhc4hr4
30-
3128
FACEBOOK_ID=754220301289665
3229
FACEBOOK_SECRET=41860e58c256a3d7ad8267d3c1939a4a
3330

3431
GITHUB_ID=cb448b1d4f0c743a1e36
3532
GITHUB_SECRET=815aa4606f476444691c5f1c16b9c70da6714dc6
3633

37-
TWITTER_KEY=6NNBDyJ2TavL407A3lWxPFKBI
38-
TWITTER_SECRET=ZHaYyK3DQCqv49Z9ofsYdqiUgeoICyh6uoBgFfu7OeYC7wTQKa
34+
X_KEY=6NNBDyJ2TavL407A3lWxPFKBI
35+
X_SECRET=ZHaYyK3DQCqv49Z9ofsYdqiUgeoICyh6uoBgFfu7OeYC7wTQKa
3936

4037
GOOGLE_ID=828110519058.apps.googleusercontent.com
4138
GOOGLE_SECRET=JdZsIaWhUFIchmC1a_IZzOHb

.eslintrc

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/node.js.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3-
4-
name: Node.js CI
1+
name: Node.js CI with CodeQL
52

63
on:
74
push:
85
branches: [ "master" ]
96
pull_request:
107
branches: [ "master" ]
118

9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
security-events: write
13+
1214
jobs:
1315
build:
14-
1516
runs-on: ubuntu-latest
16-
1717
strategy:
1818
matrix:
19-
node-version: [18.x, 20.x]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21-
19+
node-version: [ 22.x ]
2220
steps:
23-
- uses: actions/checkout@v3
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm install
30-
- run: npm run lint
31-
- run: npm run test
21+
- uses: actions/checkout@v4
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
- run: npm install
28+
- run: npm run lint
29+
- run: npm run test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public/css/main.css
2727
node_modules
2828
bower_components
2929

30+
# Uploads
31+
uploads
32+
3033
# Editors
3134
.idea
3235
.vscode

.husky/pre-commit

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
npm run lintStage
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm test

CHANGELOG.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
11
# Changelog
22
---------
33

4+
### 8.1.0 (February 1, 2025)
5+
Security Enhancements
6+
- Added URL validation for redirects through session.returnTo (CWE-601).
7+
- Fixed OAuth state parameter generation and handling to address CSRF attack vectors in the OAuth workflow.
8+
- Added additional sanitization for user input in database queries using $eq in MongoDB.
9+
10+
API and Integration:
11+
- Unified formatting for authentication parameters in route definitions and passport.js configuration.
12+
- Refactored common code for OAuth 2 token processing in passport strategies to improve maintainability.
13+
- Reworked the GitHub and Twitch API integration examples with additional data from the APIs.
14+
- Reworked the Twilio API integration example to use Twilio’s sandbox servers and test phone numbers.
15+
- Upgraded the Pinterest API example to use v5 calls instead of the broken v1.
16+
- Reworked the Tumblr API integration example with additional data from the API.
17+
- Added a properly working OAuth 1.0a integration for Tumblr.
18+
- Removed sign-in by Snapchat due to increased difficulty for developers and a focus on hackathon participants.
19+
- Removed Foursquare OAuth authorization and updated the API demo with new examples.
20+
- Renamed Twitter to X (Some of the backend and code still reference Twitter due to upstream dependencies, and the login button is using Twitter colors pending X addition to bootstrap-social).
21+
22+
Update/Upgrades:
23+
- Dropped support for Nodejs < 22 due to ESM module import issues prior to that version.
24+
- Migrated from the unmaintained passport-linkedin-oauth2 to a passport-openidconnect strategy.
25+
--- Added support and examples for openid-client.
26+
- Migrated from the deprecated paypal-rest-sdk to an example without the SDK, providing OAuth calls depending on the page state.
27+
- Migrated from the unmaintained bootstrap-social to a fork that can be easily patched and updated.
28+
- Migrated eslint to v9, and its new config format (breaking change).
29+
- Migrated Husky to v9, and its new config format (breaking change). Fixed Windows commit issue.
30+
- Updated dependencies.
31+
- Added temporary patch files for connect-flash and passport-openidconnect based on pending pull requests or issues on GitHub.
32+
33+
Other:
34+
- Fixed a bug that prevented profile pictures from being displayed.
35+
- Added authentication link/unlink options to the user profile page for all OAuth/Identity providers.
36+
- Fixed typos, broken links, and minor formatting alignment issues on various pages.
37+
- Fixed spelling errors in startup information displayed in the console.
38+
- Refactored URL validation in unit tests for Gravatar generation to conform with CodeQL rules. Even though CodeQL does vulnerability checks, this is not a security issue since it is unit tests.
39+
- Updated the placeholder main.js to use the current format (not deprecated JS).
40+
- Updated the GitHub repo worker/runner configs to use proper permissions
41+
- Return exit code 1 if there is a database connection issue at startup.
42+
- Added the --trace-deprecation flag to startup to provide better information on runtime deprecation warnings.
43+
- .gitignore file to exclude the uploads path.
44+
- Updated the copyright year.
45+
- Updated documentation.
46+
447
### 8.0.0 (July 28, 2023)
548

649
- Security: Renamed the cookie and set secure attribute for cookie transmission when https is present
@@ -47,7 +90,6 @@ API example changes:
4790
- Added missing parameters for the Lob's new API requirements
4891
- Improved the Last.fm API example as the artist image is no longer vended by last.fm
4992

50-
5193
### 7.0.0 (Mar 26, 2022)
5294
- Dropped support for Node.js <16
5395
- Switched to Bootstrap 5

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-2023 Sahat Yalkabov
3+
Copyright (c) 2014-2025 Sahat Yalkabov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)