Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
45604cd
AWS Lambda deploy
rowanhogan Sep 7, 2020
73287b2
Add prod config
rowanhogan Sep 7, 2020
cc2682b
Include oembed info in /iframely endpoint (or, one endpoint to rule t…
rowanhogan Sep 8, 2020
04650c9
Remove cache to avoid issues
rowanhogan Sep 25, 2020
0bbcff7
Add fb access token to fetch FB oembeds
danhenderson Feb 1, 2021
322261e
Fix failing spec
rowanhogan Aug 13, 2021
f1353ae
Migrate to CircleCI
rowanhogan Aug 13, 2021
e32401e
Update node version
rowanhogan Feb 16, 2022
a4b8454
Allow CORS
rowanhogan Feb 17, 2022
beaba94
Add important links
danhenderson Mar 10, 2022
3169674
2835109: update node runtime to v18
lewiscodes Feb 20, 2024
be41432
Merge pull request #1 from blackbaud-services/feature/nodev18
lewiscodes Feb 20, 2024
fe11055
2835109: downgrade circleci node version to 16 (18 doesn't exist)
lewiscodes Feb 20, 2024
1a2f72d
Merge pull request #2 from blackbaud-services/feature/nodev18
lewiscodes Feb 20, 2024
3bc4a24
2835109: replace @adobe/helix-fetch with @adobe/fetch, upgrade cheeri…
lewiscodes Feb 20, 2024
1d74b9c
Merge pull request #3 from blackbaud-services/hotfix/securityVulnerab…
lewiscodes Feb 21, 2024
21a472a
2835109: upgrade ejs and mocha versions to fix vulnerabilities
lewiscodes Feb 21, 2024
c3deade
2835109: add resolution to fix security vulnerability in jslint
lewiscodes Feb 21, 2024
9da6446
Merge pull request #4 from blackbaud-services/hotfix/securityVulnerab…
lewiscodes Feb 21, 2024
ca37815
2835109: upgrade mongoose version to fix vulnerabilities
lewiscodes Feb 21, 2024
1c39b51
2835109: upgrade probe-image-size version to fix vulnerabilities and …
lewiscodes Feb 21, 2024
e4ca995
Merge pull request #5 from blackbaud-services/hotfix/securityVulnerab…
lewiscodes Feb 21, 2024
72871e3
2835109: upgrade chai version to fix vulnerabilities
lewiscodes Feb 21, 2024
dced0e7
2835109: upgrade async version to fix vulnerabilities
lewiscodes Feb 21, 2024
5bdd1a2
Merge pull request #6 from blackbaud-services/hotfix/securityVulnerab…
lewiscodes Feb 21, 2024
cc02c0b
2835109: upgrade express and momoent versions to fix vulnerabilities
lewiscodes Feb 21, 2024
5027237
Merge pull request #7 from blackbaud-services/hotfix/securityVulnerab…
lewiscodes Feb 21, 2024
9de4ef5
2835109: upgrade supertest version and added resolutions for qs and j…
lewiscodes Feb 21, 2024
7ed8ccf
Merge pull request #8 from blackbaud-services/hotfix/securityVulnerab…
lewiscodes Feb 21, 2024
5d3b19e
Create checkmarx.yml
usman-khan-blacbaud Mar 13, 2024
3d1cbfe
Add .whitesource configuration file
mend-for-github-com[bot] Apr 11, 2024
d8fffeb
Merge pull request #9 from blackbaud-services/whitesource/configure
elliot Apr 11, 2024
e70a577
deploy to eu-west-2 region in AWS
lewiscodes Aug 6, 2024
4b7468c
skip failing tests (for now)
lewiscodes Aug 6, 2024
8bc5a3c
Create cx-one.yml
usman-khan-blacbaud Oct 23, 2024
a71fe4c
3163809: added whitelist to repo as zscaler is blocking getting it fr…
lewiscodes Dec 3, 2024
b8fab6a
Merge branch 'master' of github.com:blackbaud-services/iframely
lewiscodes Dec 3, 2024
5ea3462
3145661: upgrade node to v20
lewiscodes Jan 9, 2025
9b6b6ef
Merge pull request #16 from blackbaud-services/feature/node20
lewiscodes Jan 9, 2025
3bbcab9
comment out beforeAll for tests that are skipped
lewiscodes Jan 9, 2025
03d1d77
Merge pull request #17 from blackbaud-services/feature/node20
lewiscodes Jan 9, 2025
e8c8365
Delete .github/workflows/checkmarx.yml
usman-khan-blacbaud Jan 14, 2025
af0bdf2
Update cx-one.yml
usman-khan-blacbaud Jan 14, 2025
d297345
3603087: upgrade to node v22
lewiscodes Feb 3, 2026
4dc5b67
Merge pull request #18 from blackbaud-services/feature/node22
lewiscodes Feb 3, 2026
f6e16da
Delete .github/workflows/cx-one.yml
bbzachstewart Mar 27, 2026
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
47 changes: 47 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2.1

orbs:
aws-cli: circleci/aws-cli@1.3.1

workflows:
version: 2
master:
jobs:
- deploy:
filters:
branches:
only: master

commands:
build:
steps:
- checkout
- aws-cli/install
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies 📦
command: yarn install --ignore-engines
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
test:
steps:
- run:
name: Test 🛠
command: yarn test-core-plugins
deploy:
steps:
- run:
name: Deploy 🚢
command: yarn deploy

jobs:
deploy:
docker:
- image: cimg/node:22.22.0
steps:
- build
- test
- deploy
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export FACEBOOK_APP_ID=
export FACEBOOK_APP_SECRET=
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_modules
config.local.js
test/test2.js
static/test
iframely-*.json

node_modules083
node_modules2
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"scanSettings": {
"configMode": "AUTO",
"configExternalURL": "",
"projectToken": "",
"baseBranches": []
},
"scanSettingsSAST": {
"enableScan": false,
"scanPullRequests": false,
"incrementalScan": true,
"baseBranches": [],
"snippetSize": 10
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure",
"displayMode": "diff",
"useMendCheckNames": true
},
"checkRunSettingsSAST": {
"checkRunConclusionLevel": "failure",
"severityThreshold": "high"
},
"issueSettings": {
"minSeverityLevel": "LOW",
"issueType": "DEPENDENCY"
},
"remediateSettings": {
"workflowRules": {
"enabled": true
}
},
"imageSettings":{
"imageTracing":{
"enableImageTracingPR": false,
"addRepositoryCoordinate": false,
"addDockerfilePath": false,
"addMendIdentifier": false
}
}
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ Please submit your PR against `develop` branch. This is where everything gets me

MIT License. (c) 2012-2022 Itteco Software Corp. [Nazar Leush](https://github.com/nleush), [Ivan Paramonau](https://twitter.com/iparamonau) and the [contributors](https://github.com/itteco/iframely/graphs/contributors).

## Important Links

- [Pipeline](https://app.circleci.com/pipelines/github/blackbaud-services/iframely)
- [API Gateway](https://us-east-1.console.aws.amazon.com/apigateway/home?region=us-east-1#/apis/tmc9fp38w6/resources)
- [Lambda](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions/iframelyProd-iframelyProd-1CNBJQIOZ30IT)
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cacheMiddleware, NotFound } from './utils.js';
// import awsServerlessExpressMiddleware from 'aws-serverless-express/middleware'
import CONFIG from './config.loader.js';
global.CONFIG = CONFIG;

Expand Down Expand Up @@ -42,6 +43,7 @@ app.use(function(req, res, next) {
});

app.use(cacheMiddleware);
// app.use(awsServerlessExpressMiddleware.eventContext());

import apiViews from './modules/api/views.js';
import debugViews from './modules/debug/views.js';
Expand Down Expand Up @@ -174,4 +176,4 @@ app.get('/', function(req, res) {
res.end();
});

process.title = "iframely";
process.title = "iframely";
19 changes: 19 additions & 0 deletions bin/template.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs')
const { join } = require('path')

const generateTemplate = (from, to) => {
const fileContent = fs.readFileSync(`${__dirname}/../templates/${from}`, 'utf8')

const updatedContent = fileContent
.replace(/AWS_ACCOUNT_ID/g, process.env.AWS_ACCOUNT_ID)
.replace(/AWS_REGION/g, process.env.AWS_REGION)
.replace(/AWS_IAM_ROLE/g, process.env.AWS_IAM_ROLE)
.replace(/AWS_FN_NAME/g, process.env.AWS_FN_NAME)
.replace(/AWS_API_STAGE/g, process.env.AWS_API_STAGE)

const filePath = join(`${__dirname}/../${to}`)
fs.writeFileSync(filePath, updatedContent, 'utf-8')
}

generateTemplate('cloudformation.template.yaml', 'cloudformation.yaml')
generateTemplate('simple-proxy-api.template.yaml', 'simple-proxy-api.yaml')
8 changes: 8 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,14 @@
OEMBED_RELS_PRIORITY: ["app", "player", "survey", "image", "reader"],
OEMBED_RELS_MEDIA_PRIORITY: ["player", "survey", "image", "reader", "app"],

ADD_OEMBED_PARAMS: [{
// Facebook https://developers.facebook.com/docs/plugins/oembed/
re: [/^https:\/\/graph\.facebook\.com\/v\d+\.\d+\/oembed_/i],
params: {
access_token: `${process.env.FACEBOOK_APP_ID}|${process.env.FACEBOOK_APP_SECRET}`
}
}],

providerOptions: {
"readability": {},
"twitter.status": {}
Expand Down
11 changes: 11 additions & 0 deletions config.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
CACHE_ENGINE: 'no-cache',
allowedOrigins: ["*"],
baseAppUrl: "https://iframely.blackbaud.services",
providerOptions: {
locale: "en_US",
twitch: {
parent: 'blackbaud-sites.com,blackbaud.services'
}
}
}
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
build:
image: everydayhero/lambda:10
working_dir: /code
volumes:
- .:/code
environment:
- AWS_ACCESS_KEY_ID=${ACCESS_KEY}
- AWS_SECRET_ACCESS_KEY=${SECRET_KEY}
- AWS_ACCOUNT_ID
- AWS_REGION
- AWS_IAM_ROLE
- AWS_S3_BUCKET
- AWS_FN_NAME
32 changes: 32 additions & 0 deletions lambda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict'
import awsServerlessExpress from 'aws-serverless-express'
import app from './app.js'

// NOTE: If you get ERR_CONTENT_DECODING_FAILED in your browser, this is likely
// due to a compressed response (e.g. gzip) which has not been handled correctly
// by aws-serverless-express and/or API Gateway. Add the necessary MIME types to
// binaryMimeTypes below, then redeploy (`npm run package-deploy`)
const binaryMimeTypes = [
'application/javascript',
'application/json',
'application/octet-stream',
'application/xml',
'font/eot',
'font/opentype',
'font/otf',
'image/jpeg',
'image/png',
'image/svg+xml',
'text/comma-separated-values',
'text/css',
'text/html',
'text/javascript',
'text/plain',
'text/text',
'text/xml'
]
const server = awsServerlessExpress.createServer(app, null, binaryMimeTypes)

export const handler = (event, context) => awsServerlessExpress.proxy(server, event, context)

export default handler
2 changes: 1 addition & 1 deletion lib/fetch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { URL } from 'url';
import { h1NoCache, noCache, createUrl, AbortController, AbortError, FetchError } from '@adobe/helix-fetch';
import { h1NoCache, noCache, createUrl, AbortController, AbortError, FetchError } from '@adobe/fetch';
import log from '../logging.js';

const fetchKeepAlive = noCache({
Expand Down
16 changes: 9 additions & 7 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ export function parseJSONSource(text, decode) {
asBuffer: true
}, {
onResponse: function(res) {

abortController = res.abortController;

var content_type = res.headers['content-type'];
Expand All @@ -475,12 +474,15 @@ export function parseJSONSource(text, decode) {
imageResponseStarted = totalTime();
}
contentLength = parseInt(res.headers['content-length'] || '0', 10);
imagesize(res, function(error, data) {
if (data && data.type) {
data.format = data.type;
}
finishCb(error, data, 'imagesize');
});
imagesize(uri)
.then(data => {
if (data && data.type) {
data.format = data.type;
}

finishCb('', data, 'imagesize');
})
.catch(error => finishCb(error, {}, 'imagesize'))
} else {
finishCb(res.status, undefined, 'onResponse !200');
}
Expand Down
9 changes: 9 additions & 0 deletions modules/api/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ export default function(app) {
}
*/

if (getBooleanParam(req, 'oembed')) {
var oembed = oembedUtils.getOembed(uri, result, {
mediaPriority: getBooleanParam(req, 'media'),
omit_css: getBooleanParam(req, 'omit_css'),
targetWidthForResponsive: getIntParam(req, 'width')
});
result.oembed = oembed;
}

res.sendJsonCached(result);


Expand Down
37 changes: 25 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,25 @@
},
"license": "MIT",
"dependencies": {
"@adobe/helix-fetch": "^3.0.0",
"async": "2.4.1",
"cheerio": "^0.22.0",
"@adobe/fetch": "^4.1.1",
"async": "2.6.4",
"aws-serverless-express": "^3.3.6",
"cheerio": "1.0.0-rc.12",
"chokidar": "^3.3.1",
"ejs": "^3.1.6",
"ejs": "3.1.9",
"entities": "1.1.1",
"express": "^4.16.3",
"express": "4.18.2",
"globby": "^12.0.2",
"graceful-cluster": "0.0.3",
"htmlparser2": "^7.1.2",
"iconv-lite": "^0.6.3",
"jslint": "^0.12.1",
"jsontoxml": "0.0.11",
"memcached": "2.2.2",
"moment": "2.19.3",
"moment": "2.29.4",
"node-cache": "1.*",
"parse-iso-duration": "1.0.0",
"probe-image-size": "^5.0.0",
"probe-image-size": "6.0.0",
"readabilitySAX": "1.6.1",
"redis": "3.1.1",
"redis-clustr": "1.7.0",
Expand All @@ -48,19 +49,31 @@
"underscore": "^1.13.1"
},
"devDependencies": {
"chai": "^4.3.0",
"chai": "5.1.0",
"feedparser": "2.2.0",
"mocha": "^9.2.0",
"mocha": "10.3.0",
"mock-http-server": "^1.0.0",
"mongoose": "^5.13.7",
"supertest": "^4.0.2"
"mongoose": "5.13.20",
"supertest": "6.3.4"
},
"resolutions": {
"jslint/glob/minimatch": "3.0.5",
"mock-http-server/body-parser/qs": "6.7.3",
"redis-clustr/redis": "3.1.1",
"request/http-signature/jsprim/json-schema": "0.4.0",
"request/qs": "6.7.3"
},
"iframely-proxy-plugins": true,
"main": "./lib/core.js",
"scripts": {
"test": "npm run test-core-plugins && npm run test-e2e",
"test-core-plugins": "mocha --exit test/core-plugins.js",
"test-e2e": "NODE_ENV=test PORT=8080 mocha --exit test/e2e.js"
"test-e2e": "NODE_ENV=test PORT=8080 mocha --exit test/e2e.js",
"template": "AWS_API_STAGE=prod node bin/template.cjs",
"package": "aws cloudformation package --template ./cloudformation.yaml --s3-bucket $AWS_S3_BUCKET --s3-prefix iframely --output-template packaged-sam.yaml --region eu-west-2",
"upload": "aws cloudformation deploy --template-file packaged-sam.yaml --stack-name $AWS_FN_NAME --capabilities CAPABILITY_IAM --region eu-west-2",
"delete-stack": "aws cloudformation delete-stack --stack-name $AWS_FN_NAME --region eu-west-2",
"deploy": "yarn template && yarn package && yarn upload"
},
"engines": {
"node": ">=12.0"
Expand Down
Loading