GGThedandClaude Opus 5 15bfebf4fc feat(csp): infrastructure de sortie de unsafe-inline, et couche partagee migree
SEC-WEB-001 / OPS-010. script-src porte toujours 'unsafe-inline' : c'est
pour cela que le XSS stocke de SEC-XSS-001 s'executait au lieu d'etre
bloque. Le retirer n'est pas un changement d'une ligne.

Ce qui bloque reellement
  Un nonce autorise des elements <script> ; il ne peut rien pour un
  attribut onclick="...". Mesure faite : 76 gestionnaires en ligne repartis
  dans 15 gabarits. Tant qu'il en reste un, la politique ne peut pas etre
  durcie.

  Piege supplementaire, documente dans build_csp() : en CSP niveau 3, un
  navigateur ignore 'unsafe-inline' des qu'un nonce est present. Emettre
  les deux ne serait donc pas une transition douce -- ce serait couper
  d'un coup tous les scripts en ligne et tous les onclick, et uniquement
  sur les navigateurs recents. La bascule doit etre atomique, d'ou un
  drapeau unique : CSP_ALLOW_INLINE_SCRIPT.

Infrastructure posee
  build_csp() assemble l'en-tete selon le drapeau. Un nonce est genere par
  requete et n'est emis que lorsque l'inline est interdit. Les 15 blocs
  <script> portent deja nonce="{{ csp_nonce }}", inerte aujourd'hui : la
  bascule finale sera un changement de configuration, pas de gabarits.

Couche partagee migree en premier
  base.html et macros.html sont rendus sur absolument toutes les pages. Six
  gestionnaires retires, remplaces par des attributs data-action et un
  ecouteur delegue unique dans main.js. La delegation plutot qu'un
  ecouteur par widget : le contenu injecte dynamiquement herite du
  comportement sans re-attachement.

Un cliquet plutot qu'une promesse
  tests/test_csp.py fixe un budget par gabarit qui ne peut que baisser.
  Ajouter un gestionnaire en ligne fait echouer la suite ; en retirer sans
  mettre le budget a jour aussi, ce qui force a enregistrer la progression
  dans le diff. A zero, il ne reste qu'a basculer le drapeau.

  Le cliquet a d'ailleurs corrige mon propre relevé : mon grep initial
  comptait 83 gestionnaires, la mesure exacte en donne 76 -- le motif ne
  verifiait pas l'espace avant l'attribut.

style-src conserve 'unsafe-inline' : les attributs style="" sont partout et
ne constituent pas un vecteur XSS a eux seuls. Migration distincte.

192 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-07 20:44:16 -04:00
2026-08-06 14:46:51 -04:00
2026-07-30 09:52:32 -04:00
2026-08-03 16:43:46 -04:00

Plateforme centralisée de tryouts

Security Configuration

Required Environment Variables

Before deploying, create a .env file which integrates everything in the .env.exemple. Ensure you follow the comments of the exemple if you are to use this tool in production.

Security Features Implemented

  • Rate Limiting: Login endpoint limited to 10 requests per minute to prevent brute-force attacks
  • Secure Session Cookies: HTTPSOnly, SameSite=Lax, and Secure flags enabled
  • CSRF Protection: Enabled by default on all forms
  • HTTPS Enforcement: Automatic redirect to HTTPS in production
  • Security Headers: X-Frame-Options, X-Content-Type-Options, Content-Security-Policy, HSTS
  • Open Redirect Prevention: URL validation on login redirect
  • Authorization Checks: Proper ownership validation on all sensitive operations
  • nginx: reverse-proxy and load balancer
  • Waitress WSGI: Production ready WSGI

When true in .env:

  • Forces HTTPS only
  • Forcer secure cookies

App details

Code

  • Full python backend using flask
  • statics are pure HTML and CSS
  • Some js to add logic to styling and showing certain pages/cards

Functionalities

  • User base with sign-ins: Forces users to create an account and register pertinent information for tryouts and teams. The admin can attribute them a role.
  • User-Role-Based Permissions: admin - full acces, coach/manager - access to team management, player - views what he is registered in (no management), scout - view only
  • Tryout Management: manage internal tryout teams, organise internal tryouts matches (3 formats, team vs team, PvP, scrim). Coaches can Evaluate players based on 10 criteria
  • Team Management: manage teams for the season, create matches and practices. When planning a practice there will be a calendar showing player availabitlities slots to help chose a time
  • Coach and Player Availabilities: Allow better planning for the coaches, and for players to book One on Ones with their coach.
  • Player Notes: Coaches can give notes to their players. The players will see them and there is a history which keeps the most recent notes.
  • Team Notes: Coaches can give notes to their teams, where all players from that team can see the note.
  • One on One: Players can request a One on One meeting with their coach. This sends a discord dm to the coach to accept or refuse. The player is then notified of the response.
  • Availabilities: Allow players and coach to enter the moments they are available. Allows for easier practice setup and One on One planning.

Discord Integration

The application supports sending Discord direct messages to coaches when players request One on One sessions, when matches/tryouts/practices are created and a player is in it, and the players get match reminders 24h before a match.

When sending a One on One request, the coach can accept via the platform or react to the discord message to answer the booking request. Same thing with matches and practices, the players can react or answer on the platform.

Setup Instructions

1. Create a Discord Bot (Not needed for UdeS user, the bot already exists)

  1. Go to the Discord Developer Portal
  2. Create a new application
  3. Go to the "Bot" tab and create a bot user
  4. Copy the bot token - this will be your DISCORD_BOT_TOKEN
  5. Enable the "Message Content Intent" under Privileged Gateway Intents (required for sending messages)

2. Add Bot to your server

For the bot to send DMs:

  1. Each user must have the bot added to their Discord server OR be friends with the bot
  2. Users need to add their Discord User ID to their profile:
    • Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
    • Right-click on their profile → Copy ID
    • Enter this numeric ID in the "Discord User ID" field in their profile settings

How It Works

When a player submits a One on One request:

  1. The system checks if the coach has a Discord User ID configured
  2. If configured, a direct message is sent to the coach via the Discord bot

Message Format

The Discord DM includes:

  • Player name
  • Team name
  • Requested date and time slot
  • Discussion points (if provided)
  • Link to the application for approval/rejection
  • Two provided reactions to accept or refuse via discord
S
Description
No description provided
Readme
2.3 MiB
Languages
Python 67.9%
HTML 27%
CSS 3.5%
JavaScript 1.6%