Skip to content

Commit 6ef2754

Browse files
Developergod032396-del
authored andcommitted
fix(assertString): reject objects with constructor/name property spoofing
Signed-off-by: god032396-del <god032396@gmail.com>
0 parents  commit 6ef2754

148 files changed

Lines changed: 26131 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"env": {
3+
"es": {
4+
"presets": [
5+
["@babel/preset-env", {
6+
"modules": false
7+
}]
8+
]
9+
},
10+
"development": {
11+
"presets": [
12+
["@babel/preset-env", { "targets": { "node": "0.10" } }]
13+
],
14+
"plugins": [
15+
[
16+
"add-module-exports",
17+
{
18+
"addDefaultProperty": true
19+
}
20+
]
21+
]
22+
}
23+
}
24+
}

.eslintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"extends": "airbnb-base",
3+
"parser": "babel-eslint",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"env": {
9+
"es6": true,
10+
"browser": true,
11+
"node": true,
12+
"mocha": true
13+
},
14+
"rules": {
15+
"camelcase": 0,
16+
"no-param-reassign": 0,
17+
"one-var": 0,
18+
"one-var-declaration-per-line": 0,
19+
"func-names": 0,
20+
"no-console": 0,
21+
"newline-per-chained-call": 0,
22+
"prefer-const": 0,
23+
"linebreak-style": 0,
24+
"no-restricted-syntax": [2, "DebuggerStatement", "LabeledStatement", "WithStatement"],
25+
"no-restricted-globals": 0,
26+
"prefer-destructuring": 0,
27+
"comma-dangle": [2, {
28+
"arrays": "always-multiline",
29+
"objects": "always-multiline",
30+
"imports": "always-multiline",
31+
"exports": "always-multiline",
32+
"functions": "never"
33+
}],
34+
"no-plusplus": [2, {
35+
"allowForLoopAfterthoughts": true
36+
}],
37+
"no-prototype-builtins": 0,
38+
"no-useless-escape": 0
39+
}
40+
}

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
open_collective: validatorjs
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: "\U0001F41B bug"
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
14+
**Examples**
15+
If applicable, add screenshots to help explain your problem.
16+
17+
**Reproductions**
18+
If applicable, provide a reproduction on platforms like [runkit](npm.runkit.com/validator)
19+
20+
**Additional context**
21+
Validator.js version:
22+
Node.js version:
23+
OS platform: [windows, linux, macOS, etc]

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!--
2+
Add a descriptive title textbox above, e.g.
3+
feat(validatorName): brief title of what has been done
4+
-->
5+
6+
<!--- briefly describe what you have done in this PR --->
7+
8+
<!--- provide some (credible) references showing the structure of the data to be validated, if applicable --->
9+
10+
## Checklist
11+
12+
- [ ] PR contains only changes related; no stray files, etc.
13+
- [ ] README updated (where applicable)
14+
- [ ] Tests written (where applicable)
15+
- [ ] References provided in PR (where applicable)

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [24, 22, 20, 18, 16, 14, 12, 10, 8]
13+
name: Run tests on Node.js ${{ matrix.node-version }}
14+
steps:
15+
- name: Setup Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
- name: Install dependencies
22+
run: npm install --legacy-peer-deps
23+
- name: Run tests
24+
run: npm test
25+
- if: matrix.node-version == 24
26+
name: Send coverage info to Codecov
27+
uses: codecov/codecov-action@v5
28+
with:
29+
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '38 10 * * 4'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v3
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v3
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v3

.github/workflows/npm-publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: NPM Publish
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
id-token: write
11+
steps:
12+
- name: Setup Node.js 24
13+
uses: actions/setup-node@v5
14+
with:
15+
node-version: 24
16+
registry-url: https://registry.npmjs.org/
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
- name: Install Dependencies
20+
run: npm install --legacy-peer-deps
21+
- name: Run Tests
22+
run: npm test
23+
- name: Publish Package to NPM Registry
24+
run: npm publish

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
coverage
4+
coverage.lcov
5+
.nyc_output
6+
package-lock.json
7+
yarn.lock
8+
/es
9+
/lib
10+
/index.js
11+
validator.js
12+
validator.min.js
13+

.nycrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"reporter": [
3+
"html",
4+
"text-summary"
5+
],
6+
"include": [
7+
"src/**/*.js"
8+
]
9+
}

0 commit comments

Comments
 (0)