From d21c67975c2d6274a39ee76318ca5f0403200a63 Mon Sep 17 00:00:00 2001 From: Necip Allef Date: Mon, 5 Aug 2024 17:13:36 +0300 Subject: [PATCH 1/7] docs: fix logo url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42baf49f..975ebc48 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ - + Fingerprint logo From 5e50e911381d172a7e08256bb7e94c36931ea9e9 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Tue, 13 Aug 2024 14:49:41 +0200 Subject: [PATCH 2/7] chore: update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2358606e..c8b75a21 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. # See https://help.github.com/articles/about-code-owners/ -* @sshelomentsev @TheUnderScorer @necipallef @Orkuncakilkaya +* @ilfa @TheUnderScorer @necipallef @Orkuncakilkaya From e13935f068edc0e7f1806c059b1c7a56586562d7 Mon Sep 17 00:00:00 2001 From: Necip Allef Date: Wed, 14 Aug 2024 16:29:10 +0300 Subject: [PATCH 3/7] fix: fix broken agent req caching due to age header --- proxy/utils/headers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/proxy/utils/headers.ts b/proxy/utils/headers.ts index 082d7c5c..26e6af95 100644 --- a/proxy/utils/headers.ts +++ b/proxy/utils/headers.ts @@ -6,6 +6,7 @@ import { CustomerVariables } from './customer-variables/customer-variables' import { getPreSharedSecret } from './customer-variables/selectors' const BLACKLISTED_HEADERS = new Set([ + 'age', 'connection', 'expect', 'keep-alive', From 5c10d618faf5e7dea496c4385a965c2ca68ded14 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 14 Aug 2024 16:30:46 +0000 Subject: [PATCH 4/7] chore(release): 2.0.3-rc.1 ## [2.0.3-rc.1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/compare/v2.0.2...v2.0.3-rc.1) (2024-08-14) ### Bug Fixes * fix broken agent req caching due to age header ([dcd6ae1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/commit/dcd6ae1ec8c737614a5dbc25d9185f5c813b36ea)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c3d9093..1281f87d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.0.3-rc.1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/compare/v2.0.2...v2.0.3-rc.1) (2024-08-14) + + +### Bug Fixes + +* fix broken agent req caching due to age header ([dcd6ae1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/commit/dcd6ae1ec8c737614a5dbc25d9185f5c813b36ea)) + ## [2.0.2](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/compare/v2.0.1...v2.0.2) (2024-07-23) diff --git a/package.json b/package.json index f0dc6645..9eb9bd9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fingerprintjs/fingerprint-pro-cloudfront-lambda-function", - "version": "2.0.2", + "version": "2.0.3-rc.1", "description": "Fingerprint Pro CloudFront lambda@edge function", "author": "FingerprintJS, Inc (https://fingerprint.com)", "license": "MIT", From a937f21768182552c2499bb2ba2b95112d00c8f0 Mon Sep 17 00:00:00 2001 From: Necip Allef Date: Wed, 14 Aug 2024 19:32:13 +0300 Subject: [PATCH 5/7] docs: update doc link from v1 -> v2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 975ebc48..e2ef78d4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Fingerprint Pro CloudFront Integration is responsible for - Proxying download requests of the latest Fingerprint Pro JS Agent between your site and Fingerprint CDN. - Proxying identification requests and responses between your site and Fingerprint Pro's APIs. -This [improves](https://dev.fingerprint.com/docs/cloudfront-proxy-integration#the-benefits-of-using-the-cloudfront-integration) both accuracy and reliability of visitor identification and bot detection on your site. +This [improves](https://dev.fingerprint.com/docs/cloudfront-proxy-integration-v2#the-benefits-of-using-the-cloudfront-integration) both accuracy and reliability of visitor identification and bot detection on your site. > [!IMPORTANT] > CloudFront integration v1 has been [deprecated](https://dev.fingerprint.com/docs/cloudfront-proxy-integration). From 9f81dca96430b43e9cf703948023f775d46ee25d Mon Sep 17 00:00:00 2001 From: Necip Allef Date: Mon, 26 Aug 2024 15:56:24 +0300 Subject: [PATCH 6/7] ci: restructure status check flow --- .github/workflows/e2e_test.yml | 53 +++++++++++++++++++++++++++++ buildspec-e2e-rc.yml | 36 ++------------------ buildspec-e2e.yml | 34 +----------------- buildspec-mock-e2e.yml | 34 +----------------- e2e/scripts/get-codebuild-status.sh | 5 --- scripts/downloadGithubRelease.mjs | 20 ++--------- 6 files changed, 60 insertions(+), 122 deletions(-) create mode 100644 .github/workflows/e2e_test.yml delete mode 100644 e2e/scripts/get-codebuild-status.sh diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml new file mode 100644 index 00000000..38c1415a --- /dev/null +++ b/.github/workflows/e2e_test.yml @@ -0,0 +1,53 @@ +name: AWS E2E + +on: + push: + branches: + - main + - rc + paths-ignore: + - '**.md' + - 'cloudformation/*.yml' + +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + +jobs: + RunE2E: + runs-on: ubuntu-latest + steps: + - name: Git clone + uses: actions/checkout@v4 + - name: configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: {{secrets.AWS_E2E_ROLE_ARN}} + aws-region: {{secrets.AWS_E2E_REGION}} + - name: Trigger AWS CodePipeline + run: | + codepipeline_execution_id=$(aws codepipeline start-pipeline-execution --name {{secrets.AWS_E2E_CODEPIPELINE_NAME}} --query 'pipelineExecutionId' --output text) + echo "Pipeline execution ID: $codepipeline_execution_id" + echo "codepipeline_execution_id=$codepipeline_execution_id" >> $GITHUB_ENV + - name: Poll Pipeline Status + id: poll-status + run: | + while true; do + sleep 30 + + status=$(aws codepipeline get-pipeline-execution \ + --pipeline-name necipallef_cloudfront \ + --pipeline-execution-id ${{ env.codepipeline_execution_id }} \ + --query 'pipelineExecution.status' --output text) + + echo "Current pipeline status: $status" + + if [[ "$status" == "Succeeded" ]]; then + echo "Pipeline execution succeeded!" + exit 0 + elif [[ "$status" == "Failed" ]]; then + echo "Pipeline execution failed!" + exit 1 + fi + + done diff --git a/buildspec-e2e-rc.yml b/buildspec-e2e-rc.yml index 90b12865..a195b363 100644 --- a/buildspec-e2e-rc.yml +++ b/buildspec-e2e-rc.yml @@ -1,7 +1,5 @@ version: 0.2 -env: - secrets-manager: - GITHUB_TOKEN: "fpjs-dev-cloudfront-secrets:GITHUB_TOKEN" + phases: install: runtime-versions: @@ -12,14 +10,6 @@ phases: - echo $CODEBUILD_SOURCE_VERSION - echo $CODEBUILD_BUILD_ID - echo $CODEBUILD_PUBLIC_BUILD_URL - - | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_ID \ - -d "{\"state\":\"pending\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/$AWS_ACCOUNT_ID/projects/fpjs-dev-cloudfront-lambda-e2e-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"E2E tests for release are running\",\"context\":\"e2e-release\"}" - ls -a - curl -fsSL https://get.pulumi.com | sh - export PATH=$PATH:$HOME/.pulumi/bin @@ -31,37 +21,15 @@ phases: pre_build: commands: - pwd - - pulumi version + - pulumi version - cd e2e/infra/lambda && pulumi stack init e2e && pulumi stack select e2e && cd ../../.. - cd e2e/infra/cloudfront && pulumi stack init e2e && pulumi stack select e2e && cd ../../.. - cd e2e/infra && pnpm run lambda:up && pnpm run lambda:export && pnpm run cloudfront:up && pnpm run cloudfront:export && cd ../.. - finally: - - | - if [ "$CODEBUILD_BUILD_SUCCEEDING" -eq 0 ]; then - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_ID \ - -d "{\"state\":\"error\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/$AWS_ACCOUNT_ID/projects/fpjs-dev-cloudfront-lambda-e2e-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"E2E tests for release failed during the pre-build step\",\"context\":\"e2e-release\"}" - fi build: commands: - ls -a - cd e2e/tests && pnpm test finally: - cd ../.. - - echo $CODEBUILD_BUILD_SUCCEEDING - echo $COMMIT_ID - - export STATUS=$(sh ./e2e/scripts/get-codebuild-status.sh) - - echo $STATUS - - | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_ID \ - -d "{\"state\":\"$STATUS\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/$AWS_ACCOUNT_ID/projects/fpjs-dev-cloudfront-lambda-e2e-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"E2E tests for release finished\",\"context\":\"e2e-release\"}" - cd e2e/infra && pnpm cloudfront:destroy && pnpm lambda:destroy && cd ../.. diff --git a/buildspec-e2e.yml b/buildspec-e2e.yml index a7004bb6..285805bc 100644 --- a/buildspec-e2e.yml +++ b/buildspec-e2e.yml @@ -1,7 +1,5 @@ version: 0.2 -env: - secrets-manager: - GITHUB_TOKEN: "fpjs-dev-cloudfront-secrets:GITHUB_TOKEN" + phases: install: runtime-versions: @@ -12,14 +10,6 @@ phases: - echo $COMMIT_SHA - echo $CODEBUILD_BUILD_ID - echo $CODEBUILD_PUBLIC_BUILD_URL - - | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_SHA \ - -d "{\"state\":\"pending\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/fpjs-dev-cloudfront-lambda-e2e-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"E2E tests are running\",\"context\":\"e2e\"}" - ls -a - curl -fsSL https://get.pulumi.com | sh - export PATH=$PATH:$HOME/.pulumi/bin @@ -35,33 +25,11 @@ phases: - cd infra/lambda && pnpm install && pulumi stack init e2e && pulumi stack select e2e && cd ../../ - cd infra/cloudfront && pnpm install && pulumi stack init e2e && pulumi stack select e2e && cd ../../ - cd infra && pnpm install && pnpm run lambda:up && pnpm run lambda:export && pnpm run cloudfront:up && pnpm run cloudfront:export && cd ../ - finally: - - | - if [ "$CODEBUILD_BUILD_SUCCEEDING" -eq 0 ]; then - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_SHA \ - -d "{\"state\":\"error\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/fpjs-dev-cloudfront-lambda-e2e-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"E2E tests failed during the pre-build step\",\"context\":\"e2e\"}" - fi build: commands: - ls -a - cd tests && pnpm test finally: - cd ../ - - echo $CODEBUILD_BUILD_SUCCEEDING - echo $COMMIT_SHA - - export STATUS=$(sh ./scripts/get-codebuild-status.sh) - - echo $STATUS - - | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_SHA \ - -d "{\"state\":\"$STATUS\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/fpjs-dev-cloudfront-lambda-e2e-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"E2E tests finished\",\"context\":\"e2e\"}" - cd infra && pnpm cloudfront:destroy && pnpm lambda:destroy && cd ../ diff --git a/buildspec-mock-e2e.yml b/buildspec-mock-e2e.yml index c01dcdd3..04641e73 100644 --- a/buildspec-mock-e2e.yml +++ b/buildspec-mock-e2e.yml @@ -1,7 +1,5 @@ version: 0.2 -env: - secrets-manager: - GITHUB_TOKEN: "fpjs-dev-cloudfront-secrets:GITHUB_TOKEN" + phases: install: runtime-versions: @@ -14,14 +12,6 @@ phases: - echo $VERSION - echo $CODEBUILD_BUILD_ID - echo $CODEBUILD_PUBLIC_BUILD_URL - - | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_SHA \ - -d "{\"state\":\"pending\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/fpjs-dev-cloudfront-lambda-e2e-mock-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"Mock E2E Tests are running\",\"context\":\"mock-e2e\"}" - ls -a - curl -fsSL https://get.pulumi.com | sh - export PATH=$PATH:$HOME/.pulumi/bin @@ -38,32 +28,10 @@ phases: - cd infra/lambda && pnpm install && pulumi stack init e2e && pulumi stack select e2e && cd ../../ - cd infra/cloudfront && pnpm install && pulumi stack init e2e && pulumi stack select e2e && cd ../../ - cd infra && pnpm install && pnpm run lambda:up && pnpm run lambda:export && pnpm run cloudfront:up && pnpm run cloudfront:export && cd ../ - finally: - - | - if [ "$CODEBUILD_BUILD_SUCCEEDING" -eq 0 ]; then - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_SHA \ - -d "{\"state\":\"error\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/fpjs-dev-cloudfront-lambda-e2e-mock-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"Mock E2E Tests failed during the pre-build step\",\"context\":\"mock-e2e\"}" - fi build: commands: - ts-node ./scripts/mockTests.ts --project=tsconfig.json finally: - - echo $CODEBUILD_BUILD_SUCCEEDING - echo $COMMIT_SHA - - export STATUS=$(sh ./scripts/get-codebuild-status.sh) - - echo $STATUS - - | - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN"\ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/fingerprintjs/fingerprint-pro-cloudfront-integration/statuses/$COMMIT_SHA \ - -d "{\"state\":\"$STATUS\",\"target_url\":\"https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/fpjs-dev-cloudfront-lambda-e2e-mock-tests/build/$CODEBUILD_BUILD_ID/?region=us-east-1\",\"description\":\"Mock E2E Tests finished\",\"context\":\"mock-e2e\"}" - cd infra && pnpm cloudfront:destroy && pnpm lambda:destroy && cd ../ diff --git a/e2e/scripts/get-codebuild-status.sh b/e2e/scripts/get-codebuild-status.sh deleted file mode 100644 index dee8aff6..00000000 --- a/e2e/scripts/get-codebuild-status.sh +++ /dev/null @@ -1,5 +0,0 @@ -if [ "$CODEBUILD_BUILD_SUCCEEDING" = 1 ]; then - echo success -else - echo error -fi diff --git a/scripts/downloadGithubRelease.mjs b/scripts/downloadGithubRelease.mjs index 0ce05e84..6a05467c 100644 --- a/scripts/downloadGithubRelease.mjs +++ b/scripts/downloadGithubRelease.mjs @@ -4,7 +4,6 @@ import { fileURLToPath } from 'url' import Zip from 'adm-zip' const config = { - token: process.env.GITHUB_TOKEN, owner: 'fingerprintjs', repo: 'fingerprint-pro-cloudfront-integration', } @@ -31,7 +30,7 @@ async function main() { return } - const zip = await downloadReleaseAsset(asset.url, config.token) + const zip = await downloadReleaseAsset(asset.url) if (process.env.UNPACK_TO_DIST) { new Zip(zip).extractAllTo(path.resolve(dirname, '../dist'), true) @@ -40,10 +39,6 @@ async function main() { } } -function bearer(token) { - return `Bearer ${token}` -} - async function getGitHubRelease() { const commitId = process.env.COMMIT_ID @@ -95,25 +90,16 @@ async function getLatestGitHubRelease() { } async function doGitHubGetRequest(url) { - const response = await fetch(url, { - headers: config.token - ? { - Authorization: bearer(config.token), - } - : undefined, - }) + const response = await fetch(url) return await response.json() } -async function downloadReleaseAsset(url, token) { +async function downloadReleaseAsset(url) { const headers = { Accept: 'application/octet-stream', 'User-Agent': 'fingerprint-pro-cloudfront-integration', } - if (token) { - headers['Authorization'] = bearer(token) - } console.info('Downloading release asset...', url) From ce7a961529154c2ed14123da6319f0a6b1f50180 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 4 Sep 2024 13:31:07 +0000 Subject: [PATCH 7/7] chore(release): 2.0.3 ## [2.0.3](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/compare/v2.0.2...v2.0.3) (2024-09-04) ### Bug Fixes * fix broken agent req caching due to age header ([dcd6ae1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/commit/dcd6ae1ec8c737614a5dbc25d9185f5c813b36ea)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1281f87d..4b30f190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.0.3](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/compare/v2.0.2...v2.0.3) (2024-09-04) + + +### Bug Fixes + +* fix broken agent req caching due to age header ([dcd6ae1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/commit/dcd6ae1ec8c737614a5dbc25d9185f5c813b36ea)) + ## [2.0.3-rc.1](https://github.com/fingerprintjs/fingerprint-pro-cloudfront-integration/compare/v2.0.2...v2.0.3-rc.1) (2024-08-14) diff --git a/package.json b/package.json index 9eb9bd9a..7b968212 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fingerprintjs/fingerprint-pro-cloudfront-lambda-function", - "version": "2.0.3-rc.1", + "version": "2.0.3", "description": "Fingerprint Pro CloudFront lambda@edge function", "author": "FingerprintJS, Inc (https://fingerprint.com)", "license": "MIT",