Checksum on all code in database (Native)

haksvehaksve Member Posts: 17
Is it possible to - from within Navision - create a checksum for the total amount of code in a native database?

Best Regards

Comments

  • matttraxmatttrax Member Posts: 2,309
    You could do it based on the size field in the Object table I guess. That holds the size of the actual object not including the data. Plenty of checksum algorithms out there so just apply one of them to those amounts.
  • haksvehaksve Member Posts: 17
    I tried a similar thing (se "Copystream on BLOB fields "), but I run into some odd problem, like Navision crashed.

    Best Regards
  • matttraxmatttrax Member Posts: 2,309
    You don't need to read the actual encrypted code out of the blob field in the Object table. Just use the size that is already there.
  • haksvehaksve Member Posts: 17
    Possible, but not the same level of security, maybe I could Add also Date and Time into it. Could still be compomized, though.
    Not the perfect solution.
  • matttraxmatttrax Member Posts: 2,309
    Everything can be compromised. I have to ask, although you probably can't tell me, why do you need this? Are you worried some rogue C/SIDE developer is going to come in and change the code? I've always found base NAV Security more than adequate, even if it is a pain to setup. It's very easy to setup a business process for access and code deployment.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    matttrax wrote:
    ...why do you need this? ...

    Actually it got me thinking that it would be very usefull in cases where you have many (say >100) database that should have the same code base. A check sum would be a good way to make sure that you have all the same objects in each of them. Retail is a good example but there are more.
    David Singleton
  • matttraxmatttrax Member Posts: 2,309
    it would be very usefull in cases where you have many (say >100)

    I'm so not used to thinking on that large of a level :D
  • haksvehaksve Member Posts: 17
    The reason for my need is the new swedish law about fiscal control boxes on POS (Sales terminals in stores).
    We must declarate that our product fullfill the new law.
    In the declaration we state the checksum and if the checksum has changed, we are no longer responible for malfunction due to the law.
  • matteo_montanarimatteo_montanari Member Posts: 189
    haksve wrote:
    The reason for my need is the new swedish law about fiscal control boxes on POS (Sales terminals in stores).
    We must declarate that our product fullfill the new law.
    In the declaration we state the checksum and if the checksum has changed, we are no longer responible for malfunction due to the law.

    hi

    You can export blob object definition like every other blob field and then execute your custom external automation or a C/Side custom function to obtain an Hash. Then confront this hash with the original Hash to find changes.

    bye

    Matteo
    Reno Sistemi Navision Developer
  • haksvehaksve Member Posts: 17
    Eto wrote:
    haksve wrote:
    The reason for my need is the new swedish law about fiscal control boxes on POS (Sales terminals in stores).
    We must declarate that our product fullfill the new law.
    In the declaration we state the checksum and if the checksum has changed, we are no longer responible for malfunction due to the law.

    hi

    You can export blob object definition like every other blob field and then execute your custom external automation or a C/Side custom function to obtain an Hash. Then confront this hash with the original Hash to find changes.

    bye

    Matteo

    Hello Matteo

    Unfortunately I run into problem there. (se "Copystream on BLOB fields ").
  • DenSterDenSter Member Posts: 8,304
    haksve wrote:
    ... new swedish law ...
    Have you contacted MSFT about this? New legal requirements should find themselves into the localization at some point. If not an actual update to the system, then at least a way to deal with the requirement.
  • ara3nara3n Member Posts: 9,256
    DenSter wrote:
    haksve wrote:
    ... new swedish law ...
    Have you contacted MSFT about this? New legal requirements should find themselves into the localization at some point. If not an actual update to the system, then at least a way to deal with the requirement.


    MS NAV doesn't release a POS system, so it should be add-on responsibility to provide the functionality if they providing a localization for that country.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • matteo_montanarimatteo_montanari Member Posts: 189
    haksve wrote:
    Eto wrote:
    haksve wrote:
    The reason for my need is the new swedish law about fiscal control boxes on POS (Sales terminals in stores).
    We must declarate that our product fullfill the new law.
    In the declaration we state the checksum and if the checksum has changed, we are no longer responible for malfunction due to the law.

    hi

    You can export blob object definition like every other blob field and then execute your custom external automation or a C/Side custom function to obtain an Hash. Then confront this hash with the original Hash to find changes.

    bye

    Matteo

    Hello Matteo

    Unfortunately I run into problem there. (se "Copystream on BLOB fields ").

    Object.GET(Object.type::Table,'',27); // '' = ' + ' not "
    Object.CALCFIELDS("BLOB Reference");
    Object."BLOB Reference".EXPORT('',TRUE); // '' = ' + ' not "

    OR

    Object."BLOB Reference".CREATEOUTSTREAM(outstream);
    etc..

    It can be an useful tips?

    Matteo
    Reno Sistemi Navision Developer
  • DenSterDenSter Member Posts: 8,304
    ara3n wrote:
    DenSter wrote:
    haksve wrote:
    ... new swedish law ...
    Have you contacted MSFT about this? New legal requirements should find themselves into the localization at some point. If not an actual update to the system, then at least a way to deal with the requirement.
    MS NAV doesn't release a POS system, so it should be add-on responsibility to provide the functionality if they providing a localization for that country.
    Nevertheless, MSFT might have a suggestion about how to deal with it. I didn't say anything about whose responsibility it is to put what in which localization did I :mrgreen:
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    haksve wrote:
    The reason for my need is the new swedish law about fiscal control boxes on POS (Sales terminals in stores).
    We must declarate that our product fullfill the new law.
    In the declaration we state the checksum and if the checksum has changed, we are no longer responible for malfunction due to the law.

    Do you need this checksum to be calculated on every NAV run ? If not why don't you then just export ('normal way', using Object Desinger) all object (or only interesting/important ones) to fob or text file and calculate MD5 checksum from that file in some external utility ?

    Personally I don't think that such a checksum will protect you in any way. As long as someone else has developer access he/she can easilly take backup of all your objects, change whatever he wants (including checksum calculating/comparing functions), change/post some data with spoiled code, and then restore your original objects. And post-factum you wil not be able to prove that something was changed, or bad data was created by modified code. From this point of view off-line checksum is enough.

    If you were on SQL, or have possibility to update SQL, even to free SQL Express, you could look for some code-changes tracking tools, based on SQL level trigger on Object table - at least you would have a track that someone had changed your objects. Unless some DB admin would wipe out logging table of course :).

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.