Skip to content

ImageSearch_Empty #29

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

Open
wants to merge 77 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
9afc57e
adding ShiftLeft GitHub action
Mar 10, 2022
04fb1cf
adding ShiftLeft build rules
Mar 10, 2022
ef642fb
Create main.yml
shiftleft-chuck Mar 10, 2022
dd12435
Update README.md
shiftleft-chuck Mar 10, 2022
f7e2055
Merge pull request #1 from shiftleft-chuck/demo-branch-1646930456
shiftleft-chuck Mar 17, 2022
c65654b
Delete main.yml
shiftleft-chuck Mar 24, 2022
b36e479
Merge pull request #2 from shiftleft-chuck/Delete_workflow_main
shiftleft-chuck Mar 24, 2022
d100d3d
Update shiftleft.yml
shiftleft-chuck Mar 24, 2022
7ff2891
Update shiftleft.yml
shiftleft-chuck Mar 24, 2022
0be9491
Merge pull request #4 from shiftleft-chuck/BuildRulesUpdate2
shiftleft-chuck Mar 24, 2022
cbc2a11
Update README.md
shiftleft-chuck Mar 24, 2022
9cd62f8
Merge pull request #5 from shiftleft-chuck/DemoReadMeUpdate
shiftleft-chuck Mar 24, 2022
7e3ec46
Update ImageLookup.js
shiftleft-chuck Mar 25, 2022
9f3ae5e
Merge pull request #6 from shiftleft-chuck/XSS_Sanitize_id11
shiftleft-chuck Mar 25, 2022
b526616
Update ImageLookup.js
shiftleft-chuck Mar 25, 2022
09b65fc
Merge pull request #8 from shiftleft-chuck/ReIntroduce_XSS
shiftleft-chuck Mar 25, 2022
622e8bd
Update ImageLookup.js
shiftleft-chuck Mar 25, 2022
b2ea44e
Merge pull request #9 from shiftleft-chuck/Re-Intro-XSS
shiftleft-chuck Mar 25, 2022
da1f7de
Update ImageLookup.js
shiftleft-chuck Mar 28, 2022
4df4a0a
Update shiftleft.yml
shiftleft-chuck Mar 28, 2022
d031b14
Merge pull request #12 from shiftleft-chuck/shiftleft-chuck-patch-3
shiftleft-chuck Mar 28, 2022
21aef4e
Update shiftleft.yml
shiftleft-chuck Mar 28, 2022
50f1bbf
Merge pull request #15 from shiftleft-chuck/shiftleft-chuck-patch-6
shiftleft-chuck Mar 28, 2022
36b75d4
Update ImageLookup.js
shiftleft-chuck Mar 28, 2022
f4c2ee3
Merge pull request #16 from shiftleft-chuck/Demo20220328c
shiftleft-chuck Mar 28, 2022
a0c0c95
Update shiftleft.yml
shiftleft-chuck Mar 28, 2022
b30efeb
Merge pull request #17 from shiftleft-chuck/Update_BuildRules_20220328
shiftleft-chuck Mar 29, 2022
ac1c72f
Update ImageLookup.js
shiftleft-chuck Mar 29, 2022
0ef550e
Merge pull request #19 from shiftleft-chuck/Demo_Intro_Vulnerabilitie…
shiftleft-chuck Mar 29, 2022
336f4b6
Update shiftleft.yml
shiftleft-chuck Mar 29, 2022
80d0c89
Merge pull request #21 from shiftleft-chuck/BuildRules-Update20220329
shiftleft-chuck Mar 29, 2022
e10ca87
Update shiftleft.yml
shiftleft-chuck Mar 29, 2022
2464e33
Update shiftleft.yml
shiftleft-chuck Mar 30, 2022
27b551d
Merge pull request #22 from shiftleft-chuck/Critical_Findings_Test_20…
shiftleft-chuck Mar 31, 2022
1fd5fb2
Update ImageLookup.js
shiftleft-chuck Apr 1, 2022
91374f8
Update shiftleft.yml
shiftleft-chuck Apr 1, 2022
7d40928
Merge pull request #23 from shiftleft-chuck/Test_AsMaster20220401
shiftleft-chuck Apr 1, 2022
30b22f2
Merge pull request #24 from shiftleft-chuck/Test_AsMaster_20220401
shiftleft-chuck Apr 1, 2022
7c98057
Update ImageLookup.js
shiftleft-chuck Apr 1, 2022
25fc417
Merge pull request #25 from shiftleft-chuck/shiftleft-chuck-patch-7
shiftleft-chuck Apr 1, 2022
5d35174
Update shiftleft.yml
shiftleft-chuck Apr 4, 2022
45ebf88
Update shiftleft.yml
shiftleft-chuck Apr 4, 2022
9cfae93
Update shiftleft.yml
shiftleft-chuck Apr 4, 2022
70f0c42
Update shiftleft.yml
shiftleft-chuck Apr 4, 2022
75049a1
Update shiftleft.yml
shiftleft-chuck Apr 4, 2022
c327ec6
Update shiftleft.yml
shiftleft-chuck Apr 6, 2022
14f9b3d
Update shiftleft.yml
shiftleft-chuck Apr 6, 2022
338875d
Update shiftleft.yml
shiftleft-chuck Apr 6, 2022
d5b6005
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
ab371bf
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
6f2530e
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
25b657b
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
d93ed04
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
74ecd27
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
d7b7a4c
Update shiftleft.yml
shiftleft-chuck Apr 7, 2022
2726103
Merge pull request #33 from shiftleft-chuck/shiftleft-chuck-patch-10
shiftleft-chuck Apr 7, 2022
a6c7c59
Update shiftleft.yml
shiftleft-chuck Apr 11, 2022
ba245c4
Update shiftleft.yml
shiftleft-chuck Apr 11, 2022
f711e58
Update shiftleft.yml
shiftleft-chuck Apr 11, 2022
1fc40c5
Update shiftleft.yml
shiftleft-chuck Apr 11, 2022
9c3b31f
Merge pull request #37 from shiftleft-chuck/shiftleft-chuck-patch-14
shiftleft-chuck Apr 11, 2022
b857627
Update shiftleft.yml
shiftleft-chuck Apr 12, 2022
595eeac
Update shiftleft.yml
shiftleft-chuck Apr 12, 2022
a25b1d8
Merge pull request #39 from shiftleft-chuck/shiftleft-chuck-patch-16
shiftleft-chuck Apr 12, 2022
9bc5058
Update shiftleft.yml
shiftleft-chuck Apr 12, 2022
08ec226
Merge pull request #42 from shiftleft-chuck/shiftleft-chuck-patch-19
shiftleft-chuck Apr 12, 2022
d71137f
Update shiftleft.yml
shiftleft-chuck Apr 12, 2022
0b983a0
Merge pull request #43 from shiftleft-chuck/shiftleft-chuck-patch-20
shiftleft-chuck Apr 12, 2022
8ddafca
Update shiftleft.yml
shiftleft-chuck Apr 12, 2022
b34e282
Merge pull request #45 from shiftleft-chuck/shiftleft-chuck-patch-22
shiftleft-chuck Apr 12, 2022
2fb3937
Update ImageLookup.js
shiftleft-chuck Apr 20, 2022
fca7b23
Merge pull request #47 from shiftleft-chuck/shiftleft-chuck-patch-24
shiftleft-chuck Apr 20, 2022
208d085
Update shiftleft.yml
shiftleft-chuck May 17, 2022
0658647
Merge pull request #49 from shiftleft-chuck/shiftleft-chuck-patch-26
shiftleft-chuck May 17, 2022
f77f59c
adding ShiftLeft GitHub action
Jun 1, 2022
a83238a
Update shiftleft.yml
shiftleft-chuck Jun 23, 2022
32023ef
Update shiftleft.yml
shiftleft-chuck Jun 23, 2022
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
52 changes: 52 additions & 0 deletions .github/workflows/shiftleft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
# This workflow integrates ShiftLeft NG SAST with GitHub
# Visit https://docs.shiftleft.io for help
name: ShiftLeft

on:
pull_request:
workflow_dispatch:

jobs:
NextGen-Static-Analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download ShiftLeft CLI
run: |
curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl
# ShiftLeft requires Java 1.8. Post the package step override the version
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 1.8
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: NextGen Static Analysis
run: ${GITHUB_WORKSPACE}/sl analyze --strict --wait --app shiftleft-js-demo --tag branch=${{ github.head_ref || steps.extract_branch.outputs.branch }} --js --cpg .
env:
SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }}

Build-Rules:
runs-on: ubuntu-latest
needs: NextGen-Static-Analysis
steps:
- uses: actions/checkout@v2
- name: Download ShiftLeft CLI
run: |
curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl
- name: Validate Build Rules
run: |
${GITHUB_WORKSPACE}/sl check-analysis --app shiftleft-js-demo \
--branch "${{ github.head_ref || steps.extract_branch.outputs.branch }}" \
--report \
--github-pr-number=${{github.event.number}} \
--github-pr-user=${{ github.repository_owner }} \
--github-pr-repo=${{ github.event.repository.name }} \
--github-token=${{ secrets.GITHUB_TOKEN }}
env:
SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }}


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NodeJS Tarpit
# NodeJS Tarpit - Chuck B. (edited)

An ExpressJS (tarpit) application using mongoDB.

Expand Down
20 changes: 20 additions & 0 deletions shiftleft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#source
# branch: master
build_rules:
- id: allow-zero-findings
finding_types:
- vuln
- secret
- insight
- "*"
severity:
- SEVERITY_HIGH_IMPACT
- SEVERITY_MEDIUM_IMPACT
- SEVERITY_LOW_IMPACT
threshold: 0

- id: reachable-oss-vuln
finding_types: [oss_vuln]
options:
reachable: true
num_findings: 0
24 changes: 24 additions & 0 deletions src/Controllers/ImageLookup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Checked in with propesed fix as master branch scan

const fs = require("fs");
const { logger } = require("../Logger");

Expand All @@ -7,9 +9,31 @@ class ImageLookup {
/* Can read any file in the server by passing the filename (image) in the query params */
/* ex: http GET http://localhost:8089/api/v1/image-lookup image=="package.json" */
const fileContent = fs.readFileSync(req.query.image).toString();

// ************************************************** Vulnerable Code Block *****

logger.debug(fileContent);
res.send(fileContent);
}

}

module.exports = ImageLookup;

/*
// ************************************************** Remediated Code Block *****

sanitizedStr = sanitizeString(fileContent)
logger.debug(sanitizedStr);
res.send(sanitizedStr);

}

}
function sanitizeString(str){
str = str.replace(/[^a-z0-9áéíóúñü \.,_-]/gim,"");
return str.trim();
}

module.exports = ImageLookup;
*/