title: Chrome not sending Session-Cookie for CSS Files published on Jenkins
body: <p>I have a jenkins pipeline that creates a HTML and a CSS file. When using Firefox everything works fine. When using latest Chrome (95.0.4638.69) the css file won't be loaded.</p>
  <p>The problem seems to be that Chrome doesn't send the Session-Cookie when loading the HTML file and requesting the CSS file (checked with the developer tools, I see a 403 Forbidden in the network-tab when Chrome requests the CSS, the cookie is correctly sent when requesting the HTML file).
  When I access the CSS URL directly in chrome the cookies is sent and I get a response.</p>
  <p>The only special thing on the HTML page:
  Jenkins sets the following headers:</p>
  <pre><code>Content-Security-Policy: sandbox; default-src 'none'; img-src 'self'; style-src 'self';
  X-Content-Security-Policy: sandbox; default-src 'none'; img-src 'self'; style-src 'self';
  X-Content-Type-Options: nosniff
  X-WebKit-CSP: sandbox; default-src 'none'; img-src 'self'; style-src 'self';
  </code></pre>
  <p>But as far as I understand style-src 'self' means that CSS from the same server are allowed. In my example the HTML is at <code>http://localhost:8080/job/aaa/4/artifact/result.html</code> and the CSS at <code>http://localhost:8080/job/aaa/4/artifact/styles.css</code>.</p>
  <p>I created a simple Jenkinsfile for testing:</p>
  <pre><code>pipeline {
  
      agent any
  
      stages {
          
          stage('Create HTML') {
              steps {
                  createHtml()
              }
          }
  
      }
      
  }
  
  def createHtml() {
      createHtmlPage();
      createStylesheetFile();
      
      archive (includes: '*.html,*.css')
      
      publishHTML([allowMissing: false,
       alwaysLinkToLastBuild: true,
       keepAll: true,
       reportDir: '.',
       reportFiles: 'result.html',
       reportName: 'Test'
      ])
      
  }
  
  private void createHtmlPage() {
      String result = &quot;&quot;&quot;&lt;!DOCTYPE html&gt;
          &lt;html&gt;
          &lt;head&gt;
              &lt;title&gt;Test&lt;/title&gt;
              &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;
          &lt;/head&gt;
          &lt;body&gt;
          &lt;h1&gt;Test&lt;/h1&gt;
          &lt;/body&gt;
          &lt;/html&gt;
      &quot;&quot;&quot; 
      
      writeFile file: 'result.html', text: result
  }
  
  private String createStylesheetFile() {
      String styles = &quot;&quot;&quot;
          body {
              font-family: Arial, Helvetica, sans-serif;
              color: blue;
              background: green;
          }
      &quot;&quot;&quot;
          
      writeFile file: 'styles.css', text: styles
  }
  
  </code></pre>
  <p>I also tried disabling the CSP settings in Jenkins, but got the same result.</p>
  <p>With further searching and clicking around I found out that Chrome is not sending the cookie because Jenkins creates it without 'SameSite' attribute. So chrome sets it to 'Lax' which means 'Cookies are not sent on normal cross-site subrequests'.</p>
  <p>So I try to find out, how to set SameSite in Jenkins.</p>