Git Product home page Git Product logo

Comments (6)

laraform avatar laraform commented on May 24, 2024

Yes, this Hash library can only encode/decode numeric keys, which indeed aims to provide some level of security in production. It will not work with non-numeric keys though, but I'll come up with a solution for that in a later release, thanks! In the meantime I can recommended setting secret to false on guid, which should skip the encoding part.

from laraform.

gmartinez avatar gmartinez commented on May 24, 2024

Setting secret to false, I had already tried, does not work, the logic still enters setKeyFormData() and in there it correctly enters the if where it attempts the Hash:decode($key); which returns an empty array.

My workaround works though (!?)

from laraform.

gmartinez avatar gmartinez commented on May 24, 2024

I've changed my workaround, left ln 814 at Laraform.php as it was, and changed ln 28 of Support/Hash.php from;

return (new Hashids(md5(env('APP_KEY')), 10))->decode($value)[0]

to

return (new Hashids(md5(env('APP_KEY')), 10))->decode($value)[0] ?? $value;

from laraform.

laraform avatar laraform commented on May 24, 2024

If your fix works, it's fine, but I'll look into the issue anyway. A whole example with model and migration would help though.

from laraform.

gmartinez avatar gmartinez commented on May 24, 2024

Table looks like;

CREATE TABLE objects (
guid char(40) COLLATE utf8mb4_unicode_ci NOT NULL,
name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
type varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
status varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
_props longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
UNIQUE KEY objects_guid_unique (guid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Model has nothing special, looks like;

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Arr;
use Laravel\Scout\Searchable;

class Obj extends Model
{
use Searchable;
//
protected $connection;
protected $table = 'objects';
protected $primaryKey = 'guid';
protected $keyType = 'string';
protected $casts = [
'_props' => 'json',
];
public $incrementing = false;
}

from laraform.

laraform avatar laraform commented on May 24, 2024

Hi! I've created a new bug report template, so if you still have the issue please resubmit accordingly: https://github.com/laraform/laraform/issues/new?assignees=&labels=bug&template=1_bugs.md&title=%5BBUG%5D

(was not able to reproduce the bug because I was thrown "Unknown column" sql error)

from laraform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.