diff --git a/public/js/app.js b/public/js/app.js
index f3ea0875e95bdab5d388e2cf53c19b52f9a03275..09dfa0987a176ad918db2d6951e5bd88c5db7d67 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -1,4 +1,4 @@
-// Obtener referencia a los elementos del DOM
+// Get reference to DOM elements
 const taskList = document.querySelector('.task-list ul');
 const newTaskForm = document.querySelector('form');
 
@@ -78,7 +78,7 @@ newTaskForm.addEventListener('submit', async (e) => {
 
     const newTodo = await res.json();
     taskList.appendChild(createTaskElement(newTodo));
-    input.value = ''; // Limpiar el campo de entrada
+    input.value = ''; // Clear input field
   } catch (err) {
     console.error('Error adding task:', err);
   }
@@ -86,6 +86,12 @@ newTaskForm.addEventListener('submit', async (e) => {
 
 // Mark task as completed
 async function markAsDone(taskId, isDone) {
+  // Input sanitation 
+  if (isNaN(parseInt(taskId, 10)) && typeof(isDone) === 'boolean') {
+    console.error('Invalid task ID or task status is invalid');
+    return;
+  }
+
   try {
     const res = await fetch(`/api/todos/${taskId}/done`, {
       method: 'PUT',
@@ -104,6 +110,12 @@ async function markAsDone(taskId, isDone) {
 
 // Erase task
 async function deleteTask(taskId) {
+  // Input sanitation 
+  if (isNaN(parseInt(taskId, 10))) {
+    console.error('Invalid task ID');
+    return;
+  }
+
   try {
     const res = await fetch(`/api/todos/${taskId}`, {
       method: 'DELETE'
@@ -122,6 +134,12 @@ async function deleteTask(taskId) {
 
 // Edit task
 async function updateTask(taskId, newDescription) {
+  // Input sanitation 
+  if (isNaN(parseInt(taskId, 10)) && typeof(newDescription) === 'string') {
+    console.error('Invalid task ID or new description is not string');
+    return;
+  }
+
   try {
     const res = await fetch(`/api/todos/${taskId}/description`, {
       method: 'PUT',
diff --git a/public/js/index.js b/public/js/index.js
index b102448a681180d50e78ac143c30357bb8875792..0b6456db9827a9f117335978e05251b65fef1774 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -118,6 +118,12 @@ document.addEventListener('DOMContentLoaded', async () => {
 
   // Function to alternate to the completed state
   async function toggleComplete(taskId, isDone) {
+    // Input sanitation 
+    if (isNaN(parseInt(taskId, 10)) && typeof(isDone) === 'boolean') {
+      console.error('Invalid task ID or task status is invalid');
+      return;
+    }
+
     try {
       const res = await fetch(`/api/todos/${taskId}/done`, {
         method: 'PUT',
@@ -134,6 +140,12 @@ document.addEventListener('DOMContentLoaded', async () => {
 
   // Function to eliminate a task
   async function deleteTask(taskId) {
+    // Input sanitation 
+    if (isNaN(parseInt(taskId, 10))) {
+      console.error('Invalid task ID');
+      return;
+    }
+    
     try {
       const res = await fetch(`/api/todos/${taskId}`, {
         method: 'DELETE'
@@ -148,6 +160,12 @@ document.addEventListener('DOMContentLoaded', async () => {
 
   // Function to update the description of a task
   async function updateTask(taskId, newDescription) {
+    // Input sanitation 
+    if (isNaN(parseInt(taskId, 10)) && typeof(newDescription) === 'string') {
+      console.error('Invalid task ID or new description is not string');
+      return;
+    }
+  
     try {
       const res = await fetch(`/api/todos/${taskId}/description`, {
         method: 'PUT',