caverav / auditforge

Avoid square-bracket notation when accessing properties JS-0049
Anti-pattern
Minor
11 days ago11 days old
["refreshToken"] is better written in dot notation
 45
 46  // Remove token cookie
 47  app.delete('/api/users/refreshtoken', function (req, res) {
 48    var token = req.cookies['refreshToken']; 49    try {
 50      var decoded = jwt.verify(token, jwtRefreshSecret);
 51    } catch (err) {
["refreshToken"] is better written in dot notation
 19  // Refresh token
 20  app.get('/api/users/refreshtoken', function (req, res) {
 21    var userAgent = req.headers['user-agent'];
 22    var token = req.cookies['refreshToken']; 23
 24    User.updateRefreshToken(token, userAgent)
 25      .then(msg => {
["token"] is better written in dot notation
 12    '/api/users/checktoken',
 13    acl.hasPermission('validtoken'),
 14    function (req, res) {
 15      Response.Ok(res, req.cookies['token']); 16    },
 17  );
 18
["MCIA"] is better written in dot notation
 979  );
 980  xmlOutput = xmlOutput.replace(
 981    '__ModifiedAvailability__',
 982    CVSS31.XML_MetricNames['MCIA'][ModifiedAvailability || 'X'], 983  );
 984  xmlOutput = xmlOutput.replace(
 985    '__EnvironmentalScore__',
["MCIA"] is better written in dot notation
 975  );
 976  xmlOutput = xmlOutput.replace(
 977    '__ModifiedIntegrity__',
 978    CVSS31.XML_MetricNames['MCIA'][ModifiedIntegrity || 'X'], 979  );
 980  xmlOutput = xmlOutput.replace(
 981    '__ModifiedAvailability__',