|  | 
| 7 | 7 | <link rel="stylesheet" href="checker.css"> | 
| 8 | 8 | <script src="js-yaml.min.js"></script> | 
| 9 | 9 | <script src="checker.js"></script> | 
|  | 10 | +<script src="csp1.js"></script> | 
| 10 | 11 | <link rel="license" href="https://creativecommons.org/licenses/by/4.0/"> | 
| 11 | 12 | 
 | 
| 12 | 13 | <!-- See create_labs.md for how to create your own lab! --> | 
|  | 
| 58 | 59 |   \} \) \) ; | 
| 59 | 60 | --> | 
| 60 | 61 | 
 | 
| 61 |  | -<script id="info" type="application/yaml"> | 
| 62 |  | ---- | 
| 63 |  | -hints: | 
| 64 |  | -- present: "import" | 
| 65 |  | -  text: Yes, many JavaScript implementations support an import statement. | 
| 66 |  | -    However, in this exercise we will use a require form. Please use that | 
| 67 |  | -    instead. | 
| 68 |  | -  examples: | 
| 69 |  | -  - - 'import express from "express";' | 
| 70 |  | -- absent: "const" | 
| 71 |  | -  text: Start with const. | 
| 72 |  | -- absent: 'const\s+helmet =' | 
| 73 |  | -  text: Create a constant name named helmet using the form const helmet = ... | 
| 74 |  | -  examples: | 
| 75 |  | -  - - 'const' | 
| 76 |  | -  - - 'consthelmet = ' | 
| 77 |  | -- present: 'require \( helmet \)' | 
| 78 |  | -  text: The parameter of a requirement statement must be string. | 
| 79 |  | -    Surround the term helment with double-quotes. | 
| 80 |  | -  examples: | 
| 81 |  | -  - - '  const helmet = require(helmet);' | 
| 82 |  | -- absent: "; $" | 
| 83 |  | -  text: JavaScript doesn''t require semicolon terminators, but the rest of | 
| 84 |  | -    the code uses them. You should try to match a coding style when modifying | 
| 85 |  | -    existing code unless there''s an important reason not to. | 
| 86 |  | -    Please update the first statment. | 
| 87 |  | -  examples: | 
| 88 |  | -  - - '  const helmet = require("helmet")' | 
| 89 |  | -- absent: '\s* app \. use \( helmet \( \{' | 
| 90 |  | -  index: 1 | 
| 91 |  | -  text: Your code should begin with app.use(helmet({ | 
| 92 |  | -- absent: | | 
| 93 |  | -    \s* app \. use \( helmet \( \{ | 
| 94 |  | -          contentSecurityPolicy: \{ \s* | 
| 95 |  | -  index: 1 | 
| 96 |  | -  text: | | 
| 97 |  | -    Your code should begin with: | 
| 98 |  | -    app.use(helmet({ | 
| 99 |  | -      contentSecurityPolicy: { | 
| 100 |  | -- absent: | | 
| 101 |  | -    \s* app \. use \( helmet \( \{ | 
| 102 |  | -          contentSecurityPolicy: \{ | 
| 103 |  | -            directives: \{ \s* | 
| 104 |  | -  index: 1 | 
| 105 |  | -  text: | | 
| 106 |  | -    Your code should begin with: | 
| 107 |  | -    app.use(helmet({ | 
| 108 |  | -      contentSecurityPolicy: { | 
| 109 |  | -            directives: { | 
| 110 |  | -- absent: | | 
| 111 |  | -    \s* app \. use \( helmet \( \{ | 
| 112 |  | -          contentSecurityPolicy: \{ | 
| 113 |  | -            directives: \{ | 
| 114 |  | -                "script-src": \[ "'self'" , ["']https://example.com["'] \] , \s* | 
| 115 |  | -  index: 1 | 
| 116 |  | -  text: | | 
| 117 |  | -    Your code should continue with: | 
| 118 |  | -    app.use(helmet({ | 
| 119 |  | -      contentSecurityPolicy: { | 
| 120 |  | -            directives: { | 
| 121 |  | -              "script-src": ["'self'", "https://example.com"], | 
| 122 |  | -- absent: | | 
| 123 |  | -    "style-src": \[ "'self'" \] | 
| 124 |  | -  index: 1 | 
| 125 |  | -  text: | | 
| 126 |  | -    Don't forget to include "style-src": ["'self'"] | 
| 127 |  | -- absent: '; $' | 
| 128 |  | -  index: 1 | 
| 129 |  | -  text: JavaScript doesn''t require semicolon terminators, but the rest of | 
| 130 |  | -    the code uses them. You should try to match a coding style when modifying | 
| 131 |  | -    existing code unless there''s an important reason not to. | 
| 132 |  | -    Please update the second statement to use a semicolon terminator. | 
| 133 |  | -- absent: |- | 
| 134 |  | -    \} \} \) \) ; $ | 
| 135 |  | -  index: 1 | 
| 136 |  | -  text: The correct answer is expected to end with `} } ) ) ;` ignoring | 
| 137 |  | -    whitespace. Check that you have matching parentheses and braces. | 
| 138 |  | -- text: I do not have more specific hints to provide. Please ensure that | 
| 139 |  | -    the parentheses, braces, and brackets pair correctly, as that is | 
| 140 |  | -    often the problem. | 
| 141 |  | -# debug: true | 
| 142 |  | -</script> | 
| 143 | 62 | 
 | 
| 144 | 63 | 
 | 
| 145 | 64 | <!-- More examples: | 
|  | 
0 commit comments