Changeset f7d142f in Klonkt for src/views/partials


Ignore:
Timestamp:
06/28/2026 03:36:22 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
81bb9c5
Parents:
127f87e
Message:

chore(csp): drop the last script unsafe-inline + add Permissions-Policy

Move every inline on* handler to a shared delegated data-* handler, so script-src-attr
can be 'none' instead of 'unsafe-inline'. Add a Permissions-Policy header disabling
camera/microphone/geolocation/Topics (embed features left at default).

  • views/shell.ejs — shared delegated submit/change/click/error handler (data-confirm, data-autosubmit, data-lang-switch, data-selectall, data-back, data-fallback)
  • views/{pages,partials}/*.ejs — 18 inline on* handlers -> data-* attributes (14 files)
  • server.js — scriptSrcAttr 'unsafe-inline' -> 'none'; Permissions-Policy header
Location:
src/views/partials
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/views/partials/fedi-node.ejs

    r127f87e rf7d142f  
    1414  <div class="comment-actions">
    1515    <% if (n.mine && typeof canManageSite !== 'undefined' && canManageSite && n.outboxId) { %>
    16       <form method="post" action="<%= _base %>/fediverse/<%= n.outboxId %>/delete" onsubmit="return confirm('<%= t('fedi.delete_confirm') %>')">
     16      <form method="post" action="<%= _base %>/fediverse/<%= n.outboxId %>/delete" data-confirm="<%= t('fedi.delete_confirm') %>">
    1717        <button type="submit" class="comment-delete-btn"><%= t('comments.delete') %></button>
    1818      </form>
  • src/views/partials/footer.ejs

    r127f87e rf7d142f  
    2222      <% if (typeof langs !== 'undefined' && langs && langs.length > 1) { %>
    2323        <select class="footer-lang" aria-label="<%= t('nav.language') %>"
    24                 onchange="location.href='/lang/'+this.value+'?r='+encodeURIComponent(location.pathname+location.search)">
     24                data-lang-switch>
    2525          <% langs.forEach(function(l){ %><option value="<%= l.code %>"<%= l.active ? ' selected' : '' %>><%= l.name %></option><% }); %>
    2626        </select>
  • src/views/partials/playlist-editor.ejs

    r127f87e rf7d142f  
    442442      const u = coverEl.value.trim();
    443443      coverThumb.innerHTML = u
    444         ? `<img src="${esc(u)}" alt="" onerror="this.parentElement.innerHTML='<span class=\\'pl-cover-empty\\'>⚠️</span>'">`
     444        ? `<img src="${esc(u)}" alt="" data-fallback>`
    445445        : `<span class="pl-cover-empty">🎨</span>`;
    446446    });
Note: See TracChangeset for help on using the changeset viewer.