-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into remove-deprecated-dependency-querystring
- Loading branch information
Showing
6 changed files
with
60 additions
and
21 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
name: Semgrep | ||
|
||
on: | ||
pull_request: {} | ||
pull_request_target: {} | ||
push: | ||
branches: ["master"] | ||
branches: ["master", "main"] | ||
permissions: | ||
contents: read | ||
jobs: | ||
semgrep: | ||
name: Scan | ||
runs-on: ubuntu-latest | ||
container: | ||
image: returntocorp/semgrep | ||
if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: returntocorp/semgrep-action@v1 | ||
with: | ||
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} | ||
- uses: actions/checkout@v3 | ||
- run: semgrep ci | ||
env: | ||
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_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
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,6 +1,6 @@ | ||
{ | ||
"name": "samlp", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,24 +1,45 @@ | ||
const timekeeper = require('timekeeper'); | ||
const expect = require('chai').expect; | ||
const timekeeper = require("timekeeper"); | ||
const DOMParser = require("@auth0/xmldom").DOMParser; | ||
const expect = require("chai").expect; | ||
|
||
const utils = require('../lib/utils'); | ||
const utils = require("../lib/utils"); | ||
|
||
describe('utils', function () { | ||
describe('generateInstant', function () { | ||
it('should pad the millis appropriately', function () { | ||
const signedResponse = require("./fixture/signed_response"); | ||
|
||
describe("utils", function () { | ||
describe("generateInstant", function () { | ||
it("should pad the millis appropriately", function () { | ||
timekeeper.withFreeze(0, () => { | ||
expect(utils.generateInstant()).to.equal('1970-01-01T00:00:00.000Z'); | ||
expect(utils.generateInstant()).to.equal("1970-01-01T00:00:00.000Z"); | ||
}); | ||
}); | ||
}); | ||
describe('generateUniqueID', function() { | ||
it('should generate an ID 20 chars long', function() { | ||
describe("generateUniqueID", function () { | ||
it("should generate an ID 20 chars long", function () { | ||
expect(utils.generateUniqueID().length).to.equal(20); | ||
}); | ||
}); | ||
describe('generateUniqueID', function() { | ||
it('should generate an ID from the alphabet', function() { | ||
expect('abcdef0123456789'.split('')).to.include.members(utils.generateUniqueID().split('')); | ||
describe("generateUniqueID", function () { | ||
it("should generate an ID from the alphabet", function () { | ||
expect("abcdef0123456789".split("")).to.include.members( | ||
utils.generateUniqueID().split("") | ||
); | ||
}); | ||
}); | ||
describe("validateSignature", function () { | ||
describe("with custom signing certificate", function () { | ||
it("should validate the signature correctly", function () { | ||
const response = signedResponse.response; | ||
|
||
const req = { body: { SAMLResponse: response }, query: {} }; | ||
const element_type = "LOGOUT_RESPONSE"; | ||
const xml = new DOMParser().parseFromString(signedResponse.xml); | ||
const options = { signingCert: signedResponse.cert, deflate: true }; | ||
|
||
// should not throw errors | ||
expect(utils.validateSignature(req, element_type, xml, options)).to.be | ||
.undefined; | ||
}); | ||
}); | ||
}); | ||
}); |