Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ Highlights:
attributes and inline `<svg>` in content, so a designed page can be edited
without losing them. Other scripts, event handlers and forms are still
removed and reported as warnings; `geekcli guide html` has the rules.
JavaScript is refused on purpose, so that nothing an agent reads can talk
it into adding code to a site; a person adds a script in the site's admin
(the warning links to the form: click the editor's code button and paste).
- **Drafts by default**: `posts create` sends `status: draft` unless you pass
`--status published`. The API itself defaults to published, which is the
wrong default for automation.
Expand Down
31 changes: 31 additions & 0 deletions docs/GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,37 @@ microdata attributes. **It drops** `script` (except JSON-LD, below),
`number-of-tiles="three"` hook vanishes silently). Entities get
normalised; that is not a change.

**Scripts are refused on purpose.** An agent reads web pages, listings
and other people's content while it works, and any of that text could
carry instructions meant for it (prompt injection). If the API saved
JavaScript, such text could get code running for every visitor to the
site. So `<script>` is never saved, and no encoding or attribute gets
around it: do not try, and do not resend. When the site owner really
needs a script (a chat widget, a tracking snippet, an embed that needs
JavaScript), a signed-in person adds it in the site's admin:

1. Open the item's admin form. The `warning:` line for a removed script
gives the exact link (`admin_url` in the JSON); otherwise build it
from the id:

| Content | Admin form |
| ------- | ---------- |
| page | `https://<site>/admin/content/contentpage/<id>/change/` |
| area page | `https://<site>/admin/content/areapage/<id>/change/` |
| agent page | `https://<site>/admin/content/agentlandingpage/<id>/change/` |
| market report page | `https://<site>/admin/content/marketreportpage/<id>/change/` |
| home page | `https://<site>/admin/content/homepage/` |
| post | `https://<site>/admin/blog/post/<id>/change/` |
| footer | `https://<site>/admin/content/footer/<id>/change/` |
| sidebar | `https://<site>/admin/content/sidebar/<id>/change/` |

2. Click the code button (`<>`) in the editor's toolbar and paste the
snippet into the HTML.

Hand the user that link and the snippet, and say that this step is
theirs. Afterwards leave that field alone: an update that sends it again
strips the script (see the read-back rule below).

**CSS.** A `<style>` block is kept as written: classes, `@media`, custom
properties, flex and grid, `@font-face`. Inline `style` is kept too.

Expand Down
3 changes: 2 additions & 1 deletion src/commands/footers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ pub enum FootersSub {
/// Replace a footer's content
#[command(after_help = "Notes:
- Footer 1 is what every page shows unless a page has its own (--footer on pages update).
- Scripts are stripped; use the logo's u.realgeeks.media URL from `files upload -q`.
- Use the logo's u.realgeeks.media URL from `files upload -q`.
- Scripts are never saved through the API (so nothing an agent reads can talk it into adding code). A person adds one in the admin: open the link in the `warning:` line, click the code button (<>) and paste it (`geekcli guide html`).
- Same HTML rules as posts.
- Don't load web fonts from a footer (@import, <link>, @font-face): set HEADING_FONT and BODY_FONT with `settings set` (`geekcli guide fonts`).")]
Update(UpdateArgs),
Expand Down
1 change: 1 addition & 0 deletions src/commands/posts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub enum PostsSub {
#[command(after_help = "Notes:
- The body is sanitized: script (except JSON-LD), button, form, video, event handlers and data-* attributes are dropped, iframes only for YouTube/Vimeo. <style> blocks, inline style, inline svg and microdata attributes are kept; CSS is page-wide, so prefix your class names.
- See `geekcli guide html`.
- Scripts are never saved through the API (so nothing an agent reads can talk it into adding code). A person adds one in the admin: open the link in the `warning:` line, click the code button (<>) and paste it.
- Content columns are Windows-1252: arrows, CJK text and emoji are rejected with a 422 naming them; write such a character as a numeric entity (&#8594;) or use &raquo;.
- Contact links: <a class=\"popup\" href=\"/member/contact/\"> opens the contact form as an overlay on designs that support it and works as a plain link elsewhere.
- Put <!--read more--> where the summary ends.
Expand Down
Loading