magento2 – Magento 2: How to allow updating a null value for a column that has foreign key restriction?

I have 2 tables A and B

A

yes

  • I.D
  • Name
  • a_id FK refers to A (id)

I used the Magento update script to add both tables, everything was created correctly, however, when I tried to set a_id to null through the Magento code, it threw an FK exception:

Something went wrong while saving the B.SQLSTATE(23000): Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails

However, when I tried to update the column through MySQL directly, I have no problems:

UPDATE B SET a_id = null WHERE id = 1;

Then it's from Magento MagentoFrameworkForeignKeyStrategyRestrict That is not allowing this operation. How can I avoid this restriction, since MySQL did not throw any error?

Certificates – Does it make sense to use the "Key Encipherment" key when using ECDH P384?

I set up a Windows CA and created a certificate template to issue certificates with ECDH_P384 keys:

one

Then I realized that it is not possible to establish the use of the "Key encryption" key in the "Extensions" tab:

two]

What is the reason behind this limitation?
Is it correct to say that the use of the "Key Encipherment" key is meaningless when using ECDH since it is already a key agreement protocol?

apache: how can I change the DH key, enable SMTP and FTPS in plesk?

one of the clients has performed a security analysis for the website I am working on, so he found some problems that I need to solve
These problems are:
Login text without encryption FTP without encryption
// solution: enable FTPS or apply the connection through & # 39; AUTH TLS & # 39;

Logging text without encryption SMTP without encryption
// solution: enable SMTPS or apply the connection using the command & # 39; STARTTLS & # 39;

Login of unencrypted text POP3 without encryption
//solution:
Configure the remote server to always enforce encrypted connections through SSL / TLS with the command & # 39; STLS & # 39;

SSL / TLS: Insufficient DH group force vulnerability in Diffie-Hellman key exchange …
//solution:
Implement (ephemeral) elliptical curve Diffie-Hellman (ECDHE) or use a Diffie-Hellman group of 2048 bits or stronger

I've been looking for how to apply these solutions for so long, but I couldn't find a way if someone knows how I'd appreciate it.
I am using Plesk onyx, Apache with a user account

node.js: get linked data from a foreign key when updating a record

I have a foreign key masters_teams_id. What is associated with the masters_teams table. And in this table there are three fields. master_team_id teams_id Y masters_id. Is it possible, when updating a record, to obtain this attachment (specifically teams_id Y masters_id) of a foreign key?

module.exports.update = async function (req, res) {
    try {

        let dr = {
            report_date: req.body.report_date,
            urgent_need: req.body.urgent_need,
            chock: req.body.chock,
            layer: req.body.layer,
            masters_teams_id: req.body.masters_teams_id
        }
        console.log(dr.masters_teams_id)
            await DR.update(dr, {
                where: {
                    dr_id: req.params.dr_id
                }
            });
            res.status(200).json(dr);
    } catch (e) {
        errorHandler(res, e);
    }
};

php: assigns the name of the key based on the row while the loop

There is no identifiable difference between the column names in your table and your preferred keys, but if you want to modify the keys, simply integrate that into your SELECT clause: that's what the "aliases" are for.

Suppose you want to capitalize the name of each column, this is what it might look like:

$stmt = $conn->prepare("SELECT name AS Name,
                               company AS Company,
                               email AS Email,
                               phone AS Phone,
                               address AS Address
                        FROM tickets_info
                        WHERE ticket = ?");
$stmt->execute(($_POST('ticket')));
$ticket = $stmt->fetch(PDO::FETCH_ASSOC) ?: ();

Note that I am not using a loop. Its fragment is overwritten in the loop, so I am interpreting that that means that ticket It is a PRIMARY / SINGLE column.


If you want to extract all the columns from your table and use the column names as keys, you do not need to change your original query.

$stmt = $conn->prepare("SELECT * FROM tickets_info WHERE ticket = ?");
$stmt->execute(($_POST('ticket')));
$ticket = $stmt->fetch(PDO::FETCH_ASSOC) ?: ();

Returns the object within an array that has the smallest value in a specific Javascript key

Hi

I have the following array of objects:

const cores = (
    {cor: 'amarelo',
    peso: 2},
    {cor: 'amarelo',
    peso: 3},
    {cor: 'verde',
    peso: 7},
)

My goal is to first filter it to return only objects with yellow, and I do this with:

const mani = obj.filter(spec => spec.cor === 'amarelo');

After that, I have to filter this array so that only the lightest object returns me, this would be the expected object:

 {cor: 'amarelo', peso: 2},

As I would do it?

openssl – Generating a CSR for 32-bit private rsa key

I used an OpenSSL 1.0.1k version from January 8, 2015 to generate a 32-bit RSA key, and tried to generate a CSR for the key

$ openssl req -new -key privatekey.pem -out csr.pem 

139645847348928:error:04075070:rsa routines:RSA_sign:digest too big for rsa key:rsa_sign.c:127:
139645847348928:error:0D0DC006:asn1 encoding routines:ASN1_item_sign_ctx:EVP lib:a_sign.c:314:

openssl only allows me to generate no less than 384 bits. Is there another way to generate a CSR for my private key?

private key: how to subtract two points on an elliptical curve?

Please tell me if there is a formula for A-B, (That is, subtraction of two points / less). I know how two points add up, A + B This addition is described in detail on the Bill Buchanan crypto website:
https://asecuritysite.com/encryption/ecc_points_add2

Bill Buchanan wrote the formula: in this case we calculate x3 + ax + b (modp). We can add two points (x1, y1) Y (x2, y2):

Leave s = (y1 − y2) / (x1 − x2)
Then:

x2 = s2 − x1 − x2
y2 = s (x1 − x2) −y1

(Please tell me how you can change the formula to subtract two points / less) A-B

Authentication: API key validation in a back-end web service with very few users

I have encountered this scenario a couple of times, but I hope to get confirmation that I am on the right track or a suggestion about what else should be done.

Situation

I am creating a back-end web service that provides access to confidential data or privileged operations. This web service will not be publicly accessible, but will be called by a front-end application that is. Ultimately, there may be multiple applications that need access to the service, but not necessarily with different levels of access.

We want to secure the web service so that any other device on the network can make calls to the service, or track traffic to determine how to authenticate.

Solution

Using a large and securely generated random API key, which is sent through basic authentication, the username and password are separated, the password is encrypted with SHA-256 and the result is compared with a value stored for the user.

Since the password is a large random value (say 128 bits), the purpose of encrypting the value is primarily:

  1. To avoid storing the API key in the web service
  2. To avoid synchronization attacks from string comparison against the real API key, if the application actually stored it

Additional thoughts

I thought about making a more typical password hash method (for example, Argon2), but since the password is not meant to be read by humans, it doesn't seem to get much. Even adding salt to the value does not seem to be very valuable since the space of possible API keys is very large.

There is also a clear need to keep this fast, as it will be sent with each request, so it is not convenient to do too much processing.

Also, since this method is very simple, I am not really looking for an alternative method if it is safe enough. I am really looking for improvements that can be made to this scheme or reasons why it is not absolutely certain (in which case I am willing to hear about alternatives).

linux – Using a keyboard key for Libinput ScrollButton

I want my trackball to enter scrolling mode when I press and hold a key on my keyboard. Libinput documents say that the scroll button "can be changed with libinput_device_config_scroll_set_button () but it must be on the same device as the motion events", so it seems that I can only use the mouse buttons like ScrollButton inside libinput. Can anyone think of a solution here? Xev does not capture scrolling events, so I cannot reassign a keyboard key to the libinput ScrollButton w / xdotool.