faker
faker copied to clipboard
feat(security): new module
Introduces a security
module which allows users to generate one of the following:
- Common Weakness Enumeration (CWE), example: CWE-12345
- Common Vulnerabilities and Exposures (CVE), example: CVE-2022-1234
- Common Vulnerability Scoring System (CVSS)
These are a few of the broadly supported standards which have seen adoption by the security community. Although there are a few emerging alternatives as well.
I do not believe that any localisation is needed for these but happy to do some further research but thought I'd share the work as it stands and see if it seemed interesting to anyone else.
Codecov Report
Merging #1151 (a3945eb) into main (5bdba8b) will increase coverage by
0.00%
. The diff coverage is97.67%
.
:exclamation: Current head a3945eb differs from pull request most recent head f4b2053. Consider uploading reports for the commit f4b2053 to get more accurate results
@@ Coverage Diff @@
## main #1151 +/- ##
========================================
Coverage 99.62% 99.62%
========================================
Files 2163 2165 +2
Lines 241264 240858 -406
Branches 1013 1031 +18
========================================
- Hits 240356 239954 -402
+ Misses 887 883 -4
Partials 21 21
Impacted Files | Coverage Δ | |
---|---|---|
src/modules/security/index.ts | 97.41% <97.41%> (ø) |
|
src/faker.ts | 100.00% <100.00%> (ø) |
|
src/internal/toDate.ts | 100.00% <100.00%> (ø) |
|
src/modules/date/index.ts | 99.01% <100.00%> (-0.09%) |
:arrow_down: |
src/modules/datatype/index.ts | 96.03% <0.00%> (-0.22%) |
:arrow_down: |
src/modules/helpers/index.ts | 98.43% <0.00%> (-0.08%) |
:arrow_down: |
src/modules/random/index.ts | 97.63% <0.00%> (-0.06%) |
:arrow_down: |
src/modules/color/index.ts | 99.71% <0.00%> (-0.03%) |
:arrow_down: |
src/modules/address/index.ts | 99.81% <0.00%> (-0.02%) |
:arrow_down: |
... and 22 more |
Thanks @ST-DDT and @Shinigami92 both for taking the time to review the work here so far. ✨
@ST-DDT Can I get approval for these workflows to run and see how it fairs?
Investigating:
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL test/scripts/apidoc/examplesAndDeprecations.spec.ts > examples and deprecations > Security > cve
Error: Transform failed with 1 error:
❯ failureErrorWithLog node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1624:15
/home/runner/work/faker/faker/test/scripts/apidoc/temp/Security/cve.ts:3:83: ERROR: Expected "}" but found ")"
❯ node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1413:29
❯ node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:678:9
❯ handleIncomingPacket node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:775:9
❯ Socket.readFromStdout node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:644:7
❯ Socket.emit node:events:513:28
Docs Preview
Click to expand
Please also run pnpm run docs:dev
once.
Please also run
pnpm run docs:dev
once.
I've run this locally but seeing some breakages, which seem unexpected?
When attempting to load the API overview:
Output when running: pnpm run generate:api-docs
warning <internal>.CallSite.getTypeName: Comment [[target]] style links are deprecated and will be removed in 0.24
warning Failed to find target: Class
JSON written to ./docs/api/typedoc.json
/Users/luke/oss/faker/scripts/apidoc/moduleMethods.ts:19
.getChildrenByKind(ReflectionKind.Module)[0]
^
TypeError: Cannot read properties of undefined (reading 'getChildrenByKind')
at selectApiModules (/Users/luke/oss/faker/scripts/apidoc/moduleMethods.ts:19:47)
at null.processModuleMethods (/Users/luke/oss/faker/scripts/apidoc/moduleMethods.ts:34:24)
at null.build (/Users/luke/oss/faker/scripts/apidoc.ts:38:24)
Also seeing the same behaviour when running the main
branch, so something odd in my local environment.
Node: v16.16.0 pnpm: 7.9.5
Have you installed the latest dependencies pnpm install
?
@ST-DDT, I believe so.
$ pnpm install
Lockfile is up to date, resolution step is skipped
Already up to date
If you are fine with it. I will have a look later and update the branch.
Thanks @ST-DDT ✨ I will squash the commits once @Shinigami92 has had a chance to re-review.
All methods now need a @since 8.0.0
All methods now need a
@since 8.0.0
@ST-DDT Doesn't this kind of depend on the module getting user interest? I can see that introducing a @since
property to each doc block is, an outstanding task before the work is mergeable but seems impossible to know exactly what release version this would land in.
The @since
is needed to pass the tests.
Sure the version might needs to be changed later/before merging, but at least it is visible.
If the test fail, the PR is less likely to be reviewed and reacted to.