-
Notifications
You must be signed in to change notification settings - Fork 10
Make community events schedule CMS-editable #746
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import React from 'react' | ||
| import PropTypes from 'prop-types' | ||
| import { CommunityEventsPageTemplate } from '../../templates/community-events-page' | ||
|
|
||
| const CommunityEventsPagePreview = ({ entry, widgetFor }) => { | ||
| const data = entry.getIn(['data']).toJS() | ||
|
|
||
| return ( | ||
| <CommunityEventsPageTemplate | ||
| isLoggedUser={false} | ||
| title={data.title} | ||
| subTitle={data.subTitle} | ||
| footer={data.footer} | ||
| eventsSchedule={data.eventsSchedule} | ||
| content={widgetFor('body')} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| CommunityEventsPagePreview.propTypes = { | ||
| entry: PropTypes.shape({ getIn: PropTypes.func }).isRequired, | ||
| widgetFor: PropTypes.func.isRequired, | ||
| } | ||
|
|
||
| export default CommunityEventsPagePreview |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -617,7 +617,7 @@ collections: | |
| files: | ||
| - file: "src/pages/events/community-events/index.md" | ||
| label: "Community Events" | ||
| name: "" | ||
| name: "community-events" | ||
| fields: | ||
| - { label: "Template Key", name: "templateKey", widget: "hidden", default: "community-events-page" } | ||
| - { label: SEO, name: seo, widget: object, fields: [ | ||
|
|
@@ -629,6 +629,20 @@ collections: | |
| ] } | ||
| - { label: "Title", name: title, widget: string } | ||
| - { label: "Sub Title", name: subTitle, widget: string } | ||
| - label: "Events Schedule" | ||
| name: eventsSchedule | ||
| widget: object | ||
| fields: | ||
| - { label: "Heading", name: title, widget: string } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- relevant template and component references ---'
rg -n -C 6 "MoreEventsSection|eventsSchedule|dangerouslySetInnerHTML" src static/admin/config.ymlRepository: OpenStackweb/osf-website Length of output: 50381 🏁 Script executed: #!/bin/bash
set -eu
rg -n -C 8 "MoreEventsSection|eventsSchedule|dangerouslySetInnerHTML" src static/admin/config.ymlRepository: OpenStackweb/osf-website Length of output: 50381 🏁 Script executed: #!/bin/bash
set -eu
file="$(fd -t f -i '^MoreEventsSection' . | head -n 1)"
printf '%s\n' "--- ${file} ---"
cat -n "$file"Repository: OpenStackweb/osf-website Length of output: 206 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- matching component files ---'
rg --files | grep -i 'MoreEventsSection\|more-events'Repository: OpenStackweb/osf-website Length of output: 283 🏁 Script executed: #!/bin/bash
set -eu
cat -n src/components/MoreEventsSection/index.jsxRepository: OpenStackweb/osf-website Length of output: 1896 XSS (CWE-79): Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') Reachability: External · Exploitability: Moderate Do not render CMS heading HTML without sanitization.
🤖 Prompt for AI Agents |
||
| - label: "Events" | ||
| name: events | ||
| widget: list | ||
| summary: "{{fields.name}} — {{fields.date}}" | ||
| fields: | ||
| - { label: "Event Name", name: name, widget: string } | ||
| - { label: "Date", name: date, widget: string } | ||
| - { label: "Location", name: location, widget: string } | ||
| - { label: "Link", name: link, widget: string, required: false } | ||
| - { label: "Body", name: body, widget: markdown } | ||
| - { label: "Footer", name: footer, widget: object, required: false, fields: [ | ||
| { label: "Title", name: title, widget: string, required: false }, | ||
|
|
@@ -1357,4 +1371,4 @@ collections: | |
| { label: "Link", name: link, widget: string }, | ||
| { label: "Text", name: text, widget: string } | ||
| ]} | ||
| ]} | ||
| ]} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
XSS (CWE-79): Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Reachability: External · Exploitability: Difficult
Render the schedule title as text or sanitize it before using
dangerouslySetInnerHTML.The CMS-controlled
titlereaches a raw HTML sink. Render it as React text, or apply a strict allowlist sanitizer before insertion.🧰 Tools
🪛 React Doctor (0.9.12)
[error] 16-16:
dangerouslySetInnerHTMLis an XSS hole that runs attacker-controlled HTML in your users' browsers.Render trusted content as React children so attacker-controlled HTML cannot run in users' browsers.
(no-danger)
🤖 Prompt for AI Agents
Source: Linters/SAST tools