Should user input be validated/checked for it’s length in PHP (server side) as a security measure?

important to note that this user input is something that after validation & sanitation – will be inserted into a database, and later on be shown to other users on the same web site. (example: a forum) I’m referring to both a case when I know in advanced what’s the length I should expect from the user and a case in which I don’t but know vaguely that’s not more than 100 length. I’m trying to figure out if there is any security advantages for checking user input length in PHP. taking into account I’m already validation & sanitation user input based on the type of content I’m expecting using regex. I know this differs from language to language to I want to refer to PHP this time, but any referring to other language like Java, .NET, python etc. would be fine.

What can a victim company do when it’s hard to differentiate between a Physical Pentest from a Criminal Physical Penetration

Hypothetical Situation:

The company Blue hires the company Red to do a Red Team engagement on Blue. Here, I’ll be discussing only the physical part of the engagement, not social and cyber.

Red successfully infiltrates Blue and gives detailed reports of what was done in the engagement. Example part of the report:

... In building A:  At door A101, we picked the lock. Techniques used in picking: Raking, Bump Key. At door A102, we picked the lock. Techniques used in picking: Raking. ... 

The report includes details of techniques used to exploit and infiltrate.

A week after the engagement is done, Blue is attacked by real criminals and had their data exfiltrated from building A. They didn’t have camera footage of every door exploited. Installation of the doors and locks in building A are confirmed to be proper and most likely picked. However, those doors/locks have also been reported to be picked by Red during their engagement the week before.


The problem:

The locks being tested have been picked and exploited by both Red and the criminals. Forensics evidence would likely show traces of both or just Red‘s engagement. Since red team engagements are to simulate real criminals as accurately as possible, it’s hard to differentiate between evidence left by Red and those left by the criminals.

Blue is highly confident that those locks were picked by the criminals, and let’s assume they’re correct about that. Blue wishes to investigate how exactly the criminals got in and track down those criminals. Additionally, Blue also wants to claim insurance for those locks being picked. (I’ve heard we can get insurance from the lock manufacturer if the locks are picked and we take damage from that)


Question(s):

How can forensic evident on the locks be used in court (for insurance) and investigation? How should Blue use said forensic evidence to claim their insurance and track down the criminals when it’s hard to distinguish between marks left by Red and the criminals?

Why it’s never switching cameras and not moving back to the original position the transform?

using System; using System.Collections; using System.Collections.Generic; using UnityEngine;  public class OpenningScene : MonoBehaviour {     [Header("Animators")]     public Animator[] animators;      [Space(5)]     [Header("Movement Settings")]     public Transform target;     public float movingSpeed = 1f;     public bool slowDown = false;      [Space(5)]     [Header("Rotation Settings")]     public float rotationSpeed;     public DepthOfField dephOfField;     public float waitingAnimation;     public float startConversation;      [Space(5)]     [Header("Cameras")]     public Camera[] cameras;      private Vector3 targetCenter;     private bool startWaitingAnim = true;     private bool endRot = false;     private int medea_m_arrebola_index;     private List<int> soldiers_indexs;     private Vector3 originalPosition;      // Use this for initialization     void Start()     {         originalPosition = transform.position;          targetCenter = target.GetComponent<Renderer>().bounds.center;         soldiers_indexs = new List<int>();          for (int i = 0; i < animators.Length; i++)         {             animators[i].SetFloat("Walking Speed", movingSpeed);              if(animators[i].name == "medea_m_arrebola")             {                 medea_m_arrebola_index = i;             }             else             {                 soldiers_indexs.Add(i);             }         }     }      // Update is called once per frame     void Update()     {         if (dephOfField.dephOfFieldFinished == true)         {             PlayConversations.PlaySingleConversation(0);             dephOfField.dephOfFieldFinished = false;         }          float distanceFromTarget = Vector3.Distance(animators[medea_m_arrebola_index].transform.position, target.position);          if (slowDown)         {             if (distanceFromTarget < 10)             {                 float speed = (distanceFromTarget / 10);                 for (int i = 0; i < animators.Length; i++)                 {                     animators[i].SetFloat("Walking Speed", speed);                 }             }         }          if (distanceFromTarget < 5f)         {             for (int i = 0; i < animators.Length; i++)             {                 animators[i].SetBool("Idle", true);                  if (startWaitingAnim == true)                 {                     StartCoroutine(WaitForAnimation());                     startWaitingAnim = false;                 }             }              if (waitinganimation == true)             {                 animators[medea_m_arrebola_index].SetBool("Magic Pack", true);                 waitinganimation = false;                  PlayConversations.PlaySingleConversation(1);             }              if(distanceFromTarget > 10 && BeginningCutsceneTrigger.entered == true)             {                 transform.position = originalPosition;                 cameras[0].enabled = false;                 cameras[1].enabled = true;             }              for (int i = 0; i < soldiers_indexs.Count; i++)             {                 animators[soldiers_indexs[i]].SetBool("Rifle Aiming Idle", true);                 if (!endRot)                 {                     Quaternion goalRotation = Quaternion.Euler(0f, 0f, 0f);                     float angleToGoal = Quaternion.Angle(                             goalRotation,                             animators[soldiers_indexs[i]].transform.localRotation);                     float angleThisFrame = Mathf.Min(angleToGoal, rotationSpeed * Time.deltaTime);                      int index = soldiers_indexs[i];                     animators[index].transform.Rotate(index % 2 == 0 ? Vector3.up : Vector3.down, angleThisFrame);                      // We end if we rotated the remaining amount.                     endRot = (angleThisFrame == angleToGoal);                 }             }         }     }      bool waitinganimation = false;     IEnumerator WaitForAnimation()     {         yield return new WaitForSeconds(waitingAnimation);          waitinganimation = true;     } } 

Maybe the reason is that the player is not in the view range of the other characters ? If I set it to be bigger then 3 it will switch the cameras but not move the transform to it’s original position.

And I want that when the distance is bigger then 10 and the other flag is true then change the transform position and switch the cameras but it’s not working.

This is how I trigger the flag and it’s working I checked with a break point :

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class BeginningCutsceneTrigger : MonoBehaviour {     public static bool entered = false;      private void OnTriggerEnter(Collider other)     {         entered = true;     } } 

How can I improve combat so my players don’t always use the strategy of focusing fire on one enemy at a time until it’s dead?

I’m DMing a campaign on 5e with a group of four players. We’re all experienced in RPG in general but not specifically on 5e.

Players are Level 4. Wizard, Fighter, Rogue and Druid, Circle of the Moon.

My players have come to the conclusion that, given the mechanics of the game, is much more effective to focus all the fire power on a creature at a time and avoid spreading damage. Their logic is it really doesn’t matter if a creature has 1 or 80 HP left, as longs a it has over 0, he has all capacity to do damage. In effect, creatures are binary, they are either alive and therefore have full capacity to act, or death, in which case they don’t.

Unfortunately I agree with this assessment but I feel it makes the game less fun. Not because I’m looking for super realistic combat but because it limits the combat strategy to “drop them one at a time”.

As such, they tend to not distribute their efforts or engage separately but, instead, swarm into a single enemy, concentrate all the attacks and then move to the next. This feels to me like the more effective tactic but also the least “fun” and role playing way of doing combat.

Is my players interpretation wrong or am I handling the combat in the wrong way? What am I missing?

Intuition behind min cut in a flow network? Whether it’s baseball elimination or project selection

I was wondering if someone can give me a general definition of a min-cut besides it being the max flow of a network.

For example, in the baseball elimination problem, if we wanted to find out if team z is eliminated, the min cut represents the team(s) that will beat team z out of the 1st place if the edges aren’t full saturated. If the edges are fully saturated, then min-cut is everything except t, and team z still has a chance.

For the project selection, the min cut contains the projects you should do to maximize your return.

How do people figure out that min-cut can be applied to these problems? What is it about min-cut that gives it such power?

Thank you!

One attack monster lose it’s strength bonus when gaining an additional attack?

In Pathfinder does a one-attack-monster keep its x1.5 strength bonus when gaining an additional attack type? This question came about when beastshaping into a one-attack-animal but temporarily granting it an additional weapon through the Transmuter (Shapechanger)’s Battleshaping ability which simply allows you to grow an additional natural weapon. Snippets of natural Attack

Primary attacks are made using the creature’s full base attack bonus and add the creature’s full strength bonus on damage. Secondary attacks … add only ½ the strength bonus on damage rolls.

If a creature has only one natural attack, it is always made using the creature’s full base attack bonus and adds 1 + ½ times the creature’s strength bonus on damage rolls. This increase does not apply if the creature has multiple attacks but only takes one.

There are some monster entries which specifically state that a weapon gains x1.5 strength regardless of situation, lets ignore those for this question. Does a One-Punch-monster lose it’s strength advantage when gaining an additional attack?

What happens when it’s time to level up and I no longer meet a multiclass prerequisite?

Suppose I’m playing a multiclass fighter/druid (because that’s how I Range). I’ve got both Wisdom and Dexterity above 13, but Strength’s only 10.

I annoy an efreet, who uses wishes to reduce both my Wisdom and Dexterity to 12. (Because my GM’s a lawyer and knows that I care about the rules, and that this will tie me into knots.)

It’s time to level up, and I don’t meet the prerequisite for either of my classes. Probably don’t meet the prereq for any third class, since I was so focused on Wisdom and Dexterity! Am I stuck until I otherwise raise a stat?

How to detect number of specific object in an image and it’s diameter(size)?

I have two images of IRON RODS (i.e only two images) and I want to detect how many rods are there in each image and get the diameter of each rod in a image?

I don’t know where to start as there are lot of articles regarding object detection and it’s hard to find one for my use-case.

If you can help me with a abstract view on how to model such requirement? Please point me a right direction.

Doubt:

1) How can I train with two images and then how to count numbers of rods are there in each image and retrieve it’s diameter?

When does a target know it’s under the effects of a charm/enchantment spell?

In 5th Edition which spells, like Suggestion, are not noticable, and which are noticeable by the target and/or nearby onlookers?
Are there differences if a target fails or succeeds on a save roll?
I noticed only a few Enchantment spells mention a comment on it, like ‘Charm Person’ or ‘Friends’.

Currently playing a Knowledge Domain Cleric with a different GM; please expand the answer to include Channel Divinity: Read Thoughts/Suggestion ability & spell combination. (The cleric ability which allows Suggestion to succeed automatically).

I’m Hungarian and very new to both 5th edition and this site, if I should change the format of my question please tell me how. Thank you.