Skip to content

Integrate retire.js static analysis tool#148

Open
alexbock2 wants to merge 97 commits into
mainfrom
test-retirejs
Open

Integrate retire.js static analysis tool#148
alexbock2 wants to merge 97 commits into
mainfrom
test-retirejs

Conversation

@alexbock2

Copy link
Copy Markdown

This PR is for the integration of the static tool retire.js to find library/node module vulnerabilities within the project. NodeBB already has "retire": "^5.4.2", in devDependencies.

Files changed:
modified package.json and added "scan:retire": "retire" to the scripts.
added file retire-install-log.txt for evidence that retire was installed with npm install retire --save-dev (evidence taht I have successfully installed the tool)
added retirejs-output.txt that contains the output of the tool (artifact to demonstrate the tool has successfully run on the repo)

Run tool with npm run scan:retire. It detects vulnerabilities of various severity, including prototype pollution in lodash, stack overflow denial-of-service in underscore, and regular expression Dos in markdown-it.

Pros and cons:
Pros:

  1. Focuses on vulnerabilities from third-party dependencies
  2. The scan is executed quickly and is practical to be used during development or CI
  3. Gives description of vulnerability, severity, references, and workarounds
  4. Fast to install
    Cons:
  5. Lots of output, may be difficult to parse through if the same library has multiple instances
  6. Repetitive output (lodash 4.17.21 vulnerability appears multiple times)
  7. Can't make automatic fixes
  8. Many vulnerabilities from nested dependencies in node_modules
  9. False positives

Customizations:
Priori: Add ignore files to lessen false positives
Ongoing: ignore vulnerabilities that have been handled elsewhere

leongcmu and others added 30 commits February 7, 2026 20:56
- Created createInstructorsGroup() function to initialize Instructors group during setup
- Created giveInstructorPrivileges() function to assign category and global privileges
- Instructors can now edit/delete posts, move topics, ban users, and purge content
- Group is visible in admin panel for manual member assignment
- Integrated both functions into install.setup() execution sequence
- Add 'endorsed' to intFields for proper integer parsing
- Initialize endorsed=0 on post creation
- Add endorse/unendorse API endpoints (PUT/DELETE /api/v3/posts/:pid/endorse)
- Add corresponding controller and route wiring

https://claude.ai/code/session_015H7tVc6LK7fwqr4tMk2psJ
…nd real-time updates

- Template: show endorse/unendorse toggle with icons, restrict to moderators
- API: add admin/mod privilege check, emit websocket events on endorse/unendorse
- Socket handler: include endorsed field in loadPostTools data
- Client JS: fix toggleEndorse to use data-endorsed attribute, remove debug logs
- Events: add onPostEndorsed handler for real-time UI updates across clients
- Theme: add endorsed indicator (check-circle) on post headers, endorsed CSS class
- Locales: add "endorsed" translation string

https://claude.ai/code/session_014eoruhm2UVyiTefaNqPBCx
- Created createInstructorsGroup() function to initialize Instructors group during setup
- Created giveInstructorPrivileges() function to assign category and global privileges
- Instructors can now edit/delete posts, move topics, ban users, and purge content
- Group is visible in admin panel for manual member assignment
- Integrated both functions into install.setup() execution sequence
…QKOH

Wire up endorse button end-to-end with UI toggle, privilege checks, a…
- Register 'posts:endorse' in category privilege map (moderation type)
- Add to topics.get() privilege check and returned privilege object
- Give default endorse privilege to admins/mods on new category creation
- Update API endorse/unendorse to use privileges.posts.can('posts:endorse')
- Add canEndorse check and display_endorse_tools flag in socket handler
- Set display_endorse_tools in modifyPostsByPrivilege from topic privileges
- Update template to gate endorse button on display_endorse_tools
- Add 'endorse-posts' admin UI label in en-US and en-GB locales

https://claude.ai/code/session_014eoruhm2UVyiTefaNqPBCx
…QKOH

Replace isAdminOrMod check with dedicated posts:endorse privilege
The endorse privilege was previously in the category privilege map, which
meant it only appeared when viewing a specific category's privileges in
the admin panel. Moving it to the global privilege map makes it visible
on the default admin privileges page under the Moderation tab.

https://claude.ai/code/session_014eoruhm2UVyiTefaNqPBCx
…QKOH

move post.endorse to global privilege
Add Instructor Role Support to User Management System
Refactor (src/user/posts.js:33): Reduce complexity for isReady()
…mail. Each user row now list their groups as badges. users.js, users.tpl, and users.json were edited.
BAIZIKING and others added 30 commits February 27, 2026 04:16
Each test now has a comment explaining:
- What behaviour or code path it targets
- Why that specific assertion is meaningful
- Any relevant state dependencies between tests

The describe block itself has a top-level JSDoc summary covering the
feature, the setup rationale, and the roles of each fixture variable.

https://claude.ai/code/session_01MB2cJMrbN13ELYXE5A9pn2
…in posts added. There was an issue pertaining test in anonymous.js, but was fixed as we consider anonymou users to be displayed with A.
…mation-Testing-for-U3

User Guide on Anonymous Feature updated, as well as automation tests in posts added.
Fix anonymous avatar default picture path. Updates to testing will be done.
…d-Testing-for-US1

Added automated tests and updated UserGuide.md
Add comments and documentations to the endorse functionalities
give NodeBB root privileges to the docker compose
Integrate JSHint Static Analysis Tool for JavaScript Code Quality Flagging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants