-
Notifications
You must be signed in to change notification settings - Fork 0
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
Test npm - New Code Base #11
Open
williammanning
wants to merge
10
commits into
main
Choose a base branch
from
test-npm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1b22fee
Try with NPM
williammanning 39d5e5b
Update main.yml
williammanning 20c6fc4
Updated NPM
williammanning 6761a52
Update jfrog-sast.yml
williammanning 1b8b008
build-publish-npm
williammanning de1c694
Remove provenance
williammanning 84c22f8
Update jfrog-sast.yml
williammanning 72caf74
Updated with Autofix
williammanning c183d70
Update main.yml
williammanning e5d3253
Update main.yml
williammanning File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: GitHub Universe 24 - Sample Python Project | ||
name: GitHub Universe 24 - Sample NPM Project | ||
on: workflow_dispatch | ||
|
||
permissions: | ||
|
@@ -8,7 +8,7 @@ permissions: | |
contents: read #Ability to read the contents permission | ||
security-events: write # Required for uploading code scanning | ||
jobs: | ||
build-publish-python: | ||
build-publish-npm: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_REPO: 'docker-prod-local' | ||
|
@@ -39,24 +39,19 @@ jobs: | |
|
||
- name: configure jfrog environment | ||
run: | | ||
jf pip-config --repo-resolve=python-virtual | ||
|
||
- name: configure environment | ||
run: | | ||
python3 -m pip install --upgrade pip setuptools wheel sigstore | ||
wheel -h | ||
pip show setuptools | ||
echo $VIRTUAL_ENV | ||
jf npmc --repo-resolve=npm --repo-deploy=npm | ||
|
||
- name: build project | ||
run: | | ||
jf pip install -r requirements.txt --module=jfrog-python-example | ||
python setup.py sdist bdist_wheel | ||
cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT | ||
|
||
- name: publish python package | ||
run: | | ||
jf rt u dist/ python-virtual/example-projects/ --module=jfrog-python-example | ||
jf npm install --build-name=universe-npm-build --build-number=1.0.${{github.run_number}} | ||
jf rt build-add-git universe-npm-build 1.0.${{github.run_number}} | ||
jf rt build-collect-env universe-npm-build 1.0.${{github.run_number}} | ||
jf rt npm-publish --build-name=universe-npm-build --build-number=1.0.${{github.run_number}} | ||
jf audit --vuln | ||
jf scan --vuln | ||
jf rt build-publish universe-npm-build 1.0.${{github.run_number}} | ||
jf rt build-scan universe-npm-build 1.0.${{github.run_number}} | ||
jf rt build-promote universe-npm-build 1.0.${{github.run_number}} lego-npm-prod-local --status=production | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
@@ -96,14 +91,3 @@ jobs: | |
- name: build scan | ||
run: | | ||
jf build-scan --fail=false | ||
|
||
provenance: | ||
needs: [build-publish-python] | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | ||
with: | ||
image: ${{ needs.build-publish-python.outputs.image }} | ||
digest: ${{ needs.build-publish-python.outputs.digest }} | ||
private-repository: true | ||
secrets: | ||
registry-username: ${{ vars.JF_USER }} | ||
registry-password: ${{ secrets.JF_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.DS_Store | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
FROM alpine:3.18.6 | ||
|
||
RUN mkdir pythonExample | ||
RUN mkdir npmExample | ||
|
||
WORKDIR /pythonExample | ||
|
||
COPY requirements.txt . | ||
COPY pythonExample/* pythonExample/ | ||
|
||
# activating python script | ||
CMD ["pythonExample/pythonProj.py"] | ||
WORKDIR /npmExample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
# GitHubUniverse24 | ||
# Demo Repo for Github JFrog integration | ||
|
||
# Demo Repo for Github JFrog integration - NPM Version | ||
|
||
This repo is configured for demoing: | ||
|
||
1. Github OIDC authentication into JFrog Platform | ||
2. Github Frogbot OIDC authentication into JFrog Platform | ||
3. Github workflow with job summaries linking the workflow run into the resulting uploaded packages and build info along with security information | ||
|
||
* jfrog rt c show | ||
* rm -rf node_modules | ||
* jfrog rt npmc | ||
* jfrog rt npm-install --build-name=ZenNodeProject --build-number=1.0.1 | ||
* jfrog rt build-add-git ZenNodeProject 1.0.1 | ||
* jfrog rt build-collect-env ZenNodeProject 1.0.1 | ||
* jfrog rt npm-publish --build-name=ZenNodeProject --build-number=1.0.1 | ||
* jfrog rt build-publish ZenNodeProject 1.0.1 | ||
* Test | ||
* Good luck .. you'll need it |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
proxy: "localhost:3000", | ||
files: ["**/*.css", "**/*.pug", "**/*.js"], | ||
ignore: ["node_modules"], | ||
reloadDelay: 10, | ||
ui: false, | ||
notify: false, | ||
open: false, | ||
port: 3001, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// index.js | ||
|
||
/** | ||
* Required External Modules | ||
*/ | ||
|
||
const express = require("express"); | ||
const path = require("path"); | ||
const jwt = require('jsonwebtoken'); | ||
const User = require("./model/user"); | ||
/** | ||
* App Variables | ||
*/ | ||
const app = express(); | ||
Check notice Code scanning / 🐸 JFrog SAST Express Not Using Helmet
Express application lacks security middleware
|
||
const port = process.env.PORT || "3000"; | ||
/** | ||
* App Configuration | ||
*/ | ||
app.set("views", path.join(__dirname, "views")); | ||
app.set("view engine", "pug"); | ||
app.use(express.static(path.join(__dirname, "public"))); | ||
/** | ||
* Routes Definitions | ||
*/ | ||
app.get("/", (req, res) => { | ||
res.render("index", { title: "Home" }); | ||
}); | ||
|
||
app.get("/user", (req, res) => { | ||
res.render("user", { title: "Profile", userProfile: { nickname: "Auth0" } }); | ||
}); | ||
/** | ||
* Server Activation | ||
*/ | ||
app.listen(port, () => { | ||
console.log(`Listening to requests on http://localhost:${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const mongoose = require("mongoose"); | ||
|
||
const userSchema = new mongoose.Schema({ | ||
first_name: { type: String, default: null }, | ||
last_name: { type: String, default: null }, | ||
email: { type: String, unique: true }, | ||
password: { type: String }, | ||
token: { type: String }, | ||
}); | ||
|
||
module.exports = mongoose.model("user", userSchema); | ||
|
||
const user = await User.create({ | ||
first_name, | ||
last_name, | ||
email: email.toLowerCase(), // sanitize: convert email to lowercase | ||
password: encryptedPassword, | ||
}); | ||
|
||
// Create token | ||
const token = jwt.verify( | ||
{ user_id: user._id, email }, | ||
process.env.TOKEN_KEY, | ||
{ | ||
expiresIn: "2h", | ||
} | ||
); | ||
// save user token | ||
user.token = token; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "zen-website", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"publishConfig": { | ||
"registry": "https://soleng.jfrog.io/artifactory/api/npm/npm/" | ||
}, | ||
"scripts": { | ||
"dev": "nodemon ./index.js", | ||
"ui": "browser-sync start --config bs-config.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"browser-sync": "^2.26.13", | ||
"nodemon": "^2.0.6" | ||
}, | ||
"dependencies": { | ||
"babel": "^6.23.0", | ||
"express": "^4.17.1", | ||
"hoek": "^2.16.3", | ||
"lodash": "^3.10.1", | ||
"npm": "^6.14.8", | ||
"protobufjs": "^6.11.0", | ||
"pug": "^3.0.0", | ||
"jsonwebtoken": "^8.5.1", | ||
"cors": "^2.8.5", | ||
"mongoose": "^5.7.7", | ||
"nodemailer": "^6.3.1", | ||
"nodemailer-mailgun-transport": "^1.4.0", | ||
"url-slug": "^2.2.0", | ||
"validator": "^12.0.0", | ||
"open-graph": "0.2.6" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / 🐸 JFrog SAST
Express Not Using Helmet (JFrog SAST 🐸) Low