Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
Axios - Password Exposed in res.config

I am making an axios post request to my server to log a user in and logging the response in the console to observe the data being returned:

const Login = () => {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");

  const submitForm = (e) => {
    e.preventDefault();

    axios
      .post("http://127.0.0.1:3000/login", { email, password })
      .then((res) => console.log("res", res))
      .catch((err) => console.log("err", err));

    console.log({ email, password });
  };

I generate a token when the user successfully logs in, returning the user's data alongside this newly generated token. As you can see here, I am deleting the user password from the response body in order to not expose the password:

const generateToken = (user) => {
  delete user.password;

  const token = jwt.sign(user, config.appKey, { expiresIn: 86400 });

  return { ...user, ...{ token } };
};

Here is the logged data in the console. In image no.1, you can see there is no password in the data portion of the response.

enter image description here

However, in the config portion of the response, the password is exposed (see Image no.2). My question is, is this something to be concerned about? If so, how do I remove the user's password from the response altogether?

enter image description here

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

If your connection is secure (HTTP over TLS, ...), it is not something you need to be concerned about.

The HTTP response does not include it, since the actual response payload is res.data.

It is stored in the axios response object, since res.config is the config that was provided to axios for the request. But it is not stored in any persistent storage.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda