Skip to content

Resolved a bug where previously video host with subdomain www. was not part of whitelist #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion models/software.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const mongoose = require('mongoose');
const { isURL } = require('validator');
const uniqueValidator = require('mongoose-unique-validator');
const { ALLOWED_VIDEO_HOST_WHITELIST } = require('../utils/config');

const softwareSchema = new mongoose.Schema(
{
Expand Down Expand Up @@ -101,7 +102,7 @@ const softwareSchema = new mongoose.Schema(
if (value) {
return isURL(value, {
protocols: ['http', 'https'],
host_whitelist: ['youtube.com', 'vimeo.com'],
host_whitelist: ALLOWED_VIDEO_HOST_WHITELIST,
});
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions requests/api/auth/post_auth_login.rest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ POST http://localhost:3001/api/auth/login
Content-Type: application/json

{
"email": "sample@example.com",
"password": "SamplePassword"
"email": "lecamiv920@activesniper.com",
"password": "password"
}
7 changes: 7 additions & 0 deletions utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ const MONGODB_URI = NODE_ENVIRONMENT === 'test'

const { FIREBASE_CLIENT_API_KEY } = process.env;
const ALLOWED_USERNAME_REGEX = '^[a-z0-9_]+$';
const ALLOWED_VIDEO_HOST_WHITELIST = [
'youtube.com',
'vimeo.com',
'www.youtube.com',
'www.vimeo.com',
];

module.exports = {
PORT,
NODE_ENVIRONMENT,
MONGODB_URI,
ALLOWED_USERNAME_REGEX,
FIREBASE_CLIENT_API_KEY,
ALLOWED_VIDEO_HOST_WHITELIST
};