Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8bbc328
Merge pull request #19 from contentstack/staging
aman19K Oct 25, 2023
cb6583c
sca-scan.yml
aravindbuilt May 17, 2024
d9f5024
jira.yml
aravindbuilt May 17, 2024
ebb5328
sast-scan.yml
aravindbuilt May 17, 2024
29aa536
codeql-analysis.yml
aravindbuilt May 17, 2024
3ff6586
sca-scan.yml
aravindbuilt Jan 20, 2025
f5fa397
jira.yml
aravindbuilt Jan 20, 2025
8f827a9
sast-scan.yml
aravindbuilt Jan 20, 2025
6547151
codeql-analysis.yml
aravindbuilt Jan 20, 2025
af827e3
Updated codeowners
aravindbuilt Jan 20, 2025
5f119a3
fix: update GitHub Actions to latest versions and update to node v22
harshithad0703 Feb 13, 2025
c739d23
fix: update data sync SDKs and dependencies to latest versions
harshithad0703 Feb 14, 2025
87db401
fix: update dependencies to latest versions
harshithad0703 Feb 14, 2025
2ed0e9f
Merge pull request #27 from contentstack/fix/dx-2138-node-v22
harshithad0703 Feb 14, 2025
75239f0
Merge branch 'master' into development
harshithad0703 Feb 14, 2025
33fac94
fix: update Node.js version to 22.x and release action versions updat…
harshithad0703 Mar 27, 2025
163450c
fix: dependencies
harshithad0703 Mar 27, 2025
110c597
Merge pull request #31 from contentstack/fix/dx-2326-update-datasync-…
harshithad0703 Mar 27, 2025
0042e45
fix: remove duplicate dependencies in package-lock.json
harshithad0703 Apr 1, 2025
c5db0b7
Merge pull request #28 from contentstack/development
harshithad0703 Apr 1, 2025
ae22b33
chore: update dependencies and remove unused package
harshithad0703 Apr 14, 2025
c0b3512
fix: update contentstack datasync SDK versions to 1.0.17 and 1.0.11
harshithad0703 Apr 15, 2025
86f0c33
Merge pull request #34 from contentstack/fix/dx-2390-snyk-vulnerability
harshithad0703 Apr 15, 2025
5a7291f
fix: add pre-commit hook for Snyk and Talisman scans; update dependen…
harshithad0703 Apr 21, 2025
082227a
Merge pull request #35 from contentstack/fix/dx-2779-pre-commit
harshithad0703 Apr 22, 2025
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
9 changes: 7 additions & 2 deletions .github/workflows/jira.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
types: [opened]
jobs:
security:
security-jira:
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}}
runs-on: ubuntu-latest
steps:
Expand All @@ -21,8 +21,13 @@ jobs:
project: ${{ secrets.JIRA_PROJECT }}
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
summary: |
${{ github.event.pull_request.title }}
Snyk | Vulnerability | ${{ github.event.repository.name }} | ${{ github.event.pull_request.title }}
description: |
PR: ${{ github.event.pull_request.html_url }}

fields: "${{ secrets.JIRA_FIELDS }}"
- name: Transition issue
uses: atlassian/gajira-transition@v3
with:
issue: ${{ steps.create.outputs.issue }}
transition: ${{ secrets.JIRA_TRANSITION }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "22.x"
- run: npm install

- name: get-package-details
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/sast-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: SAST Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-sast:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Semgrep Scan
run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v "${PWD}:/src" returntocorp/semgrep semgrep scan --config auto
2 changes: 1 addition & 1 deletion .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security:
security-sca:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand Down
69 changes: 69 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env sh
# Pre-commit hook to run Snyk and Talisman scans, completing both before deciding to commit

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Check if Snyk is installed
if ! command_exists snyk; then
echo "Error: Snyk is not installed. Please install it and try again."
exit 1
fi

# Check if Talisman is installed
if ! command_exists talisman; then
echo "Error: Talisman is not installed. Please install it and try again."
exit 1
fi

# Allow bypassing the hook with an environment variable
if [ "$SKIP_HOOK" = "1" ]; then
echo "Skipping Snyk and Talisman scans (SKIP_HOOK=1)."
exit 0
fi

# Initialize variables to track scan results
snyk_failed=false
talisman_failed=false

# Run Snyk vulnerability scan
echo "Running Snyk vulnerability scan..."
snyk test --all-projects > snyk_output.log 2>&1
snyk_exit_code=$?

if [ $snyk_exit_code -eq 0 ]; then
echo "Snyk scan passed: No vulnerabilities found."
elif [ $snyk_exit_code -eq 1 ]; then
echo "Snyk found vulnerabilities. See snyk_output.log for details."
snyk_failed=true
else
echo "Snyk scan failed with error (exit code $snyk_exit_code). See snyk_output.log for details."
snyk_failed=true
fi

# Run Talisman secret scan (continues even if Snyk failed)
echo "Running Talisman secret scan..."
talisman --githook pre-commit > talisman_output.log 2>&1
talisman_exit_code=$?

if [ $talisman_exit_code -eq 0 ]; then
echo "Talisman scan passed: No secrets found."
else
echo "Talisman scan failed (exit code $talisman_exit_code). See talisman_output.log for details."
talisman_failed=true
fi

# Evaluate results after both scans
if [ "$snyk_failed" = true ] || [ "$talisman_failed" = true ]; then
echo "Commit aborted due to issues found in one or both scans."
[ "$snyk_failed" = true ] && echo "- Snyk issues: Check snyk_output.log"
[ "$talisman_failed" = true ] && echo "- Talisman issues: Check talisman_output.log"
exit 1
fi

# If both scans pass, allow the commit
echo "All scans passed. Proceeding with commit.cd ."
rm -f snyk_output.log talisman_output.log
exit 0
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @contentstack/security-admin
* @contentstack/security-admin
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2023 Contentstack LLC <https://www.contentstack.com/>
Copyright (c) 2025 Contentstack LLC <https://www.contentstack.com/>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 13 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
const createError = require('http-errors')
const express = require('express')
const logger = require('morgan')
const rateLimit = require('express-rate-limit')
const app = express()
const nunjucks = require('nunjucks')
const helmet = require('helmet');

app.use(helmet());

const limiter = rateLimit({
windowMs: 15 * 60 * 1000,
max: 100,
message: 'Too many requests from this IP, please try again after 15 minutes',
standardHeaders: true,
legacyHeaders: false,
})
app.use(limiter)

//setting view and nunjuks configuration
app.set('view engine', 'html')
Expand Down
3 changes: 3 additions & 0 deletions middlewares/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const express = require('express')
const helmet = require('helmet');
const app = express();

app.use(helmet());

app.use('*', require('./locales'))
app.use('*', require('./partials'))

Expand Down
Binary file removed modules/datasync-filesystem-sdk-1.0.11.tgz
Binary file not shown.
Binary file removed modules/datasync-mongodb-sdk-1.0.4.tgz
Binary file not shown.
Loading
Loading